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 {
}
/* Block_code */
code.DOMAIN {
}
pre.bcode {
}
div.bcode {
}
/* section for author and date */
section#article_infos {

View File

@ -329,14 +329,6 @@ def protect_bcodes_quotes(process, post_bottom):
b64_quote = b64('Encode', quote, 'Q64.', '.Q64')
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
#-----------------------------------------
@ -345,20 +337,18 @@ def protect_bcodes_quotes(process, post_bottom):
or in_quote and not start_quote :
line = '#-Protectedline-'
# Set new article content for wip process
#----------------------------------------
elif process == "wip":
# Remove empty line and comments
if not in_quote and not in_bcode:
if not line:
if not line:
continue
elif line.startswith('#') \
and not line.startswith(titles_tags):
elif line.startswith('#') and not line.startswith(titles_tags):
continue
# bcode convertion to base64
if in_bcode:
elif in_bcode:
# Convert lines to b64
if not bcode: 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
else:
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)
@ -236,8 +238,7 @@ def file_to_string(post_file):
continue
if sep:
if not line: continue
elif not post_bottom: post_bottom = line
if not post_bottom: post_bottom = line
else: post_bottom = '%s\n%s'%(post_bottom, line)
else:
if not post_header: post_header = line
@ -676,19 +677,19 @@ def wip_bcodes():
if line.startswith(tyto.words_tags[12][0]):
set_css = tyto.get_css(line)
html_bcode = \
'<pre class="%s">\n'%set_css + \
' <code class="bcode">'
'<code class="%s">\n'%set_css + \
' <pre class="bcode">'
# closed marker
elif line.startswith(tyto.words_tags[12][1]):
html_bcode = \
'%s\n </code>\n'%html_bcode + \
'</pre>'
'%s\n </pre>\n'%html_bcode + \
'</code>'
# Block-code content per line
else:
html_bcode = \
'%s\n <span class="bcode">%s</span>'%(
'%s\n <div class="bcode">%s</div>'%(
html_bcode, line
)
@ -964,6 +965,9 @@ def wip_tabs():
cs = 0
for line in post_bottom.rsplit('\n'):
if not line:
continue;
# Titles
if line.startswith('<!'):
if cs != 1: