diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index c8c07ac..249a2e0 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -482,7 +482,7 @@ def check_content(post_bottom): if line.startswith(tag[1]): c_closed += 1 if c_opened != c_closed: - tyto.exiting("8", '%s: %s %s'%(tag[4], tag[0], tag[1]), False) + tyto.exiting("8", '%s: "%s", "%s"'%(tag[4], tag[0], tag[1]), False) post_err = True return # Useless and could code errors to check nexts else: diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index ae5fe81..7d03fd8 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -291,13 +291,14 @@ def protect_icodes(post_bottom, article_bottom): # Get only lines that contains code for ln, line in enumerate(post_bottom): - if '{_' and '_}' in line: + if words_tags[9][0] and words_tags[9][1] in line: # Iterate in line for i, c in enumerate(line): + c_b = c_bb = c_a = "" if c == '_': c_b = line[i-1] # before - c_bb = line[i-2] # before + before + c_bb = line[i-2] # before, before c_a = line[i+1] # after # incode if @@ -311,9 +312,9 @@ def protect_icodes(post_bottom, article_bottom): if c_a == '}' and not c_b == '\\': incode = False code = '%s%s%s'%(code, src_code, words_tags[9][3]) - b64_code = b64('Encode', code, 'I64_', '_I64') + b64_code = b64('Encode', code, 'I64.', '.I64') rep_code = "%s%s%s"%( - words_tags[9][0],rep_code,words_tags[9][1] + words_tags[9][0], rep_code, words_tags[9][1] ) temp_post = protect_article.replace(rep_code, b64_code) protect_article = temp_post @@ -388,7 +389,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom): elif line.startswith(words_tags[12][1]): bcode = '%s\n%s'%(bcode, line) in_bcode = False - b64_bcode = b64('Encode', bcode, 'B64_', '_B64') + b64_bcode = b64('Encode', bcode, 'B64.', '.B64') protect_article = '%s\n%s'%(protect_article, b64_bcode) bcode = '' continue @@ -404,7 +405,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom): if not in_bcode: quote = '%s\n%s'%(quote, line) in_quote = False - b64_quote = b64('Encode', quote, 'Q64_', '_Q64') + b64_quote = b64('Encode', quote, 'Q64.', '.Q64') protect_article = '%s\n%s'%(protect_article, b64_quote) quote = '' continue @@ -424,7 +425,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom): #=====================================# # Encode/Decode string to/from base64 # -# Data protection # +# Data protection in UTF8 # #-------------------------------------# def b64(action, content, before, after): if action == 'Encode': @@ -460,12 +461,12 @@ def exiting(nbr, value, out): '5' : ':< \033[1;31mUnused argument\033[0;0m file', '6' : ':< \033[1;31mUnused "%s"\033[0;0m in article'%value, '7' : ':< Article is \033[1;31mnot valid yet\033[0;0m', - '8' : ':< tags "%s" \033[1;31mnot paired\033[0;0m'%value, + '8' : ':< %s: \033[1;31mnot paired\033[0;0m'%value, '9' : ':D Article has changed (wip is old)', '10' : ':< \033[1;31mUnused "%s"\033[0;0m in article\'s header'%value, '20' : ':D Article already up-to-date on: %s'%value, '21' : ':D \033[1;32mArticle is valid\033[0;0m and ready to wip', - '22' : ':/ \033[1;33mWarning: not paired symbols\033[0;0m %s'%value, + '22' : ':? Symbols: %s \033[1;33mnot paired\033[0;0m'%value, '255' : ':| Maybe later...' } diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 2647cfa..c17b7b9 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -296,9 +296,9 @@ def wip_quotes() : for ln, line in enumerate(article_bottom.rsplit('\n')): # Decode from base64 if line.startswith('Q64'): - line = line.replace('Q64_', '') - line = line.replace('_Q64', '') - quote = tyto.b64('Decode', line, 'Q64_', '_Q64').rsplit("\n") + line = line.replace('Q64.', '') + line = line.replace('.Q64', '') + quote = tyto.b64('Decode', line, 'Q64.', '.Q64').rsplit("\n") # Read the quote. Get parameters author = date = lang = book = link = quote_html = '' @@ -385,6 +385,7 @@ def wip_quotes() : elif book: title_html = ' title="%s"'%(book) elif date: title_html = ' title="(%s)"'%(date) + time_html_o = time_html_c = '' if date: time_html_o = '\n' @@ -413,5 +414,7 @@ def wip_quotes() : '' # Replace line with final HTML Quote - article_bottom = article_bottom.replace('Q64_%s_Q64'%line, quote_html) + article_bottom = article_bottom.replace( + 'Q64.%s.Q64'%line, quote_html + )