check+wip: file links
This commit is contained in:
parent
a0c24fa797
commit
a3ab6c62b0
|
@ -194,7 +194,9 @@ def check_article(post_uri, Force):
|
|||
#------------------
|
||||
# In check process: no values (kept from db, if exists)
|
||||
global hash_wip, hash_www, time_wip, time_www
|
||||
|
||||
hash_wip = time_wip = hash_www = time_www = ''
|
||||
|
||||
if db_exist:
|
||||
# backup hash_wip/www values
|
||||
hash_wip = post_wip[0];time_wip = post_wip[1]
|
||||
|
@ -569,7 +571,7 @@ def check_files(line, ln, stats_files_uniq):
|
|||
|
||||
# Check NAME in article
|
||||
file_page = '__%s'%file_name
|
||||
if not file_page in article.rsplit('\n'):
|
||||
if not file_page in article:
|
||||
msg_log = 'Unused "%s" for marker "file:" in article"'%file_page
|
||||
log.append_f(post_logs,msg_log,1)
|
||||
Post_Err = True
|
||||
|
|
|
@ -94,6 +94,7 @@ def manage_wip(file_post, Force):
|
|||
wip_begin_markers(wip_html.rsplit('\n'))
|
||||
wip_titles( wip_html.rsplit('\n'))
|
||||
wip_words_markers(wip_html)
|
||||
wip_files_links(wip_html)
|
||||
if anchors > 0: wip_anchors( wip_html)
|
||||
if abbrs_u > 0: wip_abbrs( wip_html)
|
||||
|
||||
|
@ -107,6 +108,7 @@ def manage_wip(file_post, Force):
|
|||
print('> Article HTML:')
|
||||
print(wip_html)
|
||||
|
||||
print('> Article with Tabs:')
|
||||
tab_article(wip_html.rsplit('\n'))
|
||||
|
||||
|
||||
|
@ -438,8 +440,33 @@ def quote_data(line):
|
|||
return line.split(' ', 1)[1].lstrip()
|
||||
|
||||
|
||||
#
|
||||
# Convert files_links
|
||||
#
|
||||
def wip_files_links(article):
|
||||
global wip_html
|
||||
|
||||
flink_fmt = '<a class="%s" title="%s" href="%s">%s</a>'
|
||||
all_vars = set(globals())
|
||||
|
||||
for var in all_vars:
|
||||
if var.startswith('file_'):
|
||||
flink = globals()[var]
|
||||
flink_b64 = flink_fmt%(domain.domain_css,
|
||||
flink[2],
|
||||
flink[1],
|
||||
flink[0]
|
||||
)
|
||||
convert_to_b64(flink_b64)
|
||||
article = article.replace('__%s'%flink[0], b64_content)
|
||||
|
||||
wip_html = article
|
||||
|
||||
|
||||
#=========================#
|
||||
# Done when command check #
|
||||
# - convert_bcodes() #
|
||||
# - convert_icodes() #
|
||||
#=========================#
|
||||
#====================================#
|
||||
# Protect bCodes contents to base64 #
|
||||
|
@ -480,7 +507,7 @@ def convert_bcodes(article, fm, lm, css):
|
|||
article_temp = '%s\n%s'%(article_temp, line)
|
||||
|
||||
#====================================#
|
||||
# Protect bCodes contents to base64 #
|
||||
# Protect iCodes contents to base64 #
|
||||
# fm: First marker ; lm: last marker #
|
||||
#-----------------------------------=#
|
||||
def convert_icodes(article, css):
|
||||
|
@ -594,7 +621,8 @@ def tab_article(article):
|
|||
if line.startswith('<h'):
|
||||
tn = line[2]
|
||||
tab = int(tn) * 3
|
||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
if wip_tmp: wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
else : wip_tmp = '%s%s'%(int(tab)*' ', line)
|
||||
tab = int(tab) + 3
|
||||
continue
|
||||
|
||||
|
@ -608,6 +636,7 @@ def tab_article(article):
|
|||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
continue
|
||||
|
||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
if wip_tmp: wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||
else : wip_tmp = '%s%s'%(int(tab)*' ', line)
|
||||
|
||||
print(wip_tmp)
|
||||
|
|
Loading…
Reference in New Issue