base64: fix markers (avoid used marker)
This commit is contained in:
parent
fa06f9c84a
commit
b2f0df2fe4
|
@ -482,7 +482,7 @@ def check_content(post_bottom):
|
||||||
if line.startswith(tag[1]): c_closed += 1
|
if line.startswith(tag[1]): c_closed += 1
|
||||||
|
|
||||||
if c_opened != c_closed:
|
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
|
post_err = True
|
||||||
return # Useless and could code errors to check nexts
|
return # Useless and could code errors to check nexts
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -291,13 +291,14 @@ def protect_icodes(post_bottom, article_bottom):
|
||||||
|
|
||||||
# Get only lines that contains code
|
# Get only lines that contains code
|
||||||
for ln, line in enumerate(post_bottom):
|
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
|
# Iterate in line
|
||||||
for i, c in enumerate(line):
|
for i, c in enumerate(line):
|
||||||
|
c_b = c_bb = c_a = ""
|
||||||
if c == '_':
|
if c == '_':
|
||||||
c_b = line[i-1] # before
|
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
|
c_a = line[i+1] # after
|
||||||
|
|
||||||
# incode if
|
# incode if
|
||||||
|
@ -311,9 +312,9 @@ def protect_icodes(post_bottom, article_bottom):
|
||||||
if c_a == '}' and not c_b == '\\':
|
if c_a == '}' and not c_b == '\\':
|
||||||
incode = False
|
incode = False
|
||||||
code = '%s%s%s'%(code, src_code, words_tags[9][3])
|
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"%(
|
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)
|
temp_post = protect_article.replace(rep_code, b64_code)
|
||||||
protect_article = temp_post
|
protect_article = temp_post
|
||||||
|
@ -388,7 +389,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom):
|
||||||
elif line.startswith(words_tags[12][1]):
|
elif line.startswith(words_tags[12][1]):
|
||||||
bcode = '%s\n%s'%(bcode, line)
|
bcode = '%s\n%s'%(bcode, line)
|
||||||
in_bcode = False
|
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)
|
protect_article = '%s\n%s'%(protect_article, b64_bcode)
|
||||||
bcode = ''
|
bcode = ''
|
||||||
continue
|
continue
|
||||||
|
@ -404,7 +405,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom):
|
||||||
if not in_bcode:
|
if not in_bcode:
|
||||||
quote = '%s\n%s'%(quote, line)
|
quote = '%s\n%s'%(quote, line)
|
||||||
in_quote = False
|
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)
|
protect_article = '%s\n%s'%(protect_article, b64_quote)
|
||||||
quote = ''
|
quote = ''
|
||||||
continue
|
continue
|
||||||
|
@ -424,7 +425,7 @@ def protect_bcodes_quotes(process, post_bottom, article_bottom):
|
||||||
|
|
||||||
#=====================================#
|
#=====================================#
|
||||||
# Encode/Decode string to/from base64 #
|
# Encode/Decode string to/from base64 #
|
||||||
# Data protection #
|
# Data protection in UTF8 #
|
||||||
#-------------------------------------#
|
#-------------------------------------#
|
||||||
def b64(action, content, before, after):
|
def b64(action, content, before, after):
|
||||||
if action == 'Encode':
|
if action == 'Encode':
|
||||||
|
@ -460,12 +461,12 @@ def exiting(nbr, value, out):
|
||||||
'5' : ':< \033[1;31mUnused argument\033[0;0m file',
|
'5' : ':< \033[1;31mUnused argument\033[0;0m file',
|
||||||
'6' : ':< \033[1;31mUnused "%s"\033[0;0m in article'%value,
|
'6' : ':< \033[1;31mUnused "%s"\033[0;0m in article'%value,
|
||||||
'7' : ':< Article is \033[1;31mnot valid yet\033[0;0m',
|
'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)',
|
'9' : ':D Article has changed (wip is old)',
|
||||||
'10' : ':< \033[1;31mUnused "%s"\033[0;0m in article\'s header'%value,
|
'10' : ':< \033[1;31mUnused "%s"\033[0;0m in article\'s header'%value,
|
||||||
'20' : ':D Article already up-to-date on: %s'%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',
|
'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...'
|
'255' : ':| Maybe later...'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,9 +296,9 @@ def wip_quotes() :
|
||||||
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
for ln, line in enumerate(article_bottom.rsplit('\n')):
|
||||||
# Decode from base64
|
# Decode from base64
|
||||||
if line.startswith('Q64'):
|
if line.startswith('Q64'):
|
||||||
line = line.replace('Q64_', '')
|
line = line.replace('Q64.', '')
|
||||||
line = line.replace('_Q64', '')
|
line = line.replace('.Q64', '')
|
||||||
quote = tyto.b64('Decode', line, 'Q64_', '_Q64').rsplit("\n")
|
quote = tyto.b64('Decode', line, 'Q64.', '.Q64').rsplit("\n")
|
||||||
|
|
||||||
# Read the quote. Get parameters
|
# Read the quote. Get parameters
|
||||||
author = date = lang = book = link = quote_html = ''
|
author = date = lang = book = link = quote_html = ''
|
||||||
|
@ -385,6 +385,7 @@ def wip_quotes() :
|
||||||
elif book: title_html = ' title="%s"'%(book)
|
elif book: title_html = ' title="%s"'%(book)
|
||||||
elif date: title_html = ' title="(%s)"'%(date)
|
elif date: title_html = ' title="(%s)"'%(date)
|
||||||
|
|
||||||
|
time_html_o = time_html_c = ''
|
||||||
if date:
|
if date:
|
||||||
time_html_o = '<time datetime="%s">\n'%date
|
time_html_o = '<time datetime="%s">\n'%date
|
||||||
time_html_c = '</time>\n'
|
time_html_c = '</time>\n'
|
||||||
|
@ -413,5 +414,7 @@ def wip_quotes() :
|
||||||
'</blockquote>'
|
'</blockquote>'
|
||||||
|
|
||||||
# Replace line with final HTML Quote
|
# 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
|
||||||
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue