wip: in-dev for HTML tabulations from final result
This commit is contained in:
parent
dcce2983c2
commit
c841c63218
|
@ -107,6 +107,9 @@ def manage_wip(file_post, Force):
|
|||
print('> Article HTML:')
|
||||
print(wip_html)
|
||||
|
||||
tab_article(wip_html.rsplit('\n'))
|
||||
|
||||
|
||||
|
||||
#============================#
|
||||
# HTML CONVERTERS #
|
||||
|
@ -575,3 +578,37 @@ def convert_from_b64(post_content):
|
|||
base64_bytes = base64.b64decode(content_bytes)
|
||||
src_content = base64_bytes.decode("utf8")
|
||||
|
||||
|
||||
#=======================#
|
||||
# Tabulations formating #
|
||||
#-----------------------#
|
||||
def tab_article(article):
|
||||
global wip_html
|
||||
|
||||
wip_tmp = ''
|
||||
tab = 0
|
||||
|
||||
for line in article:
|
||||
if len(line) == 0: continue
|
||||
|
||||
print(line)
|
||||
if line.startswith('<h'):
|
||||
tn = line[2]
|
||||
tab = int(tn) * 3
|
||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
tab = int(tab) + 3
|
||||
continue
|
||||
|
||||
if line.startswith('<div'):
|
||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
tab = int(tab) + 3
|
||||
continue
|
||||
|
||||
if line.startswith('</div'):
|
||||
tab = int(tab) - 3
|
||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
continue
|
||||
|
||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
|
||||
print(wip_tmp)
|
||||
|
|
Loading…
Reference in New Issue