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