html, wip: fixes for bcodes, and others found
This commit is contained in:
parent
12427db5d1
commit
30d2f60daa
|
@ -91,7 +91,7 @@ def post_IDs(file_post):
|
|||
else:
|
||||
for i in range(0,slash):
|
||||
weburi = '%s../'%weburi
|
||||
|
||||
|
||||
# Get Hash from article's content
|
||||
global hash_chk
|
||||
hash_chk = get_filesum(post_uri, True)
|
||||
|
@ -1227,6 +1227,7 @@ def create_DB(post_db):
|
|||
'post_tmp = "%s"'%post_tmp,
|
||||
'post_url = "%s"'%post_url,
|
||||
'post_srv = "%s"'%post_srv,
|
||||
'web_uri = "%s"'%weburi,
|
||||
'\n# Article Status',
|
||||
'post_chk = (\'%s\', \'%s\')'%(hash_chk,time_chk),
|
||||
'post_wip = (\'%s\', \'%s\')'%(hash_wip,time_wip),
|
||||
|
|
|
@ -77,7 +77,7 @@ def html_main_page(wip_html):
|
|||
tags = '%s,%s'%(domain.domain_tags, post_tags)
|
||||
icon = '/template/favicon.png'
|
||||
logo = '/template/%s'%domain.domain_logo
|
||||
f_css = '/template/styles.css'
|
||||
f_css = '%stemplate/styles.css'%web_uri
|
||||
f_rss = '/rss.xml'
|
||||
i_rss = 'RSS 2.0. %s %s %s'%(
|
||||
domain.domain_title, domain.sep_titles, domain.domain_name
|
||||
|
@ -183,7 +183,7 @@ def html_main_page(wip_html):
|
|||
trans[9][fl], post_author
|
||||
) + \
|
||||
' <span id="sep">, %s</span>\n'%trans[10][fl] + \
|
||||
' <span id="date">%s</span>\n'%post_date + \
|
||||
' <span id="date">%s</span>\n'%sdb_date + \
|
||||
' </p>\n' + \
|
||||
' </div>\n'
|
||||
|
||||
|
@ -215,7 +215,7 @@ def html_main_page(wip_html):
|
|||
' <ul class="site-list">\n' + \
|
||||
' <li class="site-list">URL:\n' + \
|
||||
' <a id="site-url"\n' + \
|
||||
' href="/">\n' + \
|
||||
' href="/"\n' + \
|
||||
' title="%s">%s</a>\n'%(
|
||||
domain.domain_title, domain.domain_url
|
||||
) + \
|
||||
|
@ -255,10 +255,8 @@ def html_main_page(wip_html):
|
|||
# Create file if not exists
|
||||
#--------------------------
|
||||
files_tpl = [
|
||||
[ '%smetas.html'%domain.srv_wip_template, metas ],
|
||||
[ '%sheader.html'%domain.srv_wip_template, headers ],
|
||||
[ '%sfooter.html'%domain.srv_wip_template, footers ],
|
||||
[ '%saside.html'%domain.srv_wip_template, asides ]
|
||||
[ '%sfooter.html'%domain.srv_wip_template, footers ]
|
||||
]
|
||||
|
||||
for file_tpl in files_tpl:
|
||||
|
@ -278,16 +276,9 @@ def html_main_page(wip_html):
|
|||
|
||||
# Add tab metas in page
|
||||
#----------------------
|
||||
if os.path.exists(files_tpl[0][0]):
|
||||
metas_datas = open(files_tpl[0][0], 'r').read()
|
||||
for meta_line in metas_datas.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 6*' ', meta_line)
|
||||
else:
|
||||
# No file: use this default
|
||||
for meta in metas.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 6*' ', meta)
|
||||
msg_log = 'Use default metas in page. Unused file: %s'%files_tpl[0][0]
|
||||
log.append_f(check.post_logs, msg_log, 0)
|
||||
# No file: use this default
|
||||
for meta in metas.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 6*' ', meta)
|
||||
|
||||
page = '%s\n%s</head>\n'%(page, 4*' ') + \
|
||||
'\n%s<body id="%s" class="%s">'%(
|
||||
|
@ -296,15 +287,16 @@ def html_main_page(wip_html):
|
|||
|
||||
# Add tab header in page
|
||||
#-----------------------
|
||||
if os.path.exists(files_tpl[1][0]):
|
||||
headers_datas = open(files_tpl[1][0], 'r').read()
|
||||
if os.path.exists(files_tpl[0][0]):
|
||||
headers_datas = open(files_tpl[0][0], 'r').read()
|
||||
for header_line in headers_datas.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 6*' ', header_line)
|
||||
else:
|
||||
# No file: use this default
|
||||
for header in headers.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 6*' ', header)
|
||||
msg_log = 'Use default header in page. Unused file: %s'%files_tpl[1][0]
|
||||
|
||||
msg_log = 'Use default header in page. Unused file: %s'%files_tpl[0][0]
|
||||
log.append_f(check.post_logs, msg_log, 0)
|
||||
|
||||
# Add tab article in page
|
||||
|
@ -319,28 +311,21 @@ def html_main_page(wip_html):
|
|||
|
||||
# Add latest-posts in page
|
||||
#-------------------------
|
||||
if os.path.exists(files_tpl[3][0]):
|
||||
asides_datas = open(files_tpl[3][0], 'r').read()
|
||||
for aside_line in asides_datas.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 8*' ', aside_line)
|
||||
else:
|
||||
# No file: use this default
|
||||
for aside in asides.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 8*' ', aside)
|
||||
|
||||
msg_log = 'Use default sidebar in page. Unused file: %s'%files_tpl[3][0]
|
||||
log.append_f(check.post_logs, msg_log, 0)
|
||||
# No file: use this default
|
||||
for aside in asides.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 8*' ', aside)
|
||||
|
||||
page = '%s\n%s</section>'%(page, 6*' ')
|
||||
|
||||
# Add footer in page
|
||||
#-------------------
|
||||
if os.path.exists(files_tpl[2][0]):
|
||||
footers_datas = open(files_tpl[2][0], 'r').read()
|
||||
if os.path.exists(files_tpl[1][0]):
|
||||
footers_datas = open(files_tpl[1][0], 'r').read()
|
||||
for footer_line in footers_datas.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 4*' ', footer_line)
|
||||
else:
|
||||
# No file: use this default
|
||||
for footer in footers.rsplit('\n'):
|
||||
page = '%s\n%s%s'%(page, 4*' ', footer)
|
||||
msg_log = 'Use default footer in page. Unused file: %s'%files_tpl[2][0]
|
||||
msg_log = 'Use default footer in page. Unused file: %s'%files_tpl[1][0]
|
||||
log.append_f(check.post_logs, msg_log, 0)
|
||||
|
|
|
@ -178,8 +178,8 @@ def wip_begin_markers(wip_lines):
|
|||
['^>>\s' , '<a id="%s"></a>' , True ],
|
||||
[r'^\($|\(\s' , '<p class="%s">' , True ],
|
||||
['^\)$|^\)\s' , '</p>' , False],
|
||||
['^\[\[$|^\[\[\s' , '<pre class="%s">', True ],
|
||||
['^\]\]$|^\]\]\s' , '</pre>' , False]
|
||||
['^\[\[$|^\[\[\s' , '<code class="%s">',True ],
|
||||
['^\]\]$|^\]\]\s' , '</code>' , False]
|
||||
]
|
||||
|
||||
for line in wip_lines:
|
||||
|
@ -624,10 +624,9 @@ def wip_bruts(article):
|
|||
|
||||
# Convert each lines to HTML, add to string
|
||||
for ln, bline in enumerate(brut_datas.rsplit('\n'), 1):
|
||||
brut_line_html = '<span class="linecode">' + \
|
||||
'<span class="ln">%s</span>'%ln + \
|
||||
'<span class="brut">%s</span>'%bline + \
|
||||
'</span>'
|
||||
brut_line_html = ' <pre title="%s. %s">%s</pre>'%(
|
||||
ln, bline, bline
|
||||
)
|
||||
if brut_html: brut_html = '%s\n%s'%(brut_html,brut_line_html)
|
||||
else : brut_html = brut_line_html
|
||||
|
||||
|
@ -635,9 +634,9 @@ def wip_bruts(article):
|
|||
get_css(line)
|
||||
|
||||
# Add first and last HTML tags to string
|
||||
brut_html = '<pre class="%s" title="%s">\n'%(
|
||||
brut_html = '<code class="%s" title="%s">\n'%(
|
||||
css_set, brut[2]) + \
|
||||
'%s\n</pre>'%brut_html
|
||||
'%s\n</code>'%brut_html
|
||||
|
||||
# Replace line
|
||||
if wip_html: wip_html = '%s\n%s'%(wip_html, brut_html)
|
||||
|
@ -680,10 +679,9 @@ def convert_bcodes(article, fm, lm, css):
|
|||
|
||||
if bCode:
|
||||
bCode_ln += 1
|
||||
line = '<span class="linecode">' + \
|
||||
'<span class="ln">%s</span>'%bCode_ln + \
|
||||
'<span class="brut">%s</span>'%line + \
|
||||
'</span>'
|
||||
line = ' <pre title="%s. %s">%s</pre>'%(
|
||||
bCode_ln, line, line
|
||||
)
|
||||
if bCode_lines: bCode_lines = '%s\n%s'%(bCode_lines, line)
|
||||
else : bCode_lines = line
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue