wip: bcodes are converted with pre + span(s)
This commit is contained in:
parent
a0a425afb2
commit
1ed0b86082
|
@ -129,8 +129,8 @@ def wip_begin_markers(wip_lines):
|
|||
['^>>\s' , '<a id="%s"></a>' , True ],
|
||||
[r'^\($|\(\s' , '<p class="%s">' , True ],
|
||||
['^\)$|^\)\s' , '</p>' , False],
|
||||
['^\[\[$|^\[\[\s' , '<precode class="%s"' , True ],
|
||||
['^\]\]$|^\]\]\s' , '</precode>' , False]
|
||||
['^\[\[$|^\[\[\s' , '<pre class="%s"' , True ],
|
||||
['^\]\]$|^\]\]\s' , '</pre>' , False]
|
||||
]
|
||||
|
||||
for line in wip_lines:
|
||||
|
@ -448,26 +448,34 @@ def convert_bcodes(article, fm, lm, css):
|
|||
article_temp = ''
|
||||
bCode = False
|
||||
bCode_lines = ''
|
||||
bCode_ln = 0
|
||||
|
||||
for line in article:
|
||||
if line.startswith(fm):
|
||||
bCode = True
|
||||
article_temp = '%s%s\n'%(article_temp, line)
|
||||
article_temp = '%s\n%s'%(article_temp, line)
|
||||
continue
|
||||
|
||||
if line.startswith(lm):
|
||||
bCode = False
|
||||
|
||||
#print(bCode_lines)
|
||||
print(bCode_lines)
|
||||
convert_to_b64(bCode_lines)
|
||||
bCode_lines = ''
|
||||
article_temp = '%s%s\n%s\n'%(
|
||||
article_temp = '%s\n%s\n%s'%(
|
||||
article_temp, b64_content, line
|
||||
)
|
||||
continue
|
||||
|
||||
if bCode: bCode_lines = '%s%s\n'%(bCode_lines, line)
|
||||
else : article_temp = '%s%s\n'%(article_temp, line)
|
||||
if bCode:
|
||||
bCode_ln += 1
|
||||
line = ' <span class="lnbr">%s</span><span>%s</span>'%(
|
||||
bCode_ln, line
|
||||
)
|
||||
if bCode_lines: bCode_lines = '%s\n%s'%(bCode_lines, line)
|
||||
else : bCode_lines = line
|
||||
else:
|
||||
article_temp = '%s\n%s'%(article_temp, line)
|
||||
|
||||
#====================================#
|
||||
# Protect bCodes contents to base64 #
|
||||
|
|
Loading…
Reference in New Issue