updated for stats ; added images, links, files.
This commit is contained in:
parent
de2533480e
commit
af963b07bd
|
@ -99,7 +99,6 @@ def check_all(option):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
found = True
|
found = True
|
||||||
print(' ├ [%s] > %s'%(db.title, db.post_src))
|
|
||||||
check_process(args.target)
|
check_process(args.target)
|
||||||
|
|
||||||
if post_err: logs.out("44", args.target, False)
|
if post_err: logs.out("44", args.target, False)
|
||||||
|
@ -183,6 +182,8 @@ def check_process(target):
|
||||||
#print("In Dev: return from process...")
|
#print("In Dev: return from process...")
|
||||||
if post_err: return
|
if post_err: return
|
||||||
|
|
||||||
|
print(' │\n ├─ [%s] > %s'%(title, db.uri_file))
|
||||||
|
|
||||||
# Check for valid contents
|
# Check for valid contents
|
||||||
check_content(post_bottom)
|
check_content(post_bottom)
|
||||||
|
|
||||||
|
@ -264,10 +265,12 @@ def count_words(post_bottom):
|
||||||
#---------------------------------------------#
|
#---------------------------------------------#
|
||||||
def if_icodes_bcodes_quotes(post_bottom):
|
def if_icodes_bcodes_quotes(post_bottom):
|
||||||
global icode, quote, bcode, post_err
|
global icode, quote, bcode, post_err
|
||||||
global nbr_titles, nbr_quotes, nbr_bcodes, nbr_ancs, nbr_coms
|
global post_titles, nbr_quotes, nbr_bcodes, nbr_ancs, post_comments
|
||||||
|
global post_images, post_raws, fcodes
|
||||||
|
|
||||||
icode = quote = in_quote = bcode = in_bcode = in_bq = False
|
icode = quote = in_quote = bcode = in_bcode = in_bq = False
|
||||||
nbr_titles = nbr_quotes = nbr_bcodes = nbr_ancs = nbr_coms = 0
|
post_titles = nbr_quotes = nbr_bcodes = nbr_ancs = 0
|
||||||
|
post_images = post_comments = post_raws = fcodes = 0
|
||||||
|
|
||||||
for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
|
for ln, line in enumerate(post_bottom.rsplit('\n'), 1):
|
||||||
# Stat Comments, Titles, Anchors
|
# Stat Comments, Titles, Anchors
|
||||||
|
@ -295,15 +298,21 @@ def if_icodes_bcodes_quotes(post_bottom):
|
||||||
if in_bq:
|
if in_bq:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
elif line.startswith(tyto.titles_tags) and not in_bq:
|
elif line.startswith(tyto.titles_tags):
|
||||||
nbr_titles += 1
|
post_titles += 1
|
||||||
continue
|
continue
|
||||||
elif line.startswith('#') and not in_bq:
|
elif line.startswith('#'):
|
||||||
nbr_coms += 1
|
post_comments += 1
|
||||||
continue
|
continue
|
||||||
elif line.startswith(tyto.single_tags[1][0]) and not in_bq:
|
elif line.startswith(tyto.single_tags[1][0]):
|
||||||
nbr_ancs += 1
|
nbr_ancs += 1
|
||||||
continue
|
continue
|
||||||
|
elif line.startswith('_image:'):
|
||||||
|
post_images += 1
|
||||||
|
elif line.startswith('_raw:'):
|
||||||
|
post_raws += 1
|
||||||
|
elif line.startswith('_code:'):
|
||||||
|
fcodes += 1
|
||||||
|
|
||||||
# icodes
|
# icodes
|
||||||
elif tyto.words_tags[9][0] or tyto.words_tags[9][1] in line:
|
elif tyto.words_tags[9][0] or tyto.words_tags[9][1] in line:
|
||||||
|
@ -398,13 +407,13 @@ def check_date(date):
|
||||||
#-------------------------------------------#
|
#-------------------------------------------#
|
||||||
def check_opt_tags(post_header):
|
def check_opt_tags(post_header):
|
||||||
global stat_links, stat_images, stat_files, stat_raws, stat_codes
|
global stat_links, stat_images, stat_files, stat_raws, stat_codes
|
||||||
global stat_snpics, snpic_url, stat_abbrs, post_abbrs
|
global post_links, stat_snpics, snpic_url, stat_abbrs, post_abbrs
|
||||||
global opt_tags_post_name
|
global post_files, opt_tags_post_name
|
||||||
global files_post
|
global files_post
|
||||||
|
|
||||||
# Statistics
|
# Statistics
|
||||||
stat_links = stat_images = stat_files = stat_raws = stat_codes = 0
|
stat_links = stat_images = stat_files = stat_raws = stat_codes = 0
|
||||||
stat_snpics = post_abbrs = stat_abbrs = 0
|
post_links = post_files = stat_snpics = post_abbrs = stat_abbrs = 0
|
||||||
files_post = (())
|
files_post = (())
|
||||||
|
|
||||||
# Set default post pic
|
# Set default post pic
|
||||||
|
@ -413,12 +422,12 @@ def check_opt_tags(post_header):
|
||||||
# Search for term in article
|
# Search for term in article
|
||||||
opt_tags_post_name = \
|
opt_tags_post_name = \
|
||||||
{
|
{
|
||||||
'link' : "_%s",
|
"link" : "_%s",
|
||||||
'image' : "_image:%s",
|
"image" : "_image:%s",
|
||||||
'file' : "__%s",
|
"file" : "__%s",
|
||||||
'raw' : "_raw:%s",
|
"raw" : "_raw:%s",
|
||||||
'code' : '_code:%s',
|
"code" : '_code:%s',
|
||||||
'abbr' : "(%s)"
|
"abbr" : "(%s)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check post header for each optional tags
|
# Check post header for each optional tags
|
||||||
|
@ -427,6 +436,9 @@ def check_opt_tags(post_header):
|
||||||
if line.startswith('%s:'%tag):
|
if line.startswith('%s:'%tag):
|
||||||
check_3lines(tag, ln, line)
|
check_3lines(tag, ln, line)
|
||||||
|
|
||||||
|
print("> post_files =", post_files)
|
||||||
|
print("> post_links =", post_links)
|
||||||
|
|
||||||
|
|
||||||
#============================================#
|
#============================================#
|
||||||
# Do stats, check 3 lines tags from ln #
|
# Do stats, check 3 lines tags from ln #
|
||||||
|
@ -434,8 +446,8 @@ def check_opt_tags(post_header):
|
||||||
# Exception for snpic (Different conditions) #
|
# Exception for snpic (Different conditions) #
|
||||||
#--------------------------------------------#
|
#--------------------------------------------#
|
||||||
def check_3lines(tag, ln, line):
|
def check_3lines(tag, ln, line):
|
||||||
global post_err, db_tag, files_post
|
global post_err, db_tag, files_post, post_bottom
|
||||||
global post_abbrs
|
global post_abbrs, post_links, post_files
|
||||||
|
|
||||||
stat_tag = "stat_%ss"%tag
|
stat_tag = "stat_%ss"%tag
|
||||||
|
|
||||||
|
@ -478,6 +490,12 @@ def check_3lines(tag, ln, line):
|
||||||
|
|
||||||
globals()[db_tag] = ((opt_tags_post_name[tag]%name),)
|
globals()[db_tag] = ((opt_tags_post_name[tag]%name),)
|
||||||
|
|
||||||
|
if tag == "file":
|
||||||
|
post_files = post_files + post_bottom.count('__%s'%name)
|
||||||
|
post_bottom = post_bottom.replace('__%s'%name, '[file-link]')
|
||||||
|
elif tag == "link":
|
||||||
|
post_links = post_links + post_bottom.count('_%s'%name)
|
||||||
|
|
||||||
# URI/URL and Alt-Text
|
# URI/URL and Alt-Text
|
||||||
#---------------------
|
#---------------------
|
||||||
# loop 1,2. Next real line from start tag
|
# loop 1,2. Next real line from start tag
|
||||||
|
@ -684,12 +702,11 @@ def check_content(post_bottom):
|
||||||
|
|
||||||
if inlist and not line or not line[0] in tyto.markers_lists:
|
if inlist and not line or not line[0] in tyto.markers_lists:
|
||||||
logs.out("3", 'L=%s. %s %s > %s'%(
|
logs.out("3", 'L=%s. %s %s > %s'%(
|
||||||
ln + ln_header,
|
ln + ln_header,
|
||||||
tyto.words_tags[13][4],
|
tyto.words_tags[13][4],
|
||||||
tyto.markers_lists,
|
tyto.markers_lists,
|
||||||
db.uri_file
|
db.uri_file
|
||||||
), False
|
), False)
|
||||||
)
|
|
||||||
post_err = True
|
post_err = True
|
||||||
|
|
||||||
|
|
||||||
|
@ -769,7 +786,7 @@ def create_database():
|
||||||
'title = "%s"\n'%title + \
|
'title = "%s"\n'%title + \
|
||||||
'about = "%s"\n'%about + \
|
'about = "%s"\n'%about + \
|
||||||
'author = "%s"\n'%author + \
|
'author = "%s"\n'%author + \
|
||||||
'tags = "%s"\n'%tags + \
|
'meta_tags = "%s"\n'%tags + \
|
||||||
'date = "%s"\n'%date_tr + \
|
'date = "%s"\n'%date_tr + \
|
||||||
'snpic = "%s"\n'%snpic_url + \
|
'snpic = "%s"\n'%snpic_url + \
|
||||||
'\n# Used files\n' + \
|
'\n# Used files\n' + \
|
||||||
|
@ -824,38 +841,44 @@ def create_database():
|
||||||
|
|
||||||
# Statistics configurations
|
# Statistics configurations
|
||||||
#--------------------------
|
#--------------------------
|
||||||
stat_words = post_words - nbr_titles # Count real words
|
stat_words = post_words - post_titles # Count real words
|
||||||
|
|
||||||
db_stats = \
|
db_stats = \
|
||||||
'# Statistics configurations\n' + \
|
'# Statistics from header\'s tags\n' + \
|
||||||
'uniq_anchors = %d\n'%nbr_ancs + \
|
'uniq_anchors = %d\n'%nbr_ancs + \
|
||||||
'uniq_abbrs = %d\n'%stat_abbrs + \
|
'uniq_abbrs = %d\n'%stat_abbrs + \
|
||||||
'uniq_links = %d\n'%stat_links + \
|
'uniq_links = %d\n'%stat_links + \
|
||||||
'uniq_images = %d\n'%stat_images + \
|
'uniq_images = %d\n'%stat_images + \
|
||||||
'uniq_files = %d\n'%stat_files + \
|
'uniq_files = %d\n'%stat_files + \
|
||||||
'uniq_codes = %d\n'%stat_codes + \
|
'uniq_codes = %d\n'%stat_codes + \
|
||||||
'uniq_raws = %d\n'%stat_raws + \
|
'uniq_raws = %d\n'%stat_raws + \
|
||||||
'\n# Statistics from post content\n' + \
|
'\n# Statistics from post contents\n' + \
|
||||||
'post_coms = %d\n'%nbr_coms + \
|
'comments = %d\n'%post_comments + \
|
||||||
'post_tags = %d\n'%stat_tags + \
|
'tags = %d\n'%stat_tags + \
|
||||||
'post_lines = %d\n'%ln_article + \
|
'lines = %d\n'%ln_article + \
|
||||||
'post_words = %d\n'%stat_words + \
|
'words = %d\n'%stat_words + \
|
||||||
'post_titles = %d\n'%nbr_titles + \
|
'titles = %d\n'%post_titles + \
|
||||||
'post_paragraphs = %d\n'%post_paragraphs + \
|
'paragraphs = %d\n'%post_paragraphs + \
|
||||||
'post_anchors = %d\n'%post_anchors + \
|
'links = %d\n'%post_links + \
|
||||||
'post_abbrs = %d\n'%post_abbrs + \
|
'images = %d\n'%post_images + \
|
||||||
'post_strongs = %d\n'%post_strongs + \
|
'anchors = %d\n'%post_anchors + \
|
||||||
'post_bolds = %d\n'%post_bolds + \
|
'abbrs = %d\n'%post_abbrs + \
|
||||||
'post_emphasis = %d\n'%post_emphasis + \
|
'strongs = %d\n'%post_strongs + \
|
||||||
'post_italics = %d\n'%post_italics + \
|
'bolds = %d\n'%post_bolds + \
|
||||||
'post_dels = %d\n'%post_dels + \
|
'emphasis = %d\n'%post_emphasis + \
|
||||||
'post_underlines = %d\n'%post_underlines + \
|
'italics = %d\n'%post_italics + \
|
||||||
'post_cites = %d\n'%post_cites + \
|
'dels = %d\n'%post_dels + \
|
||||||
'post_customs = %d\n'%post_customs + \
|
'underlines = %d\n'%post_underlines + \
|
||||||
'post_icodes = %d\n'%tyto.nbr_icodes + \
|
'cites = %d\n'%post_cites + \
|
||||||
'post_bcodes = %d\n'%nbr_bcodes + \
|
'customs = %d\n'%post_customs + \
|
||||||
'post_quotes = %d\n'%nbr_quotes + \
|
'icodes = %d\n'%tyto.nbr_icodes + \
|
||||||
'post_lists = %d\n'%post_lists
|
'bcodes = %d\n'%nbr_bcodes + \
|
||||||
|
'quotes = %d\n'%nbr_quotes + \
|
||||||
|
'lists = %d\n'%post_lists + \
|
||||||
|
'\n# Included files in post\'s contents\n' + \
|
||||||
|
'files = %d\n'%post_files + \
|
||||||
|
'raws = %d\n'%post_raws + \
|
||||||
|
'codes = %d\n'%fcodes
|
||||||
|
|
||||||
# Create Post DB
|
# Create Post DB
|
||||||
#---------------
|
#---------------
|
||||||
|
|
|
@ -93,7 +93,7 @@ if args.target \
|
||||||
'title',
|
'title',
|
||||||
'about',
|
'about',
|
||||||
'author',
|
'author',
|
||||||
'tags',
|
'meta_tags',
|
||||||
'date',
|
'date',
|
||||||
'snpic',
|
'snpic',
|
||||||
'uris',
|
'uris',
|
||||||
|
@ -103,25 +103,30 @@ if args.target \
|
||||||
'uniq_images',
|
'uniq_images',
|
||||||
'uniq_files',
|
'uniq_files',
|
||||||
'uniq_raws',
|
'uniq_raws',
|
||||||
'post_coms',
|
'comments',
|
||||||
'post_tags',
|
'tags',
|
||||||
'post_words',
|
'words',
|
||||||
'post_titles',
|
'titles',
|
||||||
'post_paragraphs',
|
'paragraphs',
|
||||||
'post_anchors',
|
'links',
|
||||||
'post_abbrs',
|
'images',
|
||||||
'post_strongs',
|
'anchors',
|
||||||
'post_bolds',
|
'abbrs',
|
||||||
'post_emphasis',
|
'strongs',
|
||||||
'post_italics',
|
'bolds',
|
||||||
'post_dels',
|
'emphasis',
|
||||||
'post_underlines',
|
'italics',
|
||||||
'post_cites',
|
'dels',
|
||||||
'post_customs',
|
'underlines',
|
||||||
'post_icodes',
|
'cites',
|
||||||
'post_bcodes',
|
'customs',
|
||||||
'post_quotes',
|
'icodes',
|
||||||
'post_lists'
|
'bcodes',
|
||||||
|
'quotes',
|
||||||
|
'lists',
|
||||||
|
'files',
|
||||||
|
'raws',
|
||||||
|
'codes',
|
||||||
)
|
)
|
||||||
|
|
||||||
for value in values:
|
for value in values:
|
||||||
|
|
|
@ -250,8 +250,8 @@ def create_domain(target):
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
root_srv_dom = '%s/%s'%(srv, shortname)
|
root_srv_dom = '%s/%s'%(srv, shortname)
|
||||||
srv_wip_tpl = "%s/wip/template/"%root_srv_dom
|
srv_wip_tpl = "%s/wip/template/"%root_srv_dom
|
||||||
stats_wip_f = "%s/wip/tyto_wip_statoolinfos.conf"%root_srv_dom
|
stats_wip_f = "%s/wip/tyto_wip_statoolinfos.properties"%root_srv_dom
|
||||||
stats_www_f = "%s/www/tyto_www_statoolinfos.conf"%root_srv_dom
|
stats_www_f = "%s/www/tyto_www_statoolinfos.properties"%root_srv_dom
|
||||||
|
|
||||||
srv_www_tpl = "%s/www/template/"%root_srv_dom
|
srv_www_tpl = "%s/www/template/"%root_srv_dom
|
||||||
set_f = \
|
set_f = \
|
||||||
|
|
|
@ -60,7 +60,7 @@ def create_metas_page():
|
||||||
#-------------------
|
#-------------------
|
||||||
metas_page = ''
|
metas_page = ''
|
||||||
scale = 'width=device-width, initial-scale=1.0'
|
scale = 'width=device-width, initial-scale=1.0'
|
||||||
all_tags = dom.tags + ',' + db.tags
|
all_tags = dom.tags + ',' + db.meta_tags
|
||||||
css_ref = 'href="%stemplate/%s"'%(db.sub_uri, dom.css)
|
css_ref = 'href="%stemplate/%s"'%(db.sub_uri, dom.css)
|
||||||
rss_ref = 'type="application/rss+xml" ' + \
|
rss_ref = 'type="application/rss+xml" ' + \
|
||||||
'href="%s%s" title="RSS 2.0. %s %s %s"'%(
|
'href="%s%s" title="RSS 2.0. %s %s %s"'%(
|
||||||
|
|
|
@ -63,13 +63,13 @@ def loop_articles(process):
|
||||||
global sti_articles
|
global sti_articles
|
||||||
|
|
||||||
# Get databases of articles
|
# Get databases of articles
|
||||||
for post_db in os.listdir(dom.articles_db_d):
|
for db in os.listdir(dom.articles_db_d):
|
||||||
if not post_db.endswith('.config'):
|
if not db.endswith('.config'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Load DB
|
# Load DB
|
||||||
post_db = '%s%s'%(dom.articles_db_d, post_db)
|
db = '%s%s'%(dom.articles_db_d, db)
|
||||||
exec(open(post_db).read(),globals())
|
exec(open(db).read(),globals())
|
||||||
|
|
||||||
# Check hash status (wip/www)
|
# Check hash status (wip/www)
|
||||||
hash_srv = ''
|
hash_srv = ''
|
||||||
|
@ -101,33 +101,38 @@ def count_stats(add):
|
||||||
global stats
|
global stats
|
||||||
|
|
||||||
stats = { \
|
stats = { \
|
||||||
"sti_uniq_anchors" : uniq_anchors,
|
"sti_uniq_anchors" : uniq_anchors,
|
||||||
"sti_uniq_abbrs" : uniq_abbrs,
|
"sti_uniq_abbrs" : uniq_abbrs,
|
||||||
"sti_uniq_links" : uniq_links,
|
"sti_uniq_links" : uniq_links,
|
||||||
"sti_uniq_images" : uniq_images,
|
"sti_uniq_images" : uniq_images,
|
||||||
"sti_uniq_files" : uniq_files,
|
"sti_uniq_files" : uniq_files,
|
||||||
"sti_uniq_codes" : uniq_codes,
|
"sti_uniq_codes" : uniq_codes,
|
||||||
"sti_uniq_raws" : uniq_raws,
|
"sti_uniq_raws" : uniq_raws,
|
||||||
"sti_post_coms" : post_coms,
|
"sti_comments" : comments,
|
||||||
"sti_post_tags" : post_tags,
|
"sti_tags" : tags,
|
||||||
"sti_post_lines" : post_lines,
|
"sti_lines" : lines,
|
||||||
"sti_post_words" : post_words,
|
"sti_words" : words,
|
||||||
"sti_post_titles" : post_titles,
|
"sti_titles" : titles,
|
||||||
"sti_post_paragraphs" : post_paragraphs,
|
"sti_paragraphs" : paragraphs,
|
||||||
"sti_post_anchors" : post_anchors,
|
"sti_links" : links,
|
||||||
"sti_post_abbrs" : post_abbrs,
|
"sti_images" : images,
|
||||||
"sti_post_strongs" : post_strongs,
|
"sti_anchors" : anchors,
|
||||||
"sti_post_bolds" : post_bolds,
|
"sti_abbrs" : abbrs,
|
||||||
"sti_post_emphasis" : post_emphasis,
|
"sti_strongs" : strongs,
|
||||||
"sti_post_italics" : post_italics,
|
"sti_bolds" : bolds,
|
||||||
"sti_post_dels" : post_dels,
|
"sti_emphasis" : emphasis,
|
||||||
"sti_post_underlines" : post_underlines,
|
"sti_italics" : italics,
|
||||||
"sti_post_cites" : post_cites,
|
"sti_dels" : dels,
|
||||||
"sti_post_customs" : post_customs,
|
"sti_underlines" : underlines,
|
||||||
"sti_post_icodes" : post_icodes,
|
"sti_cites" : cites,
|
||||||
"sti_post_bcodes" : post_bcodes,
|
"sti_customs" : customs,
|
||||||
"sti_post_quotes" : post_quotes,
|
"sti_icodes" : icodes,
|
||||||
"sti_post_lists" : post_lists,
|
"sti_bcodes" : bcodes,
|
||||||
|
"sti_quotes" : quotes,
|
||||||
|
"sti_lists" : lists,
|
||||||
|
"sti_files" : files,
|
||||||
|
"sti_raws" : raws,
|
||||||
|
"sti_codes" : codes,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Count
|
# Count
|
||||||
|
@ -148,45 +153,53 @@ def create_stats_file(file_uri):
|
||||||
'# Generated: %s\n'%tyto.nowdate() + \
|
'# Generated: %s\n'%tyto.nowdate() + \
|
||||||
'\n' + \
|
'\n' + \
|
||||||
'# Uniq statistics from articles\' headers\n' + \
|
'# Uniq statistics from articles\' headers\n' + \
|
||||||
'stats_articles = %d\n'%int(sti_articles) + \
|
'articles = %d\n'%int(sti_articles) + \
|
||||||
'stats_uniq_anchors = %d\n'%stats["sti_uniq_anchors"] + \
|
'uniq_anchors = %d\n'%stats["sti_uniq_anchors"] + \
|
||||||
'stats_uniq_abbrs = %d\n'%stats["sti_uniq_abbrs"] + \
|
'uniq_abbrs = %d\n'%stats["sti_uniq_abbrs"] + \
|
||||||
'stats_uniq_links = %d\n'%stats["sti_uniq_links"] + \
|
'uniq_links = %d\n'%stats["sti_uniq_links"] + \
|
||||||
'stats_uniq_images = %d\n'%stats["sti_uniq_images"] + \
|
'uniq_images = %d\n'%stats["sti_uniq_images"] + \
|
||||||
'stats_uniq_files = %d\n'%stats["sti_uniq_files"] + \
|
'uniq_files = %d\n'%stats["sti_uniq_files"] + \
|
||||||
'stats_uniq_codes = %d\n'%stats["sti_uniq_codes"] + \
|
'uniq_codes = %d\n'%stats["sti_uniq_codes"] + \
|
||||||
'stats_uniq_raws = %d\n'%stats["sti_uniq_raws"] + \
|
'uniq_raws = %d\n'%stats["sti_uniq_raws"] + \
|
||||||
'\n' + \
|
'\n' + \
|
||||||
'# Statistics from articles\' contents\n' + \
|
'# Statistics from articles\' contents\n' + \
|
||||||
'stats_posts_coms = %d\n'%stats["sti_post_coms"] + \
|
'comments = %d\n'%stats["sti_comments"] + \
|
||||||
'stats_posts_tags = %d\n'%stats["sti_post_tags"] + \
|
'tags = %d\n'%stats["sti_tags"] + \
|
||||||
'stats_posts_lines = %d\n'%stats["sti_post_lines"] + \
|
'lines = %d\n'%stats["sti_lines"] + \
|
||||||
'stats_posts_words = %d\n'%stats["sti_post_words"] + \
|
'words = %d\n'%stats["sti_words"] + \
|
||||||
'stats_posts_titles = %d\n'%stats["sti_post_titles"] + \
|
'titles = %d\n'%stats["sti_titles"] + \
|
||||||
'stats_posts_paragraphs = %d\n'%stats["sti_post_paragraphs"] + \
|
'paragraphs = %d\n'%stats["sti_paragraphs"] + \
|
||||||
'stats_posts_anchors = %d\n'%stats["sti_post_anchors"] + \
|
'links = %d\n'%stats["sti_links"] + \
|
||||||
'stats_posts_abbrs = %d\n'%stats["sti_post_abbrs"] + \
|
'images = %d\n'%stats["sti_images"] + \
|
||||||
'stats_posts_strongs = %d\n'%stats["sti_post_strongs"] + \
|
'anchors = %d\n'%stats["sti_anchors"] + \
|
||||||
'stats_posts_bolds = %d\n'%stats["sti_post_bolds"] + \
|
'abbrs = %d\n'%stats["sti_abbrs"] + \
|
||||||
'stats_posts_emphasis = %d\n'%stats["sti_post_emphasis"] + \
|
'strongs = %d\n'%stats["sti_strongs"] + \
|
||||||
'stats_posts_italics = %d\n'%stats["sti_post_italics"] + \
|
'bolds = %d\n'%stats["sti_bolds"] + \
|
||||||
'stats_posts_dels = %d\n'%stats["sti_post_dels"] + \
|
'emphasis = %d\n'%stats["sti_emphasis"] + \
|
||||||
'stats_posts_underlines = %d\n'%stats["sti_post_underlines"] + \
|
'italics = %d\n'%stats["sti_italics"] + \
|
||||||
'stats_posts_cites = %d\n'%stats["sti_post_cites"] + \
|
'dels = %d\n'%stats["sti_dels"] + \
|
||||||
'stats_posts_customs = %d\n'%stats["sti_post_customs"] + \
|
'underlines = %d\n'%stats["sti_underlines"] + \
|
||||||
'stats_posts_icodes = %d\n'%stats["sti_post_icodes"] + \
|
'cites = %d\n'%stats["sti_cites"] + \
|
||||||
'stats_posts_bcodes = %d\n'%stats["sti_post_bcodes"] + \
|
'customs = %d\n'%stats["sti_customs"] + \
|
||||||
'stats_posts_quotes = %d\n'%stats["sti_post_quotes"] + \
|
'icodes = %d\n'%stats["sti_icodes"] + \
|
||||||
'stats_posts_lists = %d\n'%stats["sti_post_lists"]
|
'bcodes = %d\n'%stats["sti_bcodes"] + \
|
||||||
|
'quotes = %d\n'%stats["sti_quotes"] + \
|
||||||
|
'lists = %d\n'%stats["sti_lists"] + \
|
||||||
|
'\n' + \
|
||||||
|
'# Included files in article\'s contents\n' + \
|
||||||
|
'files = %d\n'%stats["sti_files"] + \
|
||||||
|
'codes = %d\n'%stats["sti_codes"] + \
|
||||||
|
'raws = %d\n'%stats["sti_raws"]
|
||||||
|
|
||||||
|
|
||||||
tyto.set_file(file_uri, 'New', sti)
|
tyto.set_file(file_uri, 'New', sti)
|
||||||
try:
|
try:
|
||||||
print(' └', langs.site.stats_f%(
|
print(' └', langs.site.stats_f%(
|
||||||
sti_articles, stats["sti_post_words"]
|
sti_articles, stats["sti_words"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
print(' └ Articles = %s ; Words = %s'%(
|
print(' └ Articles = %s ; Words = %s'%(
|
||||||
sti_articles, stats["sti_post_words"]
|
sti_articles, stats["sti_words"]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
import os, sys, re, subprocess, locale, base64, datetime, shutil
|
import os, sys, re, subprocess, locale, base64, datetime, shutil
|
||||||
from hashlib import blake2b
|
from hashlib import blake2b
|
||||||
import args, dom, logs, langs, form
|
import args, dom, logs
|
||||||
|
|
||||||
# :D
|
# :D
|
||||||
Tyto = 'Tyto - Littérateur'
|
Tyto = 'Tyto - Littérateur'
|
||||||
|
@ -56,9 +56,9 @@ needed_header_tags = \
|
||||||
# Optional header tags
|
# Optional header tags
|
||||||
opt_header_tags = \
|
opt_header_tags = \
|
||||||
(
|
(
|
||||||
'link',
|
|
||||||
'image',
|
|
||||||
'file',
|
'file',
|
||||||
|
'image',
|
||||||
|
'link',
|
||||||
'abbr',
|
'abbr',
|
||||||
'raw',
|
'raw',
|
||||||
'code',
|
'code',
|
||||||
|
@ -545,19 +545,3 @@ def files_to_srv(server):
|
||||||
logs.out("32", f_dst, False)
|
logs.out("32", f_dst, False)
|
||||||
except:
|
except:
|
||||||
logs.out('4', f_dst, True)
|
logs.out('4', f_dst, True)
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
def process_all(process):
|
|
||||||
# if target == 'all':
|
|
||||||
if args.target == "again":
|
|
||||||
form.asking(" ├ %s%s "%(
|
|
||||||
langs.site.wip_again, langs.site.q
|
|
||||||
), True)
|
|
||||||
|
|
||||||
elif args.target == "all":
|
|
||||||
print(' ├ %s again current matches articles'%process)
|
|
||||||
elif args.target == "newer":
|
|
||||||
print(' ├ %s newer articles'%process)
|
|
||||||
|
|
|
@ -97,7 +97,16 @@ def manage(target):
|
||||||
#----------------------------------------#
|
#----------------------------------------#
|
||||||
def wip_all(process):
|
def wip_all(process):
|
||||||
# Ask or show what to do
|
# Ask or show what to do
|
||||||
tyto.process_all('Wip')
|
if args.target == "again":
|
||||||
|
form.asking(" ├ %s%s "%(
|
||||||
|
langs.site.wip_again, langs.site.q
|
||||||
|
), True)
|
||||||
|
|
||||||
|
elif args.target == "all":
|
||||||
|
print(' │ %s'%langs.site.wip_older)
|
||||||
|
|
||||||
|
elif args.target == "newer":
|
||||||
|
print(' │ %s'%langs.site.wip_newer)
|
||||||
|
|
||||||
# Sort by newer articles (created by last check)
|
# Sort by newer articles (created by last check)
|
||||||
db_articles = sorted(Path(dom.articles_db_d).iterdir(),
|
db_articles = sorted(Path(dom.articles_db_d).iterdir(),
|
||||||
|
@ -121,7 +130,7 @@ def wip_all(process):
|
||||||
|
|
||||||
# Article has changed and not check
|
# Article has changed and not check
|
||||||
if db.old_chk:
|
if db.old_chk:
|
||||||
logs.out("9", post_db, False)
|
logs.out("9", db.post_src, False)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# newer: article not yet wip
|
# newer: article not yet wip
|
||||||
|
@ -137,7 +146,6 @@ def wip_all(process):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
found = True
|
found = True
|
||||||
print(' ├ [%s] > %s'%(db.title, db.post_src))
|
|
||||||
wip_article(db.post_src)
|
wip_article(db.post_src)
|
||||||
|
|
||||||
if not found: logs.out("28", '(wip)', True)
|
if not found: logs.out("28", '(wip)', True)
|
||||||
|
@ -151,16 +159,18 @@ def wip_article(target):
|
||||||
# Convert file to strings
|
# Convert file to strings
|
||||||
file_to_string(target)
|
file_to_string(target)
|
||||||
|
|
||||||
|
print(' │\n ├─ [%s] > %s'%(db.title, db.post_src))
|
||||||
|
|
||||||
global post_header
|
global post_header
|
||||||
global post_bottom
|
global post_bottom
|
||||||
|
|
||||||
# Protect block-codes and quotes
|
# Protect block-codes and quotes
|
||||||
if db.post_bcodes or db.post_quotes > 0:
|
if db.bcodes or db.quotes > 0:
|
||||||
tyto.protect_bcodes_quotes('wip', post_bottom)
|
tyto.protect_bcodes_quotes('wip', post_bottom)
|
||||||
post_bottom = tyto.protect_article
|
post_bottom = tyto.protect_article
|
||||||
|
|
||||||
# Protect inline-codes
|
# Protect inline-codes
|
||||||
if db.post_icodes > 0:
|
if db.icodes > 0:
|
||||||
tyto.protect_icodes(post_bottom)
|
tyto.protect_icodes(post_bottom)
|
||||||
post_bottom = tyto.protect_article
|
post_bottom = tyto.protect_article
|
||||||
|
|
||||||
|
@ -281,7 +291,7 @@ def wip_words_tags():
|
||||||
for ln, line in enumerate(post_bottom.rsplit('\n')):
|
for ln, line in enumerate(post_bottom.rsplit('\n')):
|
||||||
# Paragraphs
|
# Paragraphs
|
||||||
# Open tag
|
# Open tag
|
||||||
if db.post_paragraphs > 0:
|
if db.paragraphs > 0:
|
||||||
if line.startswith(tyto.words_tags[10][0]):
|
if line.startswith(tyto.words_tags[10][0]):
|
||||||
set_css = tyto.get_css(line)
|
set_css = tyto.get_css(line)
|
||||||
replace_in_post(post_bottom.rsplit('\n')[ln],
|
replace_in_post(post_bottom.rsplit('\n')[ln],
|
||||||
|
@ -293,7 +303,7 @@ def wip_words_tags():
|
||||||
tyto.words_tags[10][3]
|
tyto.words_tags[10][3]
|
||||||
)
|
)
|
||||||
# Open anchors link
|
# Open anchors link
|
||||||
if db.post_anchors == 0: continue
|
if db.anchors == 0: continue
|
||||||
|
|
||||||
anchor_links = re.findall(r'>_(.+?):', line)
|
anchor_links = re.findall(r'>_(.+?):', line)
|
||||||
for item in anchor_links:
|
for item in anchor_links:
|
||||||
|
@ -462,7 +472,7 @@ def quote_params(qline):
|
||||||
# Convert quote in article #
|
# Convert quote in article #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
def wip_quotes() :
|
def wip_quotes() :
|
||||||
if db.post_quotes == 0: return
|
if db.quotes == 0: return
|
||||||
|
|
||||||
global author, link, lang, book, date
|
global author, link, lang, book, date
|
||||||
|
|
||||||
|
@ -609,7 +619,7 @@ def wip_quotes() :
|
||||||
# Content is HTML ready #
|
# Content is HTML ready #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
def wip_icodes():
|
def wip_icodes():
|
||||||
if db.post_icodes == 0: return
|
if db.icodes == 0: return
|
||||||
|
|
||||||
matches = re.findall(r'I64.(.*?).I64', post_bottom)
|
matches = re.findall(r'I64.(.*?).I64', post_bottom)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
|
@ -625,7 +635,7 @@ def wip_icodes():
|
||||||
# Content is raw, and have to be converted in HTML #
|
# Content is raw, and have to be converted in HTML #
|
||||||
#--------------------------------------------------#
|
#--------------------------------------------------#
|
||||||
def wip_bcodes():
|
def wip_bcodes():
|
||||||
if db.post_bcodes == 0: return
|
if db.bcodes == 0: return
|
||||||
|
|
||||||
matches = re.findall(r'B64.(.*?).B64', post_bottom)
|
matches = re.findall(r'B64.(.*?).B64', post_bottom)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
|
@ -664,7 +674,7 @@ def wip_bcodes():
|
||||||
# Check between titles to set div or not #
|
# Check between titles to set div or not #
|
||||||
#----------------------------------------#
|
#----------------------------------------#
|
||||||
def wip_titles():
|
def wip_titles():
|
||||||
if db.post_titles == 0: return
|
if db.titles == 0: return
|
||||||
|
|
||||||
global post_bottom
|
global post_bottom
|
||||||
|
|
||||||
|
@ -760,7 +770,7 @@ def wip_filecode(target):
|
||||||
# Search lines for list marker #
|
# Search lines for list marker #
|
||||||
#------------------------------#
|
#------------------------------#
|
||||||
def wip_lists():
|
def wip_lists():
|
||||||
if not db.post_lists > 0: return
|
if not db.lists > 0: return
|
||||||
|
|
||||||
global post_bottom
|
global post_bottom
|
||||||
|
|
||||||
|
|
|
@ -70,13 +70,15 @@ generator = "Generator"
|
||||||
post_chg = "Article was edited. Check it"
|
post_chg = "Article was edited. Check it"
|
||||||
|
|
||||||
# Wip
|
# Wip
|
||||||
wip_new = "Create new HTML page in wip"
|
wip_new = "Create a new HTML page in 'wip' server again"
|
||||||
wip_again = "Create again already converted pages"
|
wip_again = "Create already converted pages again"
|
||||||
|
wip_newer = "Create missing HTML pages"
|
||||||
|
wip_older = "Update HTMl pages"
|
||||||
|
|
||||||
# Form
|
# Form
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
form_edit = "Edit the domain with the form"
|
form_edit = "Edit the domain with the form"
|
||||||
form_start = ' ├──────────────────────────────────────────────┐\n' + \
|
form_start = ' ├─────────────────────────────────────────────┐\n' + \
|
||||||
' │ Configure a new domain for current directory │\n' + \
|
' │ Configure a new domain for current directory │\n' + \
|
||||||
' │ Answer Y/y = yes. Enter to keep {default} │\n' + \
|
' │ Answer Y/y = yes. Enter to keep {default} │\n' + \
|
||||||
' │ Empty Answer cancel process, except for │\n' + \
|
' │ Empty Answer cancel process, except for │\n' + \
|
||||||
|
|
|
@ -69,8 +69,10 @@ generator = "Generateur"
|
||||||
post_chg = "Article édité. Le vérifier"
|
post_chg = "Article édité. Le vérifier"
|
||||||
|
|
||||||
# Wip
|
# Wip
|
||||||
wip_new = "Créer une nouvelle page HTML dans wip"
|
wip_new = "Créer encore une page HTML dans le serveur 'wip'"
|
||||||
wip_again = "Créer encore les pages déjà converties"
|
wip_again = "Créer encore les pages déjà converties"
|
||||||
|
wip_newer = "Créer les pages HTML manquantes"
|
||||||
|
wip_older = "Mise à jour des pages HTML"
|
||||||
|
|
||||||
# Formulaire
|
# Formulaire
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue