diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index c7dd5d7..908caa4 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -104,14 +104,17 @@ def manage_wip(file_post, Force): if links_u > 0: wip_links( wip_html) if quotes > 0: wip_quotes( wip_html.rsplit('\n')) + # brut files + if bruts_u > 0: wip_bruts( wip_html.rsplit('\n')) + # Get Legacy contents from base64 markers convert_all_b64(wip_html.rsplit('\n')) - print('> Article HTML:') - print(wip_html) + #print('> Article HTML:') + #print(wip_html) - #print('> Article with Tabs:') - #tab_article(wip_html.rsplit('\n')) + print('> Article with Tabs:') + tab_article(wip_html.rsplit('\n')) @@ -553,6 +556,55 @@ def wip_images(article): else : wip_html = line +#=============================================# +# Convert line _brut: to pre HTML, like bCode # +#---------------------------------------------# +def wip_bruts(article): + global wip_html + + wip_html = '' + + all_vars = set(globals()) + + for var in all_vars: + if var.startswith('brut_'): + brut = globals()[var] + + + # Search in article lines for _image: + for line in article: + if not line.startswith('_brut:'): + if wip_html: wip_html = '%s\n%s'%(wip_html, line) + else : wip_html = line + + elif line.startswith('_brut:%s'%brut[0]): + # Open target file + brut_file = '' + brut_html = '' # brut file contents + brut_uri = brut[1][1:len(brut[1])] # No need first "/" + brut_file = '%s%s'%(domain.domain_articles, brut_uri) + brut_datas = open(brut_file, 'r').read() + + # Convert each lines to HTML, add to string + for ln, bline in enumerate(brut_datas.rsplit('\n'), 1): + brut_line_html = '%s'%ln + \ + '%s'%bline + if brut_html: brut_html = '%s\n%s'%(brut_html,brut_line_html) + else : brut_html = brut_line_html + + # Get CSS, if exists, before creating last brut_html + get_css(line) + + # Add first and last HTML tags to string + brut_html = '
\n'%( + css_set, brut[2]) + \ + '%s\n'%brut_html + + # Replace line + if wip_html: wip_html = '%s\n%s'%(wip_html, brut_html) + else : wip_html = brut_html + + #=========================# # Done when command check # # - convert_bcodes() # @@ -589,9 +641,8 @@ def convert_bcodes(article, fm, lm, css): if bCode: bCode_ln += 1 - line = '%s%s'%( - bCode_ln, line - ) + line = '%s'%bCode_ln + \ + '%s'%line if bCode_lines: bCode_lines = '%s\n%s'%(bCode_lines, line) else : bCode_lines = line else: