fix bcode when wip ; keep empty lines in bcode

This commit is contained in:
Cyrille L 2023-04-10 17:17:40 +02:00
parent 2bc3abb7ee
commit 1dfb40d0b2
3 changed files with 23 additions and 22 deletions

View File

@ -112,6 +112,13 @@ cite.cite {
span.custom { span.custom {
} }
/* Block_code */
code.DOMAIN {
}
pre.bcode {
}
div.bcode {
}
/* section for author and date */ /* section for author and date */
section#article_infos { section#article_infos {

View File

@ -329,14 +329,6 @@ def protect_bcodes_quotes(process, post_bottom):
b64_quote = b64('Encode', quote, 'Q64.', '.Q64') b64_quote = b64('Encode', quote, 'Q64.', '.Q64')
line = b64_quote line = b64_quote
'''
# Remove coemments and empty lines for wip
if not in_quote and not in_bcode:
if not line:
continue
if line.startswith('#') and not line.startswith(titles_tags):
continue
'''
# Counters and keep tags for check process # Counters and keep tags for check process
#----------------------------------------- #-----------------------------------------
@ -345,7 +337,6 @@ def protect_bcodes_quotes(process, post_bottom):
or in_quote and not start_quote : or in_quote and not start_quote :
line = '#-Protectedline-' line = '#-Protectedline-'
# Set new article content for wip process # Set new article content for wip process
#---------------------------------------- #----------------------------------------
elif process == "wip": elif process == "wip":
@ -353,12 +344,11 @@ def protect_bcodes_quotes(process, post_bottom):
if not in_quote and not in_bcode: if not in_quote and not in_bcode:
if not line: if not line:
continue continue
elif line.startswith('#') \ elif line.startswith('#') and not line.startswith(titles_tags):
and not line.startswith(titles_tags):
continue continue
# bcode convertion to base64 # bcode convertion to base64
if in_bcode: elif in_bcode:
# Convert lines to b64 # Convert lines to b64
if not bcode: bcode = line if not bcode: bcode = line
else: bcode = '%s\n%s'%(bcode, line) else: bcode = '%s\n%s'%(bcode, line)

View File

@ -92,7 +92,9 @@ def manage(target):
# wip is up-to-date: ask to wip again # wip is up-to-date: ask to wip again
else: else:
logs.out("19", db.date_wip, False) logs.out("19", db.date_wip, False)
form.asking(' ├ [%s] %s%s '%(db.title, langs.site.wip_new, langs.site.q), True) form.asking(' ├ [%s] %s%s '%(
db.title, langs.site.wip_new, langs.site.q
), True)
wip_article(db.uri_file) wip_article(db.uri_file)
@ -236,8 +238,7 @@ def file_to_string(post_file):
continue continue
if sep: if sep:
if not line: continue if not post_bottom: post_bottom = line
elif not post_bottom: post_bottom = line
else: post_bottom = '%s\n%s'%(post_bottom, line) else: post_bottom = '%s\n%s'%(post_bottom, line)
else: else:
if not post_header: post_header = line if not post_header: post_header = line
@ -676,19 +677,19 @@ def wip_bcodes():
if line.startswith(tyto.words_tags[12][0]): if line.startswith(tyto.words_tags[12][0]):
set_css = tyto.get_css(line) set_css = tyto.get_css(line)
html_bcode = \ html_bcode = \
'<pre class="%s">\n'%set_css + \ '<code class="%s">\n'%set_css + \
' <code class="bcode">' ' <pre class="bcode">'
# closed marker # closed marker
elif line.startswith(tyto.words_tags[12][1]): elif line.startswith(tyto.words_tags[12][1]):
html_bcode = \ html_bcode = \
'%s\n </code>\n'%html_bcode + \ '%s\n </pre>\n'%html_bcode + \
'</pre>' '</code>'
# Block-code content per line # Block-code content per line
else: else:
html_bcode = \ html_bcode = \
'%s\n <span class="bcode">%s</span>'%( '%s\n <div class="bcode">%s</div>'%(
html_bcode, line html_bcode, line
) )
@ -964,6 +965,9 @@ def wip_tabs():
cs = 0 cs = 0
for line in post_bottom.rsplit('\n'): for line in post_bottom.rsplit('\n'):
if not line:
continue;
# Titles # Titles
if line.startswith('<!'): if line.startswith('<!'):
if cs != 1: if cs != 1: