[1.9.22] - cleaner code, updated DBs managements
This commit is contained in:
parent
34afac630b
commit
ea99dcd1ae
|
@ -9,11 +9,12 @@ Tyto - Littérateur
|
||||||
|
|
||||||
# CURRENTLY IN DEV !
|
# CURRENTLY IN DEV !
|
||||||
|
|
||||||
## [1.9.22] (Not Yet push)
|
## [1.9.22]
|
||||||
- new bcode process (html prepared for wip)
|
- new bcode process (html prepared for wip)
|
||||||
- new post database management values
|
- new post database management values
|
||||||
- new icode process (html prepared for wip)
|
- new icode process (html prepared for wip)
|
||||||
- bcodes and icodes are FIRST processed in text article
|
- bcodes and icodes are FIRST processed in text article
|
||||||
|
- generic check fonction for bcodes, quotes, lists, paragraphs
|
||||||
- lots more
|
- lots more
|
||||||
|
|
||||||
## [1.9.21]
|
## [1.9.21]
|
||||||
|
|
|
@ -9,11 +9,10 @@ tyto
|
||||||
|
|
||||||
## ToDo next (working on)
|
## ToDo next (working on)
|
||||||
- 'check' action processes
|
- 'check' action processes
|
||||||
|
- - wip quotes
|
||||||
- - support for words tags (bolds...)
|
- - support for words tags (bolds...)
|
||||||
- - support lists, anchors
|
- - support lists, anchors
|
||||||
- - thinking about creating an auto top article menu from titles
|
- - thinking about creating an auto top article menu from titles
|
||||||
- - stats for article words
|
- - stats for article words
|
||||||
- manage template post database
|
|
||||||
- - check valid database
|
|
||||||
- Translate logs in english !
|
- Translate logs in english !
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Version: 1.9.22
|
# Version: 1.9.22
|
||||||
# Updated: 2023-10-11 1697039459
|
# Updated: 2023-10-13 1697190846
|
||||||
# Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
|
|
||||||
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
# Copyright (C) 2023 Cyrille Louarn <echolib+tyto@a-lec.org>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -76,10 +76,12 @@ def is_article(target):
|
||||||
# When all is OK
|
# When all is OK
|
||||||
# Will create post database, but now, show some values
|
# Will create post database, but now, show some values
|
||||||
print("Final texts string")
|
print("Final texts string")
|
||||||
|
"""
|
||||||
for ln, line in enumerate(texts, post.head_lines + 1):
|
for ln, line in enumerate(texts, post.head_lines + 1):
|
||||||
print(">", ln, line)
|
print(">", ln, line)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
"""
|
||||||
# Write to post database
|
# Write to post database
|
||||||
cf_update_values()
|
cf_update_values()
|
||||||
|
|
||||||
|
@ -113,7 +115,7 @@ def valid(target):
|
||||||
# Text article
|
# Text article
|
||||||
# ============
|
# ============
|
||||||
# Process bcodes and icodes first to protect their contents
|
# Process bcodes and icodes first to protect their contents
|
||||||
post.error == 0 and bcodes() or tools.exit(targets, post.error)
|
post.error == 0 and sl_ptags(post.ptags[0]) or tools.exit(targets, post.error)
|
||||||
post.error == 0 and icodes() or tools.exit(targets, post.error)
|
post.error == 0 and icodes() or tools.exit(targets, post.error)
|
||||||
|
|
||||||
# =============
|
# =============
|
||||||
|
@ -128,7 +130,10 @@ def valid(target):
|
||||||
# Text article
|
# Text article
|
||||||
# ============
|
# ============
|
||||||
# Single tags
|
# Single tags
|
||||||
post.error == 0 and sl_tags() or tools.exit(targets, post.error)
|
post.error == 0 and sl_stags() or tools.exit(targets, post.error)
|
||||||
|
|
||||||
|
# Quotes
|
||||||
|
post.error == 0 and sl_ptags(post.ptags[1]) or tools.exit(targets, post.error)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -467,23 +472,40 @@ def is_value2_file_exists(ln, tag, val2):
|
||||||
#=====================#
|
#=====================#
|
||||||
#=======================================#
|
#=======================================#
|
||||||
# bcodes: first process ! #
|
# bcodes: first process ! #
|
||||||
# Check if opened and closed tags match #
|
|
||||||
# Count bcodes for stats #
|
|
||||||
# Remove bcodes lines #
|
|
||||||
# - Create new post "texts" contents #
|
|
||||||
# Return True/False #
|
|
||||||
#---------------------------------------#
|
#---------------------------------------#
|
||||||
def bcodes():
|
|
||||||
|
|
||||||
|
#=========================================#
|
||||||
|
# start line paired tags #
|
||||||
|
# Generic check for all paired markers #
|
||||||
|
# Check if opened and closed tags match #
|
||||||
|
# Count markers for stats #
|
||||||
|
# bcodes: remove lines from texts #
|
||||||
|
# Convert content between markers to html #
|
||||||
|
# (except for paragraphs) #
|
||||||
|
# convert html content to base64 #
|
||||||
|
# create sections, keys values to post DB #
|
||||||
|
# Return True/False #
|
||||||
|
#-----------------------------------------#
|
||||||
|
def sl_ptags(markers):
|
||||||
global texts
|
global texts
|
||||||
|
|
||||||
markers = post.bcodes
|
convert = {
|
||||||
index0 = index1 = -1
|
"bcodes" : wip.bcode,
|
||||||
|
"quotes" : wip.quote,
|
||||||
|
}
|
||||||
|
|
||||||
|
index0 = index1 = -1
|
||||||
|
|
||||||
for ln, line in enumerate(texts, post.head_lines + 1):
|
for ln, line in enumerate(texts, post.head_lines + 1):
|
||||||
|
# Marker is opened
|
||||||
if index0 >= 0 :
|
if index0 >= 0 :
|
||||||
#print(">>>", ln, line)
|
content = "%s\n%s"%(content, line)
|
||||||
bcode = "%s\n%s"%(bcode, line)
|
if markers[2] == "bcodes":
|
||||||
texts[ln - 1 - post.head_lines] = ""
|
texts[ln - 1 - post.head_lines] = ""
|
||||||
|
|
||||||
# Opened mark
|
# Opened mark
|
||||||
if line.lstrip().startswith(markers[0]):
|
if line.lstrip().startswith(markers[0]):
|
||||||
|
@ -492,23 +514,23 @@ def bcodes():
|
||||||
# at the same position
|
# at the same position
|
||||||
if line.index(markers[0][0]) == index0:
|
if line.index(markers[0][0]) == index0:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s...%s) "%s"'%(
|
debug.out(53, '%s: %s...%s) "%s"'%(
|
||||||
tag_ln, ln, markers[1]
|
markers[2], tag_ln, ln, markers[1]
|
||||||
), post.uri, True, 2, False)
|
), post.uri, True, 2, False)
|
||||||
return False
|
return False
|
||||||
continue
|
continue
|
||||||
index0 = line.index(markers[0][0])
|
index0 = line.index(markers[0][0])
|
||||||
tag_ln = ln
|
tag_ln = ln
|
||||||
bcode = line
|
content = line
|
||||||
#print(">>>", ln, line)
|
if markers[2] == "bcodes":
|
||||||
texts[ln - 1 - post.head_lines] = ""
|
texts[ln - 1 - post.head_lines] = ""
|
||||||
|
|
||||||
# Closed mark
|
# Closed mark
|
||||||
if line.lstrip().startswith(markers[1]):
|
if line.lstrip().startswith(markers[1]):
|
||||||
if index0 < 0:
|
if index0 < 0:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) "%s"...'%(
|
debug.out(53, '%s: %s) "%s"...'%(
|
||||||
ln, markers[0]
|
markers[2], ln, markers[0]
|
||||||
), post.uri, True, 2, False)
|
), post.uri, True, 2, False)
|
||||||
return False
|
return False
|
||||||
index1 = line.index(markers[1][0])
|
index1 = line.index(markers[1][0])
|
||||||
|
@ -516,55 +538,73 @@ def bcodes():
|
||||||
if index1 == index0:
|
if index1 == index0:
|
||||||
index0 = index1 = -1
|
index0 = index1 = -1
|
||||||
tag_ln = ""
|
tag_ln = ""
|
||||||
post.stats_bcodes += 1
|
post.ptags_stats[markers[2]] += 1
|
||||||
|
|
||||||
# create ini values for this bcode
|
# paragraphs don't need html wip yet
|
||||||
var_name = "bcode_%s"%post.stats_bcodes
|
if markers[2] == "parags":
|
||||||
val_raws = tools.b64_convert("encode", bcode)
|
continue
|
||||||
var_html = "html_%s"%post.stats_bcodes
|
|
||||||
val_html = tools.b64_convert("encode", wip.bcode(bcode))
|
# Generic db Keys and values
|
||||||
post.cf_set("BCODES", var_name, val_raws)
|
var_name = "%s_%s"%(markers[2][:-1], post.ptags_stats[markers[2]])
|
||||||
post.cf_set("BCODES", var_html, val_html)
|
val_raws = tools.b64_convert("encode", content)
|
||||||
|
var_html = "html_%s"%post.ptags_stats[markers[2]]
|
||||||
|
|
||||||
|
# Specific values from marker
|
||||||
|
val_html = tools.b64_convert("encode", convert[markers[2]](content))
|
||||||
|
|
||||||
|
# Set keys, values to post database
|
||||||
|
post.cf_set(markers[2].upper(), var_name, val_raws)
|
||||||
|
post.cf_set(markers[2].upper(), var_html, val_html)
|
||||||
|
|
||||||
# bcode not opened, but closed tag found
|
# bcode not opened, but closed tag found
|
||||||
elif index0 < 0:
|
elif index0 < 0:
|
||||||
tag_ln = ln
|
tag_ln = ln
|
||||||
|
|
||||||
|
|
||||||
# Check if markers match
|
# Check if markers match
|
||||||
# ----------------------
|
# ----------------------
|
||||||
if index1 >= 0 and index0 < 0:
|
if index1 >= 0 and index0 < 0:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) "%s"...'%(tag_ln, markers[0]), post.uri, True,2, False)
|
debug.out(53, '%s: %s) "%s"...'%(
|
||||||
|
markers[2], tag_ln, markers[0]
|
||||||
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if index0 >= 0 and index1 < 0:
|
if index0 >= 0 and index1 < 0:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) ..."%s"'%(tag_ln, markers[1]), post.uri, True,2, False)
|
debug.out(53, '%s: %s) ..."%s"'%(
|
||||||
|
markers[2], tag_ln, markers[1]
|
||||||
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if index0 != index1:
|
if index0 != index1:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) "%s"..."%s"'%(
|
debug.out(53, '%s: %s) "%s"..."%s"'%(
|
||||||
tag_ln, markers[0], markers[1]
|
markers[2], tag_ln, markers[0], markers[1]
|
||||||
), post.uri, True,2, False)
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
print(": stats", markers[2], post.ptags_stats[markers[2]])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# icodes (SAME LINE)
|
#==========================================#
|
||||||
|
# icodes (SAME LINE) #
|
||||||
# Check if opened and closed markers match #
|
# Check if opened and closed markers match #
|
||||||
#
|
# Convert double marks, then single markes #
|
||||||
|
# replace icodes with "" in texts article #
|
||||||
|
# Add source text and html converted to DB #
|
||||||
|
#------------------------------------------#
|
||||||
def icodes():
|
def icodes():
|
||||||
global texts
|
global texts
|
||||||
|
|
||||||
markers = post.icodes
|
markers = post.words_markers
|
||||||
|
|
||||||
for ln, line in enumerate(texts, post.head_lines + 1):
|
for ln, line in enumerate(texts, post.head_lines + 1):
|
||||||
# Search for opened, closed markers
|
# Search for opened, closed markers
|
||||||
# markers cannot be at same position on line
|
# markers cannot be at same position on line
|
||||||
m0 = line.find(markers[0])
|
m0 = line.find(markers[1][0])
|
||||||
m1 = line.find(markers[1])
|
m1 = line.find(markers[1][1])
|
||||||
if m0 == m1:
|
if m0 == m1:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -574,7 +614,7 @@ def icodes():
|
||||||
if m1 < m0:
|
if m1 < m0:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) "%s"..."%s"'%(
|
debug.out(53, '%s) "%s"..."%s"'%(
|
||||||
ln, markers[1], markers[0]
|
ln, markers[1][1], markers[1][0]
|
||||||
), post.uri, True,2, False)
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -582,7 +622,7 @@ def icodes():
|
||||||
if m0 >= 0 and m1 == -1:
|
if m0 >= 0 and m1 == -1:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) ..."%s"'%(
|
debug.out(53, '%s) ..."%s"'%(
|
||||||
ln, markers[1]
|
ln, markers[1][1]
|
||||||
), post.uri, True,2, False)
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -590,51 +630,46 @@ def icodes():
|
||||||
elif m1 >= 0 and m0 == -1:
|
elif m1 >= 0 and m0 == -1:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s) "%s"...'%(
|
debug.out(53, '%s) "%s"...'%(
|
||||||
ln, markers[0]
|
ln, markers[1][0]
|
||||||
), post.uri, True,2, False)
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if post.words_markers[0][0] in line:
|
if markers[0][0] in line:
|
||||||
line = line.replace(post.words_markers[0][0], post.words_markers[0][4])
|
# Double mark first
|
||||||
line = line.replace(post.words_markers[0][1], post.words_markers[0][5])
|
line = line.replace(markers[0][0], markers[0][4])
|
||||||
icodes = re.findall('%s(.*?)%s'%(
|
line = line.replace(markers[0][1], markers[0][5])
|
||||||
post.words_markers[0][4], post.words_markers[0][5]
|
icodes = re.findall('%s(.*?)%s'%(markers[0][4], markers[0][5]), line)
|
||||||
), line)
|
|
||||||
|
|
||||||
for icode in icodes:
|
for icode in icodes:
|
||||||
post.stats_text_icodes += 1
|
post.stats_text_icodes += 1
|
||||||
icnew = post.words_markers[0][4] + icode + post.words_markers[0][5]
|
icnew = markers[0][4] + icode + markers[0][5]
|
||||||
line = line.replace(icnew, "")
|
line = line.replace(icnew, "")
|
||||||
|
|
||||||
# Set HTML [ICODES] to post database
|
# Set HTML [ICODES] to post database
|
||||||
icode_var = "icode_%s"%post.stats_text_icodes
|
icode_var = "icode_%s"%post.stats_text_icodes
|
||||||
icleg = post.words_markers[0][0] + icode + post.words_markers[0][1]
|
icleg = markers[0][0] + icode + markers[0][1]
|
||||||
html_var = "html_%s"%post.stats_text_icodes
|
html_var = "html_%s"%post.stats_text_icodes
|
||||||
html_val = icnew.replace(post.words_markers[0][4],
|
html_val = icnew.replace(markers[0][4], markers[0][2]%css)
|
||||||
post.words_markers[0][2]%css)
|
html_val = html_val.replace(markers[0][5], markers[0][3])
|
||||||
html_val = html_val.replace(post.words_markers[0][5],
|
|
||||||
post.words_markers[0][3])
|
|
||||||
post.cf_set("ICODES", icode_var, icleg)
|
post.cf_set("ICODES", icode_var, icleg)
|
||||||
post.cf_set("ICODES", html_var, html_val)
|
post.cf_set("ICODES", html_var, html_val)
|
||||||
|
|
||||||
line = line.replace(post.words_markers[1][0], post.words_markers[1][4])
|
# Single mark
|
||||||
line = line.replace(post.words_markers[1][1], post.words_markers[1][5])
|
line = line.replace(markers[1][0], markers[1][4])
|
||||||
icodes = re.findall('%s(.*?)%s'%(
|
line = line.replace(markers[1][1], markers[1][5])
|
||||||
post.words_markers[1][4], post.words_markers[1][5]
|
icodes = re.findall('%s(.*?)%s'%(markers[1][4], markers[1][5]), line)
|
||||||
), line)
|
|
||||||
for icode in icodes:
|
for icode in icodes:
|
||||||
post.stats_text_icodes += 1
|
post.stats_text_icodes += 1
|
||||||
icnew = post.words_markers[1][4] + icode + post.words_markers[1][5]
|
icnew = markers[1][4] + icode + markers[1][5]
|
||||||
line = line.replace(icnew, "")
|
line = line.replace(icnew, "")
|
||||||
|
|
||||||
# Set HTML [ICODES] to post database
|
# Set HTML [ICODES] to post database
|
||||||
icode_var = "icode_%s"%post.stats_text_icodes
|
icode_var = "icode_%s"%post.stats_text_icodes
|
||||||
icleg = post.words_markers[1][0] + icode + post.words_markers[1][1]
|
icleg = markers[1][0] + icode + markers[1][1]
|
||||||
html_var = "html_%s"%post.stats_text_icodes
|
html_var = "html_%s"%post.stats_text_icodes
|
||||||
html_val = icnew.replace(post.words_markers[1][4],
|
html_val = icnew.replace(markers[1][4], markers[1][2]%css)
|
||||||
post.words_markers[1][2]%css)
|
html_val = html_val.replace(markers[1][5], markers[1][3])
|
||||||
html_val = html_val.replace(post.words_markers[1][5],
|
|
||||||
post.words_markers[1][3])
|
|
||||||
post.cf_set("ICODES", icode_var, icleg)
|
post.cf_set("ICODES", icode_var, icleg)
|
||||||
post.cf_set("ICODES", html_var, html_val)
|
post.cf_set("ICODES", html_var, html_val)
|
||||||
|
|
||||||
|
@ -644,12 +679,13 @@ def icodes():
|
||||||
|
|
||||||
|
|
||||||
#============================#
|
#============================#
|
||||||
|
# start line single tags #
|
||||||
# Check optional title tags #
|
# Check optional title tags #
|
||||||
# Count tyto + html comments #
|
# Count tyto + html comments #
|
||||||
# Add stat for _image:logo #
|
# Add stat for _image:logo #
|
||||||
# Return True/False #
|
# Return True/False #
|
||||||
#----------------------------#
|
#----------------------------#
|
||||||
def sl_tags():
|
def sl_stags():
|
||||||
for ln, line in enumerate(texts, post.head_lines + 1):
|
for ln, line in enumerate(texts, post.head_lines + 1):
|
||||||
# legacy Tyto Titles
|
# legacy Tyto Titles
|
||||||
if line.startswith(post.tyto_titles):
|
if line.startswith(post.tyto_titles):
|
||||||
|
@ -776,8 +812,9 @@ def cf_update_values():
|
||||||
post.cf_set("STATS_TEXTS", "tyto_coms", str(post.stats_tyto_text_coms))
|
post.cf_set("STATS_TEXTS", "tyto_coms", str(post.stats_tyto_text_coms))
|
||||||
post.cf_set("STATS_TEXTS", "html_coms", str(post.stats_html_coms))
|
post.cf_set("STATS_TEXTS", "html_coms", str(post.stats_html_coms))
|
||||||
post.cf_set("STATS_TEXTS", "titles", str(post.stats_titles))
|
post.cf_set("STATS_TEXTS", "titles", str(post.stats_titles))
|
||||||
post.cf_set("STATS_TEXTS", "bcodes", str(post.stats_bcodes))
|
#post.cf_set("STATS_TEXTS", "bcodes_lines", str(post.stats_bcodes_lines))
|
||||||
post.cf_set("STATS_TEXTS", "bcodes_lines", str(post.stats_bcodes_lines))
|
post.cf_set("STATS_TEXTS", "bcodes", str(post.ptags_stats["bcodes"]))
|
||||||
|
post.cf_set("STATS_TEXTS", "quotes", str(post.ptags_stats["quotes"]))
|
||||||
# Founds from header tags
|
# Founds from header tags
|
||||||
post.cf_set("STATS_TEXTS", "links", str(post.stats_text_links))
|
post.cf_set("STATS_TEXTS", "links", str(post.stats_text_links))
|
||||||
post.cf_set("STATS_TEXTS", "files", str(post.stats_text_files))
|
post.cf_set("STATS_TEXTS", "files", str(post.stats_text_files))
|
||||||
|
|
|
@ -227,11 +227,11 @@ def cf_update_values(write):
|
||||||
|
|
||||||
cf_set("DOMAIN", "name", name)
|
cf_set("DOMAIN", "name", name)
|
||||||
|
|
||||||
title = cf_set("DOMAIN", "title", "title")
|
title = cf_set("DOMAIN", "title", "title")
|
||||||
date = cf_set("DOMAIN", "date", "date")
|
date = cf_set("DOMAIN", "date", "date")
|
||||||
about = cf_set("DOMAIN", "about", "about")
|
about = cf_set("DOMAIN", "about", "about")
|
||||||
mail = cf_set("DOMAIN", "mail", "mail")
|
mail = cf_set("DOMAIN", "mail", "mail")
|
||||||
tags = cf_set("DOMAIN", "tags", "tags")
|
tags = cf_set("DOMAIN", "tags", "tags")
|
||||||
license = cf_set("DOMAIN", "lincese", "")
|
license = cf_set("DOMAIN", "lincese", "")
|
||||||
if not license:
|
if not license:
|
||||||
license = cf_set("DOMAIN", "lincese", "gfdl-1.3")
|
license = cf_set("DOMAIN", "lincese", "gfdl-1.3")
|
||||||
|
@ -242,8 +242,8 @@ def cf_update_values(write):
|
||||||
|
|
||||||
# Optional
|
# Optional
|
||||||
global legals_url, terms_url, statuses_url
|
global legals_url, terms_url, statuses_url
|
||||||
legals_url = cf_set("DOMAIN", "legals_url", "")
|
legals_url = cf_set("DOMAIN", "legals_url", "")
|
||||||
terms_url = cf_set("DOMAIN", "terms_url", "")
|
terms_url = cf_set("DOMAIN", "terms_url", "")
|
||||||
statuses_url = cf_set("DOMAIN", "statuses_url", "")
|
statuses_url = cf_set("DOMAIN", "statuses_url", "")
|
||||||
|
|
||||||
|
|
||||||
|
@ -255,51 +255,46 @@ def cf_update_values(write):
|
||||||
srv = cf_set("SERVER", "root", "server")
|
srv = cf_set("SERVER", "root", "server")
|
||||||
|
|
||||||
srv_name = os.path.join(srv, name + "/")
|
srv_name = os.path.join(srv, name + "/")
|
||||||
|
wip = os.path.join(srv_name, "wip/")
|
||||||
|
www = os.path.join(srv_name, "www/")
|
||||||
|
|
||||||
cf_set("SERVER", "domain", srv_name)
|
cf_set("SERVER", "domain", srv_name)
|
||||||
|
cf_set("SERVER", "wip", wip)
|
||||||
wip = os.path.join(srv_name, "wip/")
|
cf_set("SERVER", "www", www)
|
||||||
cf_set("SERVER", "wip", wip)
|
|
||||||
|
|
||||||
www = os.path.join(srv_name, "www/")
|
|
||||||
cf_set("SERVER", "www", www)
|
|
||||||
|
|
||||||
|
|
||||||
# [WIP_DIRS]
|
# [WIP_DIRS]
|
||||||
# ==========
|
# ==========
|
||||||
global wip_tpl, wip_images, wip_files
|
global wip_tpl, wip_images, wip_files
|
||||||
wip_tpl = os.path.join(wip, "template/")
|
wip_tpl = os.path.join(wip, "template/")
|
||||||
cf_set("WIP_DIRS", "template", wip_tpl)
|
|
||||||
|
|
||||||
wip_images = os.path.join(wip, "images/")
|
wip_images = os.path.join(wip, "images/")
|
||||||
cf_set("WIP_DIRS", "images", wip_images)
|
wip_files = os.path.join(wip, "files/")
|
||||||
|
|
||||||
wip_files = os.path.join(wip, "files/")
|
cf_set("WIP_DIRS", "template", wip_tpl)
|
||||||
cf_set("WIP_DIRS", "files", wip_files)
|
cf_set("WIP_DIRS", "images", wip_images)
|
||||||
|
cf_set("WIP_DIRS", "files", wip_files)
|
||||||
|
|
||||||
|
|
||||||
# [WWW_DIRS]
|
# [WWW_DIRS]
|
||||||
# ==========
|
# ==========
|
||||||
global www_tpl, www_images, www_files
|
global www_tpl, www_images, www_files
|
||||||
www_tpl = os.path.join(www, "template/")
|
www_tpl = os.path.join(www, "template/")
|
||||||
cf_set("WWW_DIRS", "template", www_tpl)
|
|
||||||
|
|
||||||
www_images = os.path.join(www, "images/")
|
www_images = os.path.join(www, "images/")
|
||||||
cf_set("WWW_DIRS", "images", www_images)
|
www_files = os.path.join(www, "files/")
|
||||||
|
|
||||||
www_files = os.path.join(www, "files/")
|
cf_set("WWW_DIRS", "template", www_tpl)
|
||||||
cf_set("WWW_DIRS", "files", www_files)
|
cf_set("WWW_DIRS", "images", www_images)
|
||||||
|
cf_set("WWW_DIRS", "files", www_files)
|
||||||
|
|
||||||
|
|
||||||
# [WEBSITE]
|
# [WEBSITE]
|
||||||
# =========
|
# =========
|
||||||
global wip_url, www_url, lang, css, sep, article_code, static
|
global wip_url, www_url, lang, css, sep, article_code, static
|
||||||
wip_url = cf_set("WEBSITE", "wip_url", "")
|
wip_url = cf_set("WEBSITE", "wip_url", "") or \
|
||||||
if not wip_url:
|
cf_set("WEBSITE", "wip_url", create_wip_url())
|
||||||
wip_url = cf_set("WEBSITE", "wip_url", create_wip_url())
|
|
||||||
|
|
||||||
www_url = cf_set("WEBSITE", "www_url", "")
|
www_url = cf_set("WEBSITE", "www_url", "") or \
|
||||||
if not www_url:
|
cf_set("WEBSITE", "www_url", "https://%s/"%name)
|
||||||
www_url = cf_set("WEBSITE", "www_url", "https://%s/"%name)
|
|
||||||
|
|
||||||
lang = cf_set("WEBSITE", "lang", "")
|
lang = cf_set("WEBSITE", "lang", "")
|
||||||
if not lang:
|
if not lang:
|
||||||
|
@ -308,9 +303,8 @@ def cf_update_values(write):
|
||||||
lang = langs.get_sys_lang()
|
lang = langs.get_sys_lang()
|
||||||
langs.load_website_lang()
|
langs.load_website_lang()
|
||||||
|
|
||||||
css = cf_set("WEBSITE", "css", "")
|
css = cf_set("WEBSITE", "css", "") or \
|
||||||
if not css:
|
cf_set("WEBSITE", "css", "tyto")
|
||||||
css = cf_set("WEBSITE", "css", "tyto")
|
|
||||||
|
|
||||||
sep = cf_set("WEBSITE", "separator", "")
|
sep = cf_set("WEBSITE", "separator", "")
|
||||||
if not sep or len(sep) > 2:
|
if not sep or len(sep) > 2:
|
||||||
|
@ -328,10 +322,8 @@ def cf_update_values(write):
|
||||||
try: navbar = cf.getboolean("WEBSITE_MODULES", "navbar")
|
try: navbar = cf.getboolean("WEBSITE_MODULES", "navbar")
|
||||||
except: navbar = cf_set("WEBSITE_MODULES", "navbar", "yes")
|
except: navbar = cf_set("WEBSITE_MODULES", "navbar", "yes")
|
||||||
|
|
||||||
sidebar_title = cf_set("WEBSITE_MODULES", "sidebar_title", "")
|
sidebar_title = cf_set("WEBSITE_MODULES", "sidebar_title", "") or \
|
||||||
if not sidebar_title:
|
cf_set("WEBSITE_MODULES", "sidebar_title", langs.site.sidebar_title)
|
||||||
sidebar_title = cf_set("WEBSITE_MODULES", "sidebar_title",
|
|
||||||
langs.site.sidebar_title)
|
|
||||||
|
|
||||||
sidebar_items = cf_set("WEBSITE_MODULES", "sidebar_items", "")
|
sidebar_items = cf_set("WEBSITE_MODULES", "sidebar_items", "")
|
||||||
if not sidebar_items or not sidebar_items.isdigit():
|
if not sidebar_items or not sidebar_items.isdigit():
|
||||||
|
@ -348,35 +340,30 @@ def cf_update_values(write):
|
||||||
# TEMPLATE_FILENAMES
|
# TEMPLATE_FILENAMES
|
||||||
# ==================
|
# ==================
|
||||||
global favicon, logo, styles, rss, stats
|
global favicon, logo, styles, rss, stats
|
||||||
favicon = cf_set("TEMPLATE_FILENAMES", "favicon", "")
|
favicon = cf_set("TEMPLATE_FILENAMES", "favicon", "") or \
|
||||||
if not favicon:
|
cf_set("TEMPLATE_FILENAMES", "favicon", "favicon.png")
|
||||||
favicon = cf_set("TEMPLATE_FILENAMES", "favicon", "favicon.png")
|
|
||||||
|
|
||||||
logo = cf_set("TEMPLATE_FILENAMES", "logo", "")
|
logo = cf_set("TEMPLATE_FILENAMES", "logo", "") or \
|
||||||
if not logo:
|
cf_set("TEMPLATE_FILENAMES", "logo", "logo.png")
|
||||||
logo = cf_set("TEMPLATE_FILENAMES", "logo", "logo.png")
|
|
||||||
|
|
||||||
styles = cf_set("TEMPLATE_FILENAMES", "styles", "")
|
styles = cf_set("TEMPLATE_FILENAMES", "styles", "") or \
|
||||||
if not styles:
|
cf_set("TEMPLATE_FILENAMES", "styles", "styles.css")
|
||||||
styles = cf_set("TEMPLATE_FILENAMES", "styles", "styles.css")
|
|
||||||
|
|
||||||
rss = cf_set("TEMPLATE_FILENAMES", "rss", "")
|
rss = cf_set("TEMPLATE_FILENAMES", "rss", "") or \
|
||||||
if not rss:
|
cf_set("TEMPLATE_FILENAMES", "rss", "rss.xml")
|
||||||
rss = cf_set("TEMPLATE_FILENAMES", "rss", "rss.xml")
|
|
||||||
|
|
||||||
stats = cf_set("TEMPLATE_FILENAMES", "stats", "")
|
stats = cf_set("TEMPLATE_FILENAMES", "stats", "") or \
|
||||||
if not stats:
|
cf_set("TEMPLATE_FILENAMES", "stats", "tyto_stats.ini")
|
||||||
stats = cf_set("TEMPLATE_FILENAMES", "stats", "tyto_stats.ini")
|
|
||||||
|
|
||||||
|
|
||||||
# [USER_DIRS]
|
# [USER_DIRS]
|
||||||
# ===========
|
# ===========
|
||||||
cf_set("USER_DIRS", "root", wrk_dir)
|
cf_set("USER_DIRS", "root", wrk_dir)
|
||||||
cf_set("USER_DIRS", "articles", wrk_articles)
|
cf_set("USER_DIRS", "articles", wrk_articles)
|
||||||
cf_set("USER_DIRS", "images", wrk_images)
|
cf_set("USER_DIRS", "images", wrk_images)
|
||||||
cf_set("USER_DIRS", "files", wrk_files)
|
cf_set("USER_DIRS", "files", wrk_files)
|
||||||
cf_set("USER_DIRS", "template", wrk_tpl)
|
cf_set("USER_DIRS", "template", wrk_tpl)
|
||||||
cf_set("USER_DIRS", "modules", wrk_mods)
|
cf_set("USER_DIRS", "modules", wrk_mods)
|
||||||
cf_set("USER_DIRS", "database", wrk_db)
|
cf_set("USER_DIRS", "database", wrk_db)
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,31 +371,27 @@ def cf_update_values(write):
|
||||||
# =====================
|
# =====================
|
||||||
global wrk_favicon, wrk_logo, wri_styles
|
global wrk_favicon, wrk_logo, wri_styles
|
||||||
wrk_favicon = os.path.join(wrk_tpl, favicon)
|
wrk_favicon = os.path.join(wrk_tpl, favicon)
|
||||||
|
wrk_logo = os.path.join(wrk_tpl, logo)
|
||||||
|
wrk_styles = os.path.join(wrk_tpl, styles)
|
||||||
|
|
||||||
cf_set("USER_TEMPLATE_FILES", "favicon", wrk_favicon)
|
cf_set("USER_TEMPLATE_FILES", "favicon", wrk_favicon)
|
||||||
|
cf_set("USER_TEMPLATE_FILES", "logo", wrk_logo)
|
||||||
wrk_logo = os.path.join(wrk_tpl, logo)
|
cf_set("USER_TEMPLATE_FILES", "styles", wrk_styles)
|
||||||
cf_set("USER_TEMPLATE_FILES", "logo", wrk_logo)
|
|
||||||
|
|
||||||
wrk_styles = os.path.join(wrk_tpl, styles)
|
|
||||||
cf_set("USER_TEMPLATE_FILES", "styles", wrk_styles)
|
|
||||||
|
|
||||||
|
|
||||||
# [USER_MODULES_FILES]
|
# [USER_MODULES_FILES]
|
||||||
# ====================
|
# ====================
|
||||||
global wrk_metas, wrk_header, wrk_navbar, wrk_sidebar, wrk_footer
|
global wrk_metas, wrk_header, wrk_navbar, wrk_sidebar, wrk_footer
|
||||||
wrk_metas = os.path.join(wrk_mods, "tyto_metas.raw")
|
wrk_metas = os.path.join(wrk_mods, "tyto_metas.raw")
|
||||||
cf_set("USER_MODULES_FILES", "metas", wrk_metas)
|
wrk_header = os.path.join(wrk_mods, "tyto_header.raw")
|
||||||
|
wrk_navbar = os.path.join(wrk_mods, "tyto_navbar.raw")
|
||||||
wrk_header = os.path.join(wrk_mods, "tyto_header.raw")
|
|
||||||
cf_set("USER_MODULES_FILES", "header", wrk_header)
|
|
||||||
|
|
||||||
wrk_navbar = os.path.join(wrk_mods, "tyto_navbar.raw")
|
|
||||||
cf_set("USER_MODULES_FILES", "navbar", wrk_navbar)
|
|
||||||
|
|
||||||
wrk_sidebar = os.path.join(wrk_mods, "tyto_sidebar.raw")
|
wrk_sidebar = os.path.join(wrk_mods, "tyto_sidebar.raw")
|
||||||
cf_set("USER_MODULES_FILES", "sidebar", wrk_sidebar)
|
wrk_footer = os.path.join(wrk_mods, "tyto_footer.raw")
|
||||||
|
|
||||||
wrk_footer = os.path.join(wrk_mods, "tyto_footer.raw")
|
cf_set("USER_MODULES_FILES", "metas", wrk_metas)
|
||||||
|
cf_set("USER_MODULES_FILES", "header", wrk_header)
|
||||||
|
cf_set("USER_MODULES_FILES", "navbar", wrk_navbar)
|
||||||
|
cf_set("USER_MODULES_FILES", "sidebar", wrk_sidebar)
|
||||||
cf_set("USER_MODULES_FILES", "footer", wrk_footer)
|
cf_set("USER_MODULES_FILES", "footer", wrk_footer)
|
||||||
|
|
||||||
|
|
||||||
|
@ -416,70 +399,58 @@ def cf_update_values(write):
|
||||||
# ===========
|
# ===========
|
||||||
global wip_favicon, wip_logo, wip_styles, wip_rss, wip_stats
|
global wip_favicon, wip_logo, wip_styles, wip_rss, wip_stats
|
||||||
wip_favicon = os.path.join(wip_tpl, favicon)
|
wip_favicon = os.path.join(wip_tpl, favicon)
|
||||||
|
wip_logo = os.path.join(wip_tpl, logo)
|
||||||
|
wip_styles = os.path.join(wip_tpl, styles)
|
||||||
|
wip_rss = os.path.join(wip_tpl, rss)
|
||||||
|
wip_stats = os.path.join(wip_tpl, stats)
|
||||||
|
|
||||||
cf_set("WIP_FILES", "favicon", wip_favicon)
|
cf_set("WIP_FILES", "favicon", wip_favicon)
|
||||||
|
cf_set("WIP_FILES", "logo", wip_logo)
|
||||||
wip_logo = os.path.join(wip_tpl, logo)
|
|
||||||
cf_set("WIP_FILES", "logo", wip_logo)
|
|
||||||
|
|
||||||
wip_styles = os.path.join(wip_tpl, styles)
|
|
||||||
cf_set("WIP_FILES", "styles", wip_styles)
|
cf_set("WIP_FILES", "styles", wip_styles)
|
||||||
|
cf_set("WIP_FILES", "rss", wip_rss)
|
||||||
wip_rss = os.path.join(wip_tpl, rss)
|
cf_set("WIP_FILES", "stats", wip_stats)
|
||||||
cf_set("WIP_FILES", "rss", wip_rss)
|
|
||||||
|
|
||||||
wip_stats = os.path.join(wip_tpl, stats)
|
|
||||||
cf_set("WIP_FILES", "stats", wip_stats)
|
|
||||||
|
|
||||||
global wip_metas, wip_header, wip_navbar, wip_sidebar, wip_footer
|
global wip_metas, wip_header, wip_navbar, wip_sidebar, wip_footer
|
||||||
wip_metas = os.path.join(wip_tpl, "metas.html")
|
wip_metas = os.path.join(wip_tpl, "metas.html")
|
||||||
cf_set("WIP_FILES", "metas", wip_metas)
|
wip_header = os.path.join(wip_tpl, "header.html")
|
||||||
|
wip_navbar = os.path.join(wip_tpl, "navbar.html")
|
||||||
wip_header = os.path.join(wip_tpl, "header.html")
|
|
||||||
cf_set("WIP_FILES", "header", wip_header)
|
|
||||||
|
|
||||||
wip_navbar = os.path.join(wip_tpl, "navbar.html")
|
|
||||||
cf_set("WIP_FILES", "navbar", wip_navbar)
|
|
||||||
|
|
||||||
wip_sidebar = os.path.join(wip_tpl, "sidebar.html")
|
wip_sidebar = os.path.join(wip_tpl, "sidebar.html")
|
||||||
cf_set("WIP_FILES", "sidebar", wip_sidebar)
|
wip_footer = os.path.join(wip_tpl, "footer.html")
|
||||||
|
|
||||||
wip_footer = os.path.join(wip_tpl, "footer.html")
|
cf_set("WIP_FILES", "metas", wip_metas)
|
||||||
cf_set("WIP_FILES", "footer", wip_footer)
|
cf_set("WIP_FILES", "header", wip_header)
|
||||||
|
cf_set("WIP_FILES", "navbar", wip_navbar)
|
||||||
|
cf_set("WIP_FILES", "sidebar", wip_sidebar)
|
||||||
|
cf_set("WIP_FILES", "footer", wip_footer)
|
||||||
|
|
||||||
|
|
||||||
# [WWW_FILES]
|
# [WWW_FILES]
|
||||||
# ===========
|
# ===========
|
||||||
global www_favicon, www_logo, www_styles, www_rss, www_stats
|
global www_favicon, www_logo, www_styles, www_rss, www_stats
|
||||||
www_favicon = os.path.join(www_tpl, favicon)
|
www_favicon = os.path.join(www_tpl, favicon)
|
||||||
|
www_logo = os.path.join(www_tpl, logo)
|
||||||
|
www_styles = os.path.join(www_tpl, styles)
|
||||||
|
www_rss = os.path.join(www_tpl, rss)
|
||||||
|
www_stats = os.path.join(www_tpl, stats)
|
||||||
|
|
||||||
cf_set("WWW_FILES", "favicon", www_favicon)
|
cf_set("WWW_FILES", "favicon", www_favicon)
|
||||||
|
cf_set("WWW_FILES", "logo", www_logo)
|
||||||
www_logo = os.path.join(www_tpl, logo)
|
cf_set("WWW_FILES", "styles", www_styles)
|
||||||
cf_set("WWW_FILES", "logo", www_logo)
|
cf_set("WWW_FILES", "rss", www_rss)
|
||||||
|
cf_set("WWW_FILES", "stats", www_stats)
|
||||||
www_styles = os.path.join(www_tpl, styles)
|
|
||||||
cf_set("WWW_FILES", "styles", www_styles)
|
|
||||||
|
|
||||||
www_rss = os.path.join(www_tpl, rss)
|
|
||||||
cf_set("WWW_FILES", "rss", www_rss)
|
|
||||||
|
|
||||||
www_stats = os.path.join(www_tpl, stats)
|
|
||||||
cf_set("WWW_FILES", "stats", www_stats)
|
|
||||||
|
|
||||||
global www_metas, www_header, www_navbar, www_sidebar, www_footer
|
global www_metas, www_header, www_navbar, www_sidebar, www_footer
|
||||||
www_metas = os.path.join(www_tpl, "metas.html")
|
www_metas = os.path.join(www_tpl, "metas.html")
|
||||||
cf_set("WWW_FILES", "metas", www_metas)
|
www_header = os.path.join(www_tpl, "header.html")
|
||||||
|
www_navbar = os.path.join(www_tpl, "navbar.html")
|
||||||
www_header = os.path.join(www_tpl, "header.html")
|
|
||||||
cf_set("WWW_FILES", "header", www_header)
|
|
||||||
|
|
||||||
www_navbar = os.path.join(www_tpl, "navbar.html")
|
|
||||||
cf_set("WWW_FILES", "navbar", www_navbar)
|
|
||||||
|
|
||||||
www_sidebar = os.path.join(www_tpl, "sidebar.html")
|
www_sidebar = os.path.join(www_tpl, "sidebar.html")
|
||||||
cf_set("WWW_FILES", "sidebar", www_sidebar)
|
www_footer = os.path.join(www_tpl, "footer.html")
|
||||||
|
|
||||||
www_footer = os.path.join(www_tpl, "footer.html")
|
cf_set("WWW_FILES", "metas", www_metas)
|
||||||
cf_set("WWW_FILES", "footer", www_footer)
|
cf_set("WWW_FILES", "header", www_header)
|
||||||
|
cf_set("WWW_FILES", "navbar", www_navbar)
|
||||||
|
cf_set("WWW_FILES", "sidebar", www_sidebar)
|
||||||
|
cf_set("WWW_FILES", "footer", www_footer)
|
||||||
|
|
||||||
|
|
||||||
# [TYTO]
|
# [TYTO]
|
||||||
|
|
|
@ -318,6 +318,21 @@ quotes = ("[[", "]]")
|
||||||
parags = ("((", "))")
|
parags = ("((", "))")
|
||||||
lists = ("<<", ">>", "=", "+")
|
lists = ("<<", ">>", "=", "+")
|
||||||
|
|
||||||
|
# Paired markers
|
||||||
|
ptags = (
|
||||||
|
("{{", "}}", "bcodes"),
|
||||||
|
("[[", "]]", "quotes"),
|
||||||
|
("((", "))", "parags"),
|
||||||
|
("<<", ">>", "lists" ),
|
||||||
|
)
|
||||||
|
|
||||||
|
ptags_stats = {
|
||||||
|
"bcodes" : stats_bcodes,
|
||||||
|
"quotes" : stats_quotes,
|
||||||
|
"parags" : stats_parags,
|
||||||
|
"lists" : stats_lists,
|
||||||
|
}
|
||||||
|
|
||||||
# Tyto Titles #1 = <h2>
|
# Tyto Titles #1 = <h2>
|
||||||
tyto_titles = ("#1", "#2", "#3", "#4", "#5")
|
tyto_titles = ("#1", "#2", "#3", "#4", "#5")
|
||||||
html_titles = {
|
html_titles = {
|
||||||
|
@ -335,15 +350,11 @@ text_comments = (";;", "<!--")
|
||||||
html_parag_start = (parags[0], '<p class="%s%s">')
|
html_parag_start = (parags[0], '<p class="%s%s">')
|
||||||
html_parag_close = (parags[1], '</p>')
|
html_parag_close = (parags[1], '</p>')
|
||||||
|
|
||||||
|
|
||||||
# IN-texts contents markers (bold, icodes...)
|
|
||||||
icodes = ("{_", "_}")
|
|
||||||
|
|
||||||
# Specifics convertion
|
# Specifics convertion
|
||||||
words_markers = \
|
words_markers = \
|
||||||
(
|
(
|
||||||
("{_{_", "_}_}", '<code class="%s icode">{_', '_}</code>', "IC21", "IC22"),
|
("{_{_", "_}_}", '<code class="%s icode">{_', '_}</code>', "IC21", "IC22"),
|
||||||
("{_", "_}", '<code class="%s icode">', '</code>', "IC11", "IC12"),
|
("{_", "_}", '<code class="%s icode">', '</code>', "IC11", "IC12"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -374,6 +385,8 @@ ini_template = """[DOMAIN]
|
||||||
|
|
||||||
[BCODES]
|
[BCODES]
|
||||||
|
|
||||||
|
[QUOTES]
|
||||||
|
|
||||||
[RAWS]
|
[RAWS]
|
||||||
|
|
||||||
[CODES]
|
[CODES]
|
||||||
|
|
|
@ -67,6 +67,16 @@ def bcode(lines):
|
||||||
return html_lines
|
return html_lines
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
def quote(lines):
|
||||||
|
print("wip!")
|
||||||
|
print(lines)
|
||||||
|
|
||||||
|
return lines
|
||||||
|
|
||||||
|
|
||||||
#============================#
|
#============================#
|
||||||
# code #
|
# code #
|
||||||
# Used by check module that #
|
# Used by check module that #
|
||||||
|
|
Loading…
Reference in New Issue