diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index ee899e0..a696173 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -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 @@ -578,10 +580,10 @@ def check_files(line, ln, stats_files_uniq): # In Generic folder /files/ if file_uri.startswith('@'): 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): 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 else: file_uri = '/files/%s'%file_uri @@ -589,7 +591,7 @@ def check_files(line, ln, stats_files_uniq): # From Root articles (www/ in web) elif file_uri.startswith('/'): 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): msg_log = 'Unused file for marker "file:" in %s'%usr_file log.append_f(post_logs,msg_log,1) @@ -599,10 +601,10 @@ def check_files(line, ln, stats_files_uniq): # Current or custom URI 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): 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 if Post_Err: return @@ -806,7 +808,7 @@ def check_article_markers(article): # Markers at begining line #------------------------- # Paragraphs: ( and ) - if re.match(markers_reg[0][0], line): stats_p += 1 + if re.match(markers_reg[0][0], line): stats_p += 1 elif re.match(markers_reg[0][1], line): stats_pe += 1 # Lists: (- and -) ; count items with = and + at begining diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index a9e7f14..bfbd6e9 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -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 = '%s' + 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('