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)
|
# In check process: no values (kept from db, if exists)
|
||||||
global hash_wip, hash_www, time_wip, time_www
|
global hash_wip, hash_www, time_wip, time_www
|
||||||
|
|
||||||
hash_wip = time_wip = hash_www = time_www = ''
|
hash_wip = time_wip = hash_www = time_www = ''
|
||||||
|
|
||||||
if db_exist:
|
if db_exist:
|
||||||
# backup hash_wip/www values
|
# backup hash_wip/www values
|
||||||
hash_wip = post_wip[0];time_wip = post_wip[1]
|
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
|
# Check NAME in article
|
||||||
file_page = '__%s'%file_name
|
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
|
msg_log = 'Unused "%s" for marker "file:" in article"'%file_page
|
||||||
log.append_f(post_logs,msg_log,1)
|
log.append_f(post_logs,msg_log,1)
|
||||||
Post_Err = True
|
Post_Err = True
|
||||||
|
@ -578,10 +580,10 @@ def check_files(line, ln, stats_files_uniq):
|
||||||
# In Generic folder /files/
|
# In Generic folder /files/
|
||||||
if file_uri.startswith('@'):
|
if file_uri.startswith('@'):
|
||||||
file_uri = file_uri.replace('@','')
|
file_uri = file_uri.replace('@','')
|
||||||
gen_file = '%s%s'%(domain.domain_files,file_uri)
|
gen_file = '%s%s'%(domain.domain_files, file_uri)
|
||||||
if not os.path.exists(gen_file):
|
if not os.path.exists(gen_file):
|
||||||
msg_log = 'Unused file for marker "file:" in %s'%gen_file
|
msg_log = 'Unused file for marker "file:" in %s'%gen_file
|
||||||
log.append_f(post_logs,msg_log,1)
|
log.append_f(post_logs, msg_log, 1)
|
||||||
Post_Err = True
|
Post_Err = True
|
||||||
else:
|
else:
|
||||||
file_uri = '/files/%s'%file_uri
|
file_uri = '/files/%s'%file_uri
|
||||||
|
@ -589,7 +591,7 @@ def check_files(line, ln, stats_files_uniq):
|
||||||
# From Root articles (www/ in web)
|
# From Root articles (www/ in web)
|
||||||
elif file_uri.startswith('/'):
|
elif file_uri.startswith('/'):
|
||||||
file_uri = file_uri[1:len(file_uri)] # No need first / to check
|
file_uri = file_uri[1:len(file_uri)] # No need first / to check
|
||||||
usr_file = '%s%s'%(domain.domain_articles,file_uri)
|
usr_file = '%s%s'%(domain.domain_articles, file_uri)
|
||||||
if not os.path.exists(usr_file):
|
if not os.path.exists(usr_file):
|
||||||
msg_log = 'Unused file for marker "file:" in %s'%usr_file
|
msg_log = 'Unused file for marker "file:" in %s'%usr_file
|
||||||
log.append_f(post_logs,msg_log,1)
|
log.append_f(post_logs,msg_log,1)
|
||||||
|
@ -599,10 +601,10 @@ def check_files(line, ln, stats_files_uniq):
|
||||||
|
|
||||||
# Current or custom URI
|
# Current or custom URI
|
||||||
else:
|
else:
|
||||||
usr_file = '%s%s'%(domain.domain_articles,file_uri)
|
usr_file = '%s%s'%(domain.domain_articles, file_uri)
|
||||||
if not os.path.exists(usr_file):
|
if not os.path.exists(usr_file):
|
||||||
msg_log = 'Unused file for marker "file:" in %s'%usr_file
|
msg_log = 'Unused file for marker "file:" in %s'%usr_file
|
||||||
log.append_f(post_logs,msg_log,1)
|
log.append_f(post_logs, msg_log, 1)
|
||||||
Post_Err = True
|
Post_Err = True
|
||||||
|
|
||||||
if Post_Err: return
|
if Post_Err: return
|
||||||
|
|
|
@ -94,6 +94,7 @@ def manage_wip(file_post, Force):
|
||||||
wip_begin_markers(wip_html.rsplit('\n'))
|
wip_begin_markers(wip_html.rsplit('\n'))
|
||||||
wip_titles( wip_html.rsplit('\n'))
|
wip_titles( wip_html.rsplit('\n'))
|
||||||
wip_words_markers(wip_html)
|
wip_words_markers(wip_html)
|
||||||
|
wip_files_links(wip_html)
|
||||||
if anchors > 0: wip_anchors( wip_html)
|
if anchors > 0: wip_anchors( wip_html)
|
||||||
if abbrs_u > 0: wip_abbrs( wip_html)
|
if abbrs_u > 0: wip_abbrs( wip_html)
|
||||||
|
|
||||||
|
@ -107,6 +108,7 @@ def manage_wip(file_post, Force):
|
||||||
print('> Article HTML:')
|
print('> Article HTML:')
|
||||||
print(wip_html)
|
print(wip_html)
|
||||||
|
|
||||||
|
print('> Article with Tabs:')
|
||||||
tab_article(wip_html.rsplit('\n'))
|
tab_article(wip_html.rsplit('\n'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,8 +440,33 @@ def quote_data(line):
|
||||||
return line.split(' ', 1)[1].lstrip()
|
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 #
|
# Done when command check #
|
||||||
|
# - convert_bcodes() #
|
||||||
|
# - convert_icodes() #
|
||||||
#=========================#
|
#=========================#
|
||||||
#====================================#
|
#====================================#
|
||||||
# Protect bCodes contents to base64 #
|
# Protect bCodes contents to base64 #
|
||||||
|
@ -480,7 +507,7 @@ def convert_bcodes(article, fm, lm, css):
|
||||||
article_temp = '%s\n%s'%(article_temp, line)
|
article_temp = '%s\n%s'%(article_temp, line)
|
||||||
|
|
||||||
#====================================#
|
#====================================#
|
||||||
# Protect bCodes contents to base64 #
|
# Protect iCodes contents to base64 #
|
||||||
# fm: First marker ; lm: last marker #
|
# fm: First marker ; lm: last marker #
|
||||||
#-----------------------------------=#
|
#-----------------------------------=#
|
||||||
def convert_icodes(article, css):
|
def convert_icodes(article, css):
|
||||||
|
@ -594,7 +621,8 @@ def tab_article(article):
|
||||||
if line.startswith('<h'):
|
if line.startswith('<h'):
|
||||||
tn = line[2]
|
tn = line[2]
|
||||||
tab = int(tn) * 3
|
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
|
tab = int(tab) + 3
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -608,6 +636,7 @@ def tab_article(article):
|
||||||
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
wip_tmp = '%s\n%s%s'%(wip_tmp, int(tab)*' ', line)
|
||||||
continue
|
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)
|
print(wip_tmp)
|
||||||
|
|
Loading…
Reference in New Issue