[1.9.28] - See changelog
This commit is contained in:
parent
b9a41bb8bb
commit
b6730f2f77
12
CHANGELOG.md
12
CHANGELOG.md
|
@ -9,6 +9,18 @@ Tyto - Littérateur
|
||||||
|
|
||||||
# CURRENTLY IN DEV !
|
# CURRENTLY IN DEV !
|
||||||
|
|
||||||
|
## [1.9.28]
|
||||||
|
- readme
|
||||||
|
- - updated tyto article, with comments to show how to
|
||||||
|
- multiple targets
|
||||||
|
- - fix CSS classe name error
|
||||||
|
- - reset stats, post.error, HEADERS datas
|
||||||
|
- check process:
|
||||||
|
- - Added hr and br tags (CSS class name check)
|
||||||
|
- - fix blockquote title HTML
|
||||||
|
- - New method to split separator in article
|
||||||
|
- - fix icode, bcode contents HTML signs (converted)
|
||||||
|
|
||||||
## [1.9.27]
|
## [1.9.27]
|
||||||
- fix when target article .tyto is missing
|
- fix when target article .tyto is missing
|
||||||
- Nearly all stats are added in DB from modules
|
- Nearly all stats are added in DB from modules
|
||||||
|
|
145
README.md
145
README.md
|
@ -18,17 +18,24 @@ tyto
|
||||||
|
|
||||||
## Exemple d'article
|
## Exemple d'article
|
||||||
```
|
```
|
||||||
Pour ne pas inclure cet article dans les sitemaps :
|
#================================================#
|
||||||
|
# Entete de l'article #
|
||||||
|
# Fin de l'entête avec au moins 5 tirets "-----" #
|
||||||
|
# Toute ligne de commentaire "# ..." est ignorée #
|
||||||
|
#================================================#
|
||||||
|
|
||||||
|
# Pour ne pas inclure cet article dans les sitemaps :
|
||||||
! NoSitemap
|
! NoSitemap
|
||||||
|
|
||||||
|
# Données uniques sur UNE ligne
|
||||||
title: tests d'un article
|
title: tests d'un article
|
||||||
about: À propos de cet article de test
|
about: À propos de cet article de test
|
||||||
tags: hello, my big world,here
|
tags: Tyto, tuto,
|
||||||
author: echolib
|
author: echolib
|
||||||
date: 2023-09-30
|
date: 2023-10-27
|
||||||
logo: /testimg/hi.png
|
|
||||||
|
|
||||||
link: Lien à reprendre
|
# Données multiple sur 3 lignes
|
||||||
|
link: cliquer sur ce Lien
|
||||||
https://
|
https://
|
||||||
Text alternatif
|
Text alternatif
|
||||||
|
|
||||||
|
@ -36,89 +43,99 @@ link: Réservez ici
|
||||||
https://
|
https://
|
||||||
Billets
|
Billets
|
||||||
|
|
||||||
file: voir l'image
|
|
||||||
PNGs/hi.png
|
|
||||||
Un png !
|
|
||||||
|
|
||||||
image: MyCar
|
|
||||||
PNGs/hi.png
|
|
||||||
Un png !
|
|
||||||
|
|
||||||
file: télécharger ce fichier
|
file: télécharger ce fichier
|
||||||
@PDFs/hello.pdf
|
@/PDFs/hello.pdf
|
||||||
Un PDF !
|
Un PDF !
|
||||||
|
|
||||||
abbr: css
|
|
||||||
Cascading StyleSheet
|
|
||||||
CSS
|
|
||||||
|
|
||||||
abbr: HTML
|
|
||||||
Hyper Text Markup Langage
|
|
||||||
HTML
|
|
||||||
|
|
||||||
code: test
|
|
||||||
@RAWS/test.py
|
|
||||||
Du code à afficher en HTML
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
#=====================================================================#
|
||||||
|
# Contenu de l'article #
|
||||||
|
# Les classe optionnelles non renseignées deviennent celle du domaine #
|
||||||
|
#=====================================================================#
|
||||||
|
|
||||||
# La ligne suivante est un commentaire HTML "<!-- Commentaire -->"
|
# La ligne suivante est un commentaire HTML "<!-- Commentaire -->"
|
||||||
;; Commentaire
|
;; Commentaire
|
||||||
|
|
||||||
|
# Ceci est une ancre avec l'ID uniq1 (ID unique)
|
||||||
|
-> uniq1
|
||||||
-> top
|
-> top
|
||||||
|
|
||||||
|
# Créer un lien vers l'ancre "uniq1"
|
||||||
|
>_uniq1: Go to uniq1 anchor_<
|
||||||
|
|
||||||
|
# Ceci est une ligne <hr> ayant pour classe hrcss
|
||||||
|
-- hrcss
|
||||||
|
|
||||||
|
# Les Titres de l'article de #1 à #5 (<h2> à <h6>)
|
||||||
#1 Titre en h2
|
#1 Titre en h2
|
||||||
|
|
||||||
|
# Contenu dans un paragraphe ayant pour classe "mypar"
|
||||||
|
(( mypar
|
||||||
|
Un long paragraphe...
|
||||||
|
|
||||||
|
# Retour à la ligne avec un <br /> de classe brcss
|
||||||
|
# (les retours à la ligne vides ne sont pas pris en compte)
|
||||||
|
| brcss
|
||||||
|
|
||||||
|
Il faut __cliquer sur ce Lien, __Réservez ici et --télécharger ce fichier
|
||||||
|
ou encore faire une ::CSS pour du beau rendu ::HTML
|
||||||
|
|
||||||
|
# Un paragraphe dans le paragraphe ayant pour classe, celle du domaine
|
||||||
((
|
((
|
||||||
;; HTML comment
|
Un /_court_/ paragraphe de :_1984_: pour de ~_vrai_~ +_faux en gras_+
|
||||||
# Show logo set in header, using '_image:logo'
|
Il faut le ._souligner_. et *_Très Gras_*
|
||||||
_image:logo tyto_logo w=120
|
|
||||||
))
|
))
|
||||||
|
|
||||||
-> newtitle
|
# Créer un icode (utiliser la balise <code>)
|
||||||
#2 Titre en h3 décalé dans le texte
|
# /!\ ! Doit être sur une ligne
|
||||||
((
|
{_<ol>, <ul>_}
|
||||||
Parce que c'est *_bien_* comme /_présentation_/ *_erreur
|
|
||||||
ou pas, si fermé_*
|
|
||||||
/_ ;_echolib_; _/
|
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
((
|
#2 Un exemple de block code ayant pour classe python
|
||||||
Il /_faut_/ ce __Lien à reprendre et __Réservez ici et --télécharger ce fichier
|
# Tout contenu entre les marqueurs "{{" et "}}" est conservé
|
||||||
ou encore faire une ::css pour du ::HTML. __Réservez ici et --voir l'image
|
{{ python
|
||||||
|
# Un commentaire et du code
|
||||||
icode 1 : {_hello(_world_)_}, icode 2 : {_print("")_}
|
def hello(world):
|
||||||
icode 3 : {_{__}_}, icode 4 : {_echo "Hello"_}
|
world and print(world) or print("NoMore")
|
||||||
))
|
|
||||||
|
|
||||||
((
|
|
||||||
_image:MyCar
|
|
||||||
<: mylist
|
|
||||||
+ Item 1
|
|
||||||
++ Sub-Item 1
|
|
||||||
+++ Sub-Sub-item 1
|
|
||||||
==== >_top: Go to Top_<
|
|
||||||
==== >_top: Another anchor_<
|
|
||||||
:>
|
|
||||||
))
|
|
||||||
|
|
||||||
_code:test
|
|
||||||
{{
|
|
||||||
# Du code brut pour Tyto
|
|
||||||
{{
|
|
||||||
Un exemple de code
|
|
||||||
}}
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
[[
|
#2 Citation
|
||||||
["
|
# Dans un block div [[ ... ]] (classe CSS mydiv),
|
||||||
|
# La citation entre [" ... "] (classe CSS mycite)
|
||||||
|
# est placée dans un paragraphe (classe CSS mycite)
|
||||||
|
# ! Tout commentaire "# ..." dans la citation sera affiché...
|
||||||
|
[[ mydiv
|
||||||
|
[" mycite
|
||||||
;; A great quote here !
|
;; A great quote here !
|
||||||
cite: Someone
|
cite: Someone
|
||||||
date: 2023-10-13
|
date: 2023-10-13
|
||||||
book: A History
|
book: A History
|
||||||
lang: EN
|
lang: en
|
||||||
link: https://...
|
link: https://...
|
||||||
|
|
||||||
((
|
(( mycite
|
||||||
Here, i am
|
Here, i am
|
||||||
))
|
))
|
||||||
"]
|
"]
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
# Créer une liste ol/ul entre <: ... :> (classe mylist)
|
||||||
|
# dans un paragraphe (classe du domaine)
|
||||||
|
# "+" pour ol, "=" pour ul
|
||||||
|
# Ajouter toujours un signe pour un sous-item ou /!\ au changement de signe
|
||||||
|
#2 Une liste mixée {_<ol>, <ul>_}
|
||||||
|
((
|
||||||
|
<: mylist
|
||||||
|
+ numeric o: item 1
|
||||||
|
++ numeric ol sub-Item 1
|
||||||
|
+++ numeric ol sub-sub-item 1
|
||||||
|
==== ul item >_top: Go to Top_<
|
||||||
|
==== ul item >_top: Another anchor_<
|
||||||
|
:>
|
||||||
|
))
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Version: 1.9.27
|
# Version: 1.9.28
|
||||||
# Updated: 2023-10-18 1697613100
|
# Updated: 2023-10-18 1697613100
|
||||||
# Tyto - Littérateur
|
# Tyto - Littérateur
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -71,19 +71,19 @@ def manage(action, target):
|
||||||
# Also used with multiple (loop) #
|
# Also used with multiple (loop) #
|
||||||
#--------------------------------#
|
#--------------------------------#
|
||||||
def is_article(target):
|
def is_article(target):
|
||||||
if not valid(target):
|
if not valid(target) or post.error != 0:
|
||||||
if targets: return
|
if targets: return
|
||||||
else: sys.exit(post.error)
|
else: sys.exit(post.error)
|
||||||
|
|
||||||
# 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("after")
|
cf_update_values("after")
|
||||||
|
|
||||||
|
@ -104,6 +104,36 @@ def valid(target):
|
||||||
post.error = debug.out(210, post.chk_date, post.uri, True, 0, False)
|
post.error = debug.out(210, post.chk_date, post.uri, True, 0, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Reset: must be done only when multiple targets
|
||||||
|
if targets:
|
||||||
|
post.title = ("title:", False)
|
||||||
|
post.about = ("about:", False)
|
||||||
|
post.date = ("date:", False)
|
||||||
|
post.tags = ("tags:", False)
|
||||||
|
post.author = ("author:", False)
|
||||||
|
post.logo = ("logo:", False) # optional
|
||||||
|
|
||||||
|
post.stats_bcodes = 0
|
||||||
|
post.stats_quotes = 0
|
||||||
|
post.stats_parags = 0
|
||||||
|
post.stats_lists = 0
|
||||||
|
post.stats_divs = 0
|
||||||
|
|
||||||
|
post.stats_links = 0
|
||||||
|
post.stats_images = 0
|
||||||
|
post.stats_files = 0
|
||||||
|
post.stats_raws = 0
|
||||||
|
post.stats_codes = 0
|
||||||
|
post.stats_abbrs = 0
|
||||||
|
|
||||||
|
post.stats_text_links = 0
|
||||||
|
post.stats_text_files = 0
|
||||||
|
post.stats_text_images = 0
|
||||||
|
post.stats_text_abbrs = 0
|
||||||
|
post.stats_text_codes = 0
|
||||||
|
post.stats_text_raws = 0
|
||||||
|
post.error = 0
|
||||||
|
|
||||||
# Reset post database (Old values are prepared)
|
# Reset post database (Old values are prepared)
|
||||||
tools.create_file(post.cf_uri, post.ini_template)
|
tools.create_file(post.cf_uri, post.ini_template)
|
||||||
post.cf_load()
|
post.cf_load()
|
||||||
|
@ -168,6 +198,8 @@ def valid(target):
|
||||||
post.error == 0 and sl_ptags(post.ptags[4]) \
|
post.error == 0 and sl_ptags(post.ptags[4]) \
|
||||||
or tools.exit(targets, post.error)
|
or tools.exit(targets, post.error)
|
||||||
|
|
||||||
|
post.error > 0 and tools.exit(targets, post.error)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,6 +224,7 @@ def ol_tags():
|
||||||
stats_total_files = 0
|
stats_total_files = 0
|
||||||
sitemap = "True"
|
sitemap = "True"
|
||||||
stats_tyto_head_coms = 0
|
stats_tyto_head_coms = 0
|
||||||
|
|
||||||
for ln, line in enumerate(headers, 1):
|
for ln, line in enumerate(headers, 1):
|
||||||
|
|
||||||
# Optional one line markers
|
# Optional one line markers
|
||||||
|
@ -568,6 +601,9 @@ def sl_ptags(markers):
|
||||||
), post.uri, True, 2, False)
|
), post.uri, True, 2, False)
|
||||||
return False
|
return False
|
||||||
continue
|
continue
|
||||||
|
csstest = tools.get_css(line, markers[0], ln)
|
||||||
|
if post.error > 0:
|
||||||
|
return
|
||||||
index0 = line.index(markers[0][0])
|
index0 = line.index(markers[0][0])
|
||||||
tag_ln = ln
|
tag_ln = ln
|
||||||
content = line
|
content = line
|
||||||
|
@ -578,8 +614,8 @@ def sl_ptags(markers):
|
||||||
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) %s...'%(
|
debug.out(53, '%s) %s: %s...'%(
|
||||||
markers[2], ln, markers[0]
|
ln, markers[2], 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])
|
||||||
|
@ -607,7 +643,7 @@ def sl_ptags(markers):
|
||||||
markers[2].upper(),
|
markers[2].upper(),
|
||||||
"html_%s"%post.ptags_stats[markers[2]],
|
"html_%s"%post.ptags_stats[markers[2]],
|
||||||
tools.b64_convert("encode",
|
tools.b64_convert("encode",
|
||||||
convert[markers[2]](content)
|
convert[markers[2]](content, ln)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -619,29 +655,28 @@ def sl_ptags(markers):
|
||||||
# ----------------------
|
# ----------------------
|
||||||
if index1 >= 0 and index0 < 0:
|
if index1 >= 0 and index0 < 0:
|
||||||
post.error = \
|
post.error = \
|
||||||
debug.out(53, '%s: %s) %s...'%(
|
debug.out(53, '%s) %s: %s...'%(
|
||||||
markers[2], tag_ln, markers[0]
|
tag_ln, markers[2], markers[0]
|
||||||
), post.uri, True,2, False)
|
), 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) ...%s'%(
|
debug.out(53, '%s) %s: ...%s'%(
|
||||||
markers[2], tag_ln, markers[1]
|
tag_ln, markers[2], markers[1]
|
||||||
), post.uri, True,2, False)
|
), 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...%s'%(
|
debug.out(53, '%s) %s: %s...%s'%(
|
||||||
markers[2], tag_ln, markers[0], markers[1]
|
tag_ln, markers[2], markers[0], markers[1]
|
||||||
), post.uri, True,2, False)
|
), post.uri, True,2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#==========================================#
|
#==========================================#
|
||||||
# icodes (SAME LINE) #
|
# icodes (SAME LINE) #
|
||||||
# Check if opened and closed markers match #
|
# Check if opened and closed markers match #
|
||||||
|
@ -697,8 +732,13 @@ def icodes():
|
||||||
|
|
||||||
for icode in icodes:
|
for icode in icodes:
|
||||||
stats_text_icodes += 1
|
stats_text_icodes += 1
|
||||||
icnew = markers[0][4] + icode + markers[0][5]
|
icnew = markers[0][4] + \
|
||||||
line = line.replace(icnew, "")
|
tools.convert_html_signs(icode) + \
|
||||||
|
markers[0][5]
|
||||||
|
icrep = markers[0][4] + \
|
||||||
|
icode + \
|
||||||
|
markers[0][5]
|
||||||
|
line = line.replace(icrep, "")
|
||||||
|
|
||||||
# Set HTML [ICODES] to post database
|
# Set HTML [ICODES] to post database
|
||||||
html_val = icnew.replace(markers[0][4], markers[0][2]%css)
|
html_val = icnew.replace(markers[0][4], markers[0][2]%css)
|
||||||
|
@ -720,8 +760,13 @@ def icodes():
|
||||||
|
|
||||||
for icode in icodes:
|
for icode in icodes:
|
||||||
stats_text_icodes += 1
|
stats_text_icodes += 1
|
||||||
icnew = markers[1][4] + icode + markers[1][5]
|
icnew = markers[1][4] + \
|
||||||
line = line.replace(icnew, "")
|
tools.convert_html_signs(icode) + \
|
||||||
|
markers[1][5]
|
||||||
|
icrep = markers[1][4] + \
|
||||||
|
icode + \
|
||||||
|
markers[1][5]
|
||||||
|
line = line.replace(icrep, "")
|
||||||
|
|
||||||
# Set HTML [ICODES] to post database
|
# Set HTML [ICODES] to post database
|
||||||
html_val = icnew.replace(markers[1][4], markers[1][2]%css)
|
html_val = icnew.replace(markers[1][4], markers[1][2]%css)
|
||||||
|
@ -761,7 +806,7 @@ def sl_stags():
|
||||||
for ln, line in enumerate(texts, post.head_lines + 1):
|
for ln, line in enumerate(texts, post.head_lines + 1):
|
||||||
linels = line.lstrip()
|
linels = line.lstrip()
|
||||||
|
|
||||||
# legacy Tyto Titles
|
# Tyto Titles
|
||||||
if linels.startswith(post.tyto_titles):
|
if linels.startswith(post.tyto_titles):
|
||||||
if not linels[3:]:
|
if not linels[3:]:
|
||||||
post.error = \
|
post.error = \
|
||||||
|
@ -832,10 +877,18 @@ def sl_stags():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# BR line
|
||||||
|
elif line.lstrip().startswith(post.html_brline[0]):
|
||||||
|
brcss = tools.get_css(line, post.html_brline[0], ln)
|
||||||
|
|
||||||
|
# HR line
|
||||||
|
elif line.lstrip().startswith(post.html_hrline[0]):
|
||||||
|
hrcss = tools.get_css(line, post.html_hrline[0], ln)
|
||||||
|
|
||||||
|
|
||||||
# Anchor source
|
# Anchor source
|
||||||
elif line.lstrip().startswith(post.anchor_target[0]):
|
elif line.lstrip().startswith(post.anchor_target[0]):
|
||||||
anchor_id = tools.get_css(line, post.anchor_target[0])
|
anchor_id = tools.get_css(line, post.anchor_target[0], ln)
|
||||||
if anchor_id in anchors_ids:
|
if anchor_id in anchors_ids:
|
||||||
post_error = \
|
post_error = \
|
||||||
debug.out(54, '%s) "%s"'%(ln, anchor_id), post.uri, True, 2, False)
|
debug.out(54, '%s) "%s"'%(ln, anchor_id), post.uri, True, 2, False)
|
||||||
|
|
|
@ -99,16 +99,36 @@ def is_tyto_format():
|
||||||
global head_lines, text_lines, lines
|
global head_lines, text_lines, lines
|
||||||
|
|
||||||
head_contents = text_contents = ""
|
head_contents = text_contents = ""
|
||||||
|
separator = False
|
||||||
|
|
||||||
with open(uri, "r") as contents:
|
with open(uri, "r") as contents:
|
||||||
contents = contents.read()
|
contents = contents.read()
|
||||||
try:
|
for line in contents.rsplit("\n"):
|
||||||
head_contents = contents.rsplit(sep)[0]
|
if not line:
|
||||||
text_contents = contents.rsplit(sep)[1]
|
line = " "
|
||||||
except:
|
|
||||||
|
if line.startswith(sep):
|
||||||
|
separator = True
|
||||||
|
continue
|
||||||
|
|
||||||
|
if separator:
|
||||||
|
if not text_contents: text_contents = line
|
||||||
|
else: text_contents = "%s\n%s"%(text_contents, line)
|
||||||
|
else:
|
||||||
|
if not head_contents: head_contents = line
|
||||||
|
else: head_contents = "%s\n%s"%(head_contents, line)
|
||||||
|
|
||||||
|
|
||||||
|
if not separator:
|
||||||
error = debug.out(21, sep, uri, True, 2, False)
|
error = debug.out(21, sep, uri, True, 2, False)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
print("===")
|
||||||
|
print(head_contents)
|
||||||
|
print("===")
|
||||||
|
print(text_contents)
|
||||||
|
print("===")
|
||||||
|
|
||||||
if not head_contents:
|
if not head_contents:
|
||||||
error = debug.out(22, "?", uri, True, 2, False)
|
error = debug.out(22, "?", uri, True, 2, False)
|
||||||
return False
|
return False
|
||||||
|
@ -118,7 +138,7 @@ def is_tyto_format():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
lines = len(contents.splitlines())
|
lines = len(contents.splitlines())
|
||||||
head_lines = len(head_contents.splitlines())
|
head_lines = len(head_contents.splitlines()) + 1 # Count with sep line
|
||||||
text_lines = len(text_contents.splitlines())
|
text_lines = len(text_contents.splitlines())
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -301,7 +321,7 @@ nositemap = "! NoSitemap" # Article will not be included in sitemap
|
||||||
# One Line needed
|
# One Line needed
|
||||||
sep = "-----" # Splitter between header and article texts
|
sep = "-----" # Splitter between header and article texts
|
||||||
|
|
||||||
# Will replace "Fals" with title value
|
# Will replace "Fals" with data value
|
||||||
title = ("title:", False)
|
title = ("title:", False)
|
||||||
about = ("about:", False)
|
about = ("about:", False)
|
||||||
date = ("date:", False)
|
date = ("date:", False)
|
||||||
|
@ -310,22 +330,29 @@ author = ("author:", False)
|
||||||
logo = ("logo:", False) # optional
|
logo = ("logo:", False) # optional
|
||||||
|
|
||||||
# Multiple lines (3) markers
|
# Multiple lines (3) markers
|
||||||
ml_tags = ("link:", "image:", "file:", "raw:", "code:", "abbr:")
|
ml_tags = (
|
||||||
|
"link:",
|
||||||
|
"image:",
|
||||||
|
"file:",
|
||||||
|
"raw:",
|
||||||
|
"code:",
|
||||||
|
"abbr:"
|
||||||
|
)
|
||||||
ml_tags_marks = {
|
ml_tags_marks = {
|
||||||
"link:" : "__",
|
ml_tags[0] : "__",
|
||||||
"file:" : "--",
|
ml_tags[2] : "--",
|
||||||
"image:" : "_image:",
|
ml_tags[1] : "_image:",
|
||||||
"abbr:" : "::",
|
ml_tags[5] : "::",
|
||||||
"raw:" : "_raw:",
|
ml_tags[3] : "_raw:",
|
||||||
"code:" : "_code:"
|
ml_tags[4] : "_code:"
|
||||||
}
|
}
|
||||||
ml_tags_stats = {
|
ml_tags_stats = {
|
||||||
"link:" : stats_links,
|
ml_tags[0] : stats_links,
|
||||||
"file:" : stats_files,
|
ml_tags[2] : stats_files,
|
||||||
"image:" : stats_images,
|
ml_tags[1] : stats_images,
|
||||||
"abbr:" : stats_abbrs,
|
ml_tags[5] : stats_abbrs,
|
||||||
"raw:" : stats_raws,
|
ml_tags[3] : stats_raws,
|
||||||
"code:" : stats_codes,
|
ml_tags[4] : stats_codes,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Markers with uri in value2
|
# Markers with uri in value2
|
||||||
|
@ -344,11 +371,11 @@ ptags = (
|
||||||
)
|
)
|
||||||
|
|
||||||
ptags_stats = {
|
ptags_stats = {
|
||||||
"bcodes" : stats_bcodes,
|
ptags[0][2] : stats_bcodes,
|
||||||
"quotes" : stats_quotes,
|
ptags[1][2] : stats_quotes,
|
||||||
"parags" : stats_parags,
|
ptags[2][2] : stats_parags,
|
||||||
"lists" : stats_lists,
|
ptags[3][2] : stats_lists,
|
||||||
"divs" : stats_divs,
|
ptags[4][2] : stats_divs,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tyto Titles #1 = <h2>
|
# Tyto Titles #1 = <h2>
|
||||||
|
|
|
@ -36,6 +36,8 @@ from hashlib import blake2b
|
||||||
import sys, os, configparser, datetime, time, base64
|
import sys, os, configparser, datetime, time, base64
|
||||||
import debug, domain, post
|
import debug, domain, post
|
||||||
|
|
||||||
|
import post
|
||||||
|
|
||||||
|
|
||||||
#=========================================#
|
#=========================================#
|
||||||
# Write to post database, error was found #
|
# Write to post database, error was found #
|
||||||
|
@ -46,7 +48,8 @@ def exit(targets, error):
|
||||||
post.cf_set("CHECK", "errors", "True")
|
post.cf_set("CHECK", "errors", "True")
|
||||||
post.cf_write()
|
post.cf_write()
|
||||||
|
|
||||||
if targets: return
|
if targets:
|
||||||
|
return
|
||||||
|
|
||||||
sys.exit(error)
|
sys.exit(error)
|
||||||
|
|
||||||
|
@ -192,7 +195,7 @@ def b64_convert(action, content):
|
||||||
def convert_html_signs(string):
|
def convert_html_signs(string):
|
||||||
string = string.replace('<', '<')
|
string = string.replace('<', '<')
|
||||||
string = string.replace('>', '>')
|
string = string.replace('>', '>')
|
||||||
astring = string.replace('"', '"')
|
string = string.replace('"', '"')
|
||||||
string = string.replace("'", ''')
|
string = string.replace("'", ''')
|
||||||
|
|
||||||
return string
|
return string
|
||||||
|
@ -203,13 +206,15 @@ def convert_html_signs(string):
|
||||||
# Only take the first name #
|
# Only take the first name #
|
||||||
# Exit all process if _... #
|
# Exit all process if _... #
|
||||||
#--------------------------#
|
#--------------------------#
|
||||||
def get_css(line, mark):
|
def get_css(line, mark, ln):
|
||||||
css = line.rsplit(mark)[1].lstrip().rsplit(" ")[0]
|
css = line.rsplit(mark)[1].lstrip().rsplit(" ")[0]
|
||||||
css = css or domain.css
|
css = css or domain.css
|
||||||
|
|
||||||
# Tyto use _abc as markers
|
# Tyto use _abc as markers
|
||||||
if css.startswith("_"):
|
if css.startswith("_"):
|
||||||
debug.out(56, "'_...' (CSS: %s)"%css, post.uri, True, 2, True)
|
post.error = \
|
||||||
|
debug.out(56, '%s) CSS: "%s"'%(ln, css), post.uri, True, 2, False)
|
||||||
|
return "NameError"
|
||||||
|
|
||||||
return css
|
return css
|
||||||
|
|
||||||
|
|
|
@ -46,13 +46,13 @@ import tyto, tools, post, domain
|
||||||
# Create HTML bcode #
|
# Create HTML bcode #
|
||||||
# convert raw lines #
|
# convert raw lines #
|
||||||
#-------------------#
|
#-------------------#
|
||||||
def bcode(lines):
|
def bcode(lines, ln):
|
||||||
lines = lines.rsplit("\n")
|
lines = lines.rsplit("\n")
|
||||||
html_bcode = ""
|
html_bcode = ""
|
||||||
|
|
||||||
for ln, line in enumerate(lines):
|
for ln, line in enumerate(lines):
|
||||||
if ln == 0: # Opened marker
|
if ln == 0: # Opened marker
|
||||||
css = tools.get_css(line, post.ptags[0][0])
|
css = tools.get_css(line, post.ptags[0][0], ln)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if ln == len(lines) - 1: # Closed marker
|
if ln == len(lines) - 1: # Closed marker
|
||||||
|
@ -65,7 +65,7 @@ def bcode(lines):
|
||||||
if ln == 1:
|
if ln == 1:
|
||||||
fc = len(line) - len(line.lstrip())
|
fc = len(line) - len(line.lstrip())
|
||||||
|
|
||||||
line = tyto.code_line%(ln, line[fc:])
|
line = tyto.code_line%(ln, tools.convert_html_signs(line[fc:]))
|
||||||
if not html_bcode: html_bcode = line
|
if not html_bcode: html_bcode = line
|
||||||
else: html_bcode = "%s\n%s"%(html_bcode, line)
|
else: html_bcode = "%s\n%s"%(html_bcode, line)
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ def bcode(lines):
|
||||||
# Create HTML quote #
|
# Create HTML quote #
|
||||||
# convert raw lines #
|
# convert raw lines #
|
||||||
#-------------------#
|
#-------------------#
|
||||||
def quote(lines):
|
def quote(lines, ln):
|
||||||
lines = lines.rsplit("\n")
|
lines = lines.rsplit("\n")
|
||||||
# Template
|
# Template
|
||||||
html_quote = "<!-- Quote -->"
|
html_quote = "<!-- Quote -->"
|
||||||
|
@ -98,7 +98,7 @@ def quote(lines):
|
||||||
|
|
||||||
# Open Marker (Unused in HTML). Get user CSS class
|
# Open Marker (Unused in HTML). Get user CSS class
|
||||||
if ln == 0:
|
if ln == 0:
|
||||||
css = tools.get_css(line, post.ptags[1][0])
|
css = tools.get_css(line, post.ptags[1][0], ln)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Closed marker (Unused in HTML)
|
# Closed marker (Unused in HTML)
|
||||||
|
@ -140,8 +140,13 @@ def quote(lines):
|
||||||
blockquote_lang = ' lang="%s"'%lang
|
blockquote_lang = ' lang="%s"'%lang
|
||||||
|
|
||||||
# <footer> tag
|
# <footer> tag
|
||||||
if book: footer_book = ' - <cite class="quote">%s</cite>'%book
|
if book:
|
||||||
if cite: footer_cite = '-- %s'%cite
|
book = " - %s"%book
|
||||||
|
footer_book = ' - <cite class="quote">%s</cite>'%book
|
||||||
|
|
||||||
|
if cite:
|
||||||
|
footer_cite = '-- %s'%cite
|
||||||
|
|
||||||
if date:
|
if date:
|
||||||
footer_date = ' (%s)'%date
|
footer_date = ' (%s)'%date
|
||||||
block_time_on = '\n<time datetime="%s">'%date
|
block_time_on = '\n<time datetime="%s">'%date
|
||||||
|
@ -149,7 +154,7 @@ def quote(lines):
|
||||||
|
|
||||||
if date or book or cite:
|
if date or book or cite:
|
||||||
blockquote_title = ' title="%s%s%s"'%(
|
blockquote_title = ' title="%s%s%s"'%(
|
||||||
footer_cite, footer_book, footer_date
|
footer_cite, book, footer_date
|
||||||
)
|
)
|
||||||
footer = '<footer class="quote">\n' + \
|
footer = '<footer class="quote">\n' + \
|
||||||
'<p class="quote">' + \
|
'<p class="quote">' + \
|
||||||
|
@ -174,7 +179,7 @@ def quote(lines):
|
||||||
# Create HTML list #
|
# Create HTML list #
|
||||||
# convert raw lines #
|
# convert raw lines #
|
||||||
#-------------------#
|
#-------------------#
|
||||||
def list(lines):
|
def list(lines, ln):
|
||||||
lines = lines.rsplit("\n")
|
lines = lines.rsplit("\n")
|
||||||
|
|
||||||
list_raw = ""
|
list_raw = ""
|
||||||
|
@ -184,7 +189,7 @@ def list(lines):
|
||||||
|
|
||||||
# Open Marker (Unused in HTML). Get user CSS class
|
# Open Marker (Unused in HTML). Get user CSS class
|
||||||
if ln == 0:
|
if ln == 0:
|
||||||
css = tools.get_css(line, post.ptags[3][0])
|
css = tools.get_css(line, post.ptags[3][0], ln)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Closed marker (Unused in HTML)
|
# Closed marker (Unused in HTML)
|
||||||
|
|
Loading…
Reference in New Issue