From 00c6a4bebc32b9aa35338f9b5266629d30489467 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 28 Jun 2022 22:56:48 +0200 Subject: [PATCH] Version 0.1.9 --- CHANGELOG.md | 17 + README.md | 7 +- control | 4 +- etc/gsl/gsl.conf | 48 ++- help/comment_ecrire-article.md | 55 +-- help/gsl_help.md | 1 + help/how-to_CSS_classes.md | 8 +- new-version.md | 28 +- usr/local/bin/gsl | 2 +- var/lib/gsl/CHANGELOG.md | 17 + var/lib/gsl/README.md | 7 +- var/lib/gsl/help/comment_ecrire-article.md | 55 +-- var/lib/gsl/help/gsl_help.md | 1 + var/lib/gsl/help/how-to_CSS_classes.md | 8 +- var/lib/gsl/new-version.md | 28 +- var/lib/gsl/scripts/gsl__HTML_template | 7 +- var/lib/gsl/scripts/gsl__db_manager | 1 + var/lib/gsl/scripts/gsl__domain_manager | 26 +- var/lib/gsl/scripts/gsl__post_checkers | 374 ++++++++++++--------- var/lib/gsl/scripts/gsl__post_makers | 285 ++++++++++++---- var/lib/gsl/scripts/gsl__post_manager | 68 +--- 21 files changed, 638 insertions(+), 409 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7d96fc..5d3e70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ GSL changes from releases. You can send an issue : - repo: https://git.a-lec.org/echolib/gsl/-/issues - Contact xmpp: im@echolib.re +## [0.1.9] +### Added: +- gawk dependance + +### Changes +- date: Format YYYY-MM-DD (in RAW article only) +- - new page|post follows this rule +- HTML markers +- - strong: '¤' +- - Inline-code: '`' +- - Bold: '*' +- - Emphasis: '\' +- - Cross: '×' ; was strike. Use it to customize your text with CSS +- - del: '~' +- new article creator ; gsl new page 404 + + ## [0.1.8] - fix: logs field from sidebar - Add: abbr 3rd field value. If set output HTML in lower case diff --git a/README.md b/README.md index b435703..ee5bb72 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ facilement configuré pour interprêter ce module. - bash - coreutils -- curl (to check Posts links response) -- rsync, nano +- curl (to check links response in articles) +- rsync, nano, gawk # GSL: Installation @@ -116,7 +116,7 @@ gsl sidebar add 3 monarticle.gsl ## Astuces - Vous pouvez utiliser l'autocompletion pour les articles -- Reportez-vous à la documentation dans le dossier Help +- Lisez les fichiers de la documentation dans le dossier Help ``` gsl www add mona @@ -143,6 +143,7 @@ $ gsl (ARG) domain : Configure your DOMAIN author : Same as gsl author edit (TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl + : (TYPE) can be 'page' or 'post' setdir | -D : Show current directory DOMAIN or set it diff --git a/control b/control index fff96bb..28648b4 100644 --- a/control +++ b/control @@ -1,10 +1,10 @@ Package: egsl -Version: 0.1.8 +Version: 0.1.9 Section: custom Priority: optional Architecture: all Essential: no -Depends: curl,rsync,nano +Depends: curl,rsync,nano,gawk Installed-Size: `du -ks usr|cut -f 1` Maintainer: echolib Description: Echolib's GSL is a multiple blogs/websites generator based on their domain, written in bash, for minimal dependancies. The websites are nearly all static, except for some includes pages, like listing posts, that nginx can easily get, in your webserver. diff --git a/etc/gsl/gsl.conf b/etc/gsl/gsl.conf index fa35e5d..07d213a 100644 --- a/etc/gsl/gsl.conf +++ b/etc/gsl/gsl.conf @@ -12,6 +12,7 @@ gsl_article_min_Size=180 # Show log by time|level (default: 'time'); not set = level gsl_log_order=time + #---------------------------------------------------------------------- # # Directories Structure #---------------------------------------------------------------------- @@ -25,6 +26,7 @@ gsl_dir_logs="/var/log/gsl" gsl_dir_domains="$gsl_dir_lib/domains" gsl_dir_db="$gsl_dir_lib/db" + #====================================================================== # iNSTALLATION DEPENDANCIES #====================================================================== @@ -69,6 +71,7 @@ $gsl_dir_db $gsl_dir_logs ) + #======================================================================= # Files #======================================================================= @@ -80,6 +83,7 @@ NC="\e[0m" CY="\e[33m" CR="\e[0;91m" + #---------------------------------------------------------------------- # LOGS settings #---------------------------------------------------------------------- @@ -98,6 +102,7 @@ gsl_log_act_image='NBR : FILENAME : ALT TEXT' gsl_log_act_abbr='SHORT : LONG' gsl_log_act_link='NAME : URL : Alt-Text' + #---------------------------------------------------------------------- # CONTENT Article markers #---------------------------------------------------------------------- @@ -108,14 +113,9 @@ gsl_mark_image='_image' gsl_mark_fcode='_code' gsl_mark_fbrut='_brut' gsl_mark_title='#' -gsl_mark_bold='·' -gsl_mark_strong='•' -gsl_mark_em='”' -gsl_mark_icode="¤" gsl_mark_list='=' -gsl_mark_listo="+" -gsl_mark_newline="|" -gsl_mark_strike="×" +gsl_mark_listo='+' +gsl_mark_newline='|' gsl_mark_link='_' gsl_mark_blockquote='---' gsl_mark_blockquote_cite='_cite :' @@ -124,6 +124,35 @@ gsl_mark_blockquote_link='_link :' gsl_mark_blockquote_book='_book :' gsl_mark_blockquote_lang='_lang :' + +#---------------------------------------------------------------------- +# bsis + icode +#---------------------------------------------------------------------- +gsl_mark_icode='`' +icode_start='þ' +icode_close='Ł' + +gsl_mark_bold='*' +bold_start='¶' +bold_close='ŧ' + +gsl_mark_cross='×' +cross_start='ẞ' +cross_close='Ð' + +gsl_mark_em='\' +em_start='ĸ' +em_close='ł' + +gsl_mark_strong='¤' +strong_start='Ŋ' +strong_close='Ħ' + +gsl_mark_del='~' +del_start='Ŧ' +del_close='ð' + + #---------------------------------------------------------------------- # HEADERS markers #---------------------------------------------------------------------- @@ -146,11 +175,6 @@ gsl_marker_link='link:' gsl_marker_flink='file:' # Closed HTML static code -HTML_strike_close='' -HTML_icode_close='' -HTML_em_close='"' -HTML_strong_close='' -HTML_bold_close='' HTML_br='
' HTML_p_close='

' diff --git a/help/comment_ecrire-article.md b/help/comment_ecrire-article.md index 6b7b53f..9c7ce48 100644 --- a/help/comment_ecrire-article.md +++ b/help/comment_ecrire-article.md @@ -46,8 +46,8 @@ title: POST TITLE slug: MY-SLUG (si espaces, GSL les convertira en -) info: DESCRIPTION (À propos de cet article) author: NAME (doit être enregistré via la commande: gsl author edit -date: YYYY-MM-DD (ou DD-MM-YYY si DOMAIN configuré en fr) -tags: TAG1,Mon TAG2 (séparé par une virgule) +date: YYYY-MM-DD +tags: TAG1,Mon TAG2 (séparés par une virgule) ``` ### Page ou Article ? @@ -68,10 +68,10 @@ Création HTML dans un dossier selon le slug: /MY-SLUG/index.html ``` type: post -slug: service/xmpp/configurer-gajim +slug: turoriel/xmpp/configurer-gajim ``` -## METAS optionnelles (avant ```#1```) +## METAS optionnelles Définir UN seul marqueur CSS par article pour personnaliser chaque article avec sa propre CSS. @@ -92,53 +92,60 @@ image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF ``` ## Contenu de l'article -Les marqueurs (hors listes) *et leur contenu* (ex: ```·ceci est en gras·```) +Les marqueurs (hors listes) et leur contenu (ex: ```*ceci est en gras*```) **doivent être sur la même ligne**. Les marqueurs à retenir et leur Combinaison de touches sur un clavier -azerty français +azerty français par défaut -- Très gras: '•...•' (altgr + ;) -- Gras: '·...·' (alt+gr + :) -- Italique: '”...”' (altgr + n) -- Barré: '×...×' (alt+gr + shift + ;) -- Code: '¤...¤' (altgr + $) +- Gras: ```*...*``` +- Italique: ```\...\``` +- Code en ligne: "`...`" (altgr + 7) +- Très gras: ```¤...¤``` (altgr + $) +- Barré: ```~...~``` (altgr + $) +- Personnalisé: ```×...×``` (altgr + shift + ;) ### Écrire en très gras Dans l'article... ``` -•c'est en super gras (strong)• -c'est in•défini•ssable -il ad•juge• : pas de pub ! +¤c'est en super gras (strong)¤ ``` ### Écrire en gras Dans l'article... ``` -·Texte en gras· +*Texte en gras* ``` ### Écrire en Italique Dans l'article... ``` -C'est ”en italique” +C'est \en italique\ ``` ### Créer un texte "barré" Dans l'article... ``` -La réunion aura lieu ×demain× dans une semaine +La réunion aura lieu ~demain~ dans une semaine ``` ### Écrire un Code en ligne Dans l'article... ``` -¤gsl help -w && echo "Be Happy"¤ +`gsl help -w && echo "Be Happy"` +``` + +### Personnaliser un élément via CSS +Ce marqueur permet d'appliquer un ```...``` afin +dde personnaliser une partie spécifique d'un texte ciblé grâce à ses +propriétés CSS (voir la doc CSS) +``` +Personnaliser ces ×jolis mots× ``` ### Abréviations @@ -147,10 +154,9 @@ Définir en METAS... - L'écriture longue de l'abréviation - Optionnel: valeur au choix pour forcer l'écriture HTML de "CSS" en minuscule - ``` abbr: CSS : Cascading Style Sheets -abbr: POUET : Nom donnés aux message dans le fédivers : low +abbr: POUET : Nom donnés aux messages dans le fédivers : low ``` Dans l'article: @@ -167,7 +173,7 @@ Ce POUET est chouette # Affiche "pouet" sur la page Dans l'article... ``` ( p3 -Paragraphe avec une classe p3 en css +Paragraphe avec une classe p3 en CSS ) ( @@ -247,7 +253,7 @@ Images affichées l'une à côté de l'autre ``` ( _image:1 # Image 1, taille originale, sans lien -_image:2:r:+ # Image 2 classe right, taille originale, lien local +_image:2:r:+ # Image 2, classe right, taille originale, lien local _image:3:g:640px:https://echolib.re/ # Image 3, classe left, largeur 640px, hauteur déduite, lien externe _image:4:maclass:320:200:+ # Image 4, classe maclass, largeur 320px, hauteur 200px, lien local _image:5:maclass:0:20%:https://echolib.re/ # Image 5, classe maclass, largeur déduite, hauteur 20%, lien externe @@ -305,7 +311,10 @@ Une citation simple dans un paragraphe ``` ### Citation avancée -Dans l'article... Stallman est une classe CSS +Dans l'article... + +"Stallman" est une classe CSS personnalisée + ``` --- Stallman _cite : Richard Matthew Stallman diff --git a/help/gsl_help.md b/help/gsl_help.md index 012272c..8ac5244 100644 --- a/help/gsl_help.md +++ b/help/gsl_help.md @@ -15,6 +15,7 @@ $ gsl (ARG) domain : Configure your DOMAIN author : Same as gsl author edit (TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl + : (TYPE) can be 'page' or 'post' setdir | -D : Show current directory DOMAIN or set it diff --git a/help/how-to_CSS_classes.md b/help/how-to_CSS_classes.md index d80a17e..0b113d4 100644 --- a/help/how-to_CSS_classes.md +++ b/help/how-to_CSS_classes.md @@ -23,8 +23,9 @@ X is 1 to 6 from current title - bold: xxx_bold - strong: xxx_strong - emphasis: xxx_em -- strike: xxx_strike (span) +- cross: xxx_cross (span) - inline code: xxx_icode +- del: xxx_del ### Paragraphs myclass is the content value used (i.e.```( myclass```) @@ -68,6 +69,9 @@ myclass is used on - ```
``` if "_cite" - - figure: xxx_quote-fig myclass +### Write a code in line +If you want to use "`...`" in an inline-code, replace it with ```$(...)``` + ## Sidebar Content - aside: xxx_sidebar - - div: xxx__wrapper @@ -91,5 +95,3 @@ myclass is used on - footer: xxx_footer (ID) - - div: xxx_footer-infos (ID) - - div: xxx_footer-about (ID) - - diff --git a/new-version.md b/new-version.md index 0ff326d..a57cb9c 100644 --- a/new-version.md +++ b/new-version.md @@ -1,17 +1,15 @@ -## [0.1.6] -### Fix: -- invalid argument -- site_css variable called in sidebar -- make : even if page created, article must be check if changed -- FR date on template only ; replace "-" with "/" -- Sidebar item link with add/replace +## [0.1.9] +### Added: +- gawk dependance ### Changes -- images marker in content: use external http/ftp link -- - No more needed unity: defaut "px" if not known in content marker -- - See examples output HTML in help folder (how-to_Tips_And_Advises.md) -- - See main usage in help folder (comment_ecrire_article.md) -- Ask to confirm both wip & www sync with gsl sync - -### Add -- Stats : local link from slug (/...) counted after new check if added to www +- date: Format YYYY-MM-DD (in RAW article only) +- - new page|post follows this rule +- HTML markers +- - strong: '¤' +- - Inline-code: '`' +- - Bold: '*' +- - Emphasis: '\' +- - Cross: '×' ; was strike. Use it to customize your text with CSS +- - del: '~' +- new article creator ; gsl new page 404 diff --git a/usr/local/bin/gsl b/usr/local/bin/gsl index 29c0346..c338bb3 100755 --- a/usr/local/bin/gsl +++ b/usr/local/bin/gsl @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.1.8 +# Version: 0.1.9 # file: gsl # Folder: /usr/local/bin # By echolib (XMPP: im@echolib.re) diff --git a/var/lib/gsl/CHANGELOG.md b/var/lib/gsl/CHANGELOG.md index f7d96fc..5d3e70a 100644 --- a/var/lib/gsl/CHANGELOG.md +++ b/var/lib/gsl/CHANGELOG.md @@ -4,6 +4,23 @@ GSL changes from releases. You can send an issue : - repo: https://git.a-lec.org/echolib/gsl/-/issues - Contact xmpp: im@echolib.re +## [0.1.9] +### Added: +- gawk dependance + +### Changes +- date: Format YYYY-MM-DD (in RAW article only) +- - new page|post follows this rule +- HTML markers +- - strong: '¤' +- - Inline-code: '`' +- - Bold: '*' +- - Emphasis: '\' +- - Cross: '×' ; was strike. Use it to customize your text with CSS +- - del: '~' +- new article creator ; gsl new page 404 + + ## [0.1.8] - fix: logs field from sidebar - Add: abbr 3rd field value. If set output HTML in lower case diff --git a/var/lib/gsl/README.md b/var/lib/gsl/README.md index b435703..ee5bb72 100644 --- a/var/lib/gsl/README.md +++ b/var/lib/gsl/README.md @@ -14,8 +14,8 @@ facilement configuré pour interprêter ce module. - bash - coreutils -- curl (to check Posts links response) -- rsync, nano +- curl (to check links response in articles) +- rsync, nano, gawk # GSL: Installation @@ -116,7 +116,7 @@ gsl sidebar add 3 monarticle.gsl ## Astuces - Vous pouvez utiliser l'autocompletion pour les articles -- Reportez-vous à la documentation dans le dossier Help +- Lisez les fichiers de la documentation dans le dossier Help ``` gsl www add mona @@ -143,6 +143,7 @@ $ gsl (ARG) domain : Configure your DOMAIN author : Same as gsl author edit (TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl + : (TYPE) can be 'page' or 'post' setdir | -D : Show current directory DOMAIN or set it diff --git a/var/lib/gsl/help/comment_ecrire-article.md b/var/lib/gsl/help/comment_ecrire-article.md index 6b7b53f..9c7ce48 100644 --- a/var/lib/gsl/help/comment_ecrire-article.md +++ b/var/lib/gsl/help/comment_ecrire-article.md @@ -46,8 +46,8 @@ title: POST TITLE slug: MY-SLUG (si espaces, GSL les convertira en -) info: DESCRIPTION (À propos de cet article) author: NAME (doit être enregistré via la commande: gsl author edit -date: YYYY-MM-DD (ou DD-MM-YYY si DOMAIN configuré en fr) -tags: TAG1,Mon TAG2 (séparé par une virgule) +date: YYYY-MM-DD +tags: TAG1,Mon TAG2 (séparés par une virgule) ``` ### Page ou Article ? @@ -68,10 +68,10 @@ Création HTML dans un dossier selon le slug: /MY-SLUG/index.html ``` type: post -slug: service/xmpp/configurer-gajim +slug: turoriel/xmpp/configurer-gajim ``` -## METAS optionnelles (avant ```#1```) +## METAS optionnelles Définir UN seul marqueur CSS par article pour personnaliser chaque article avec sa propre CSS. @@ -92,53 +92,60 @@ image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF ``` ## Contenu de l'article -Les marqueurs (hors listes) *et leur contenu* (ex: ```·ceci est en gras·```) +Les marqueurs (hors listes) et leur contenu (ex: ```*ceci est en gras*```) **doivent être sur la même ligne**. Les marqueurs à retenir et leur Combinaison de touches sur un clavier -azerty français +azerty français par défaut -- Très gras: '•...•' (altgr + ;) -- Gras: '·...·' (alt+gr + :) -- Italique: '”...”' (altgr + n) -- Barré: '×...×' (alt+gr + shift + ;) -- Code: '¤...¤' (altgr + $) +- Gras: ```*...*``` +- Italique: ```\...\``` +- Code en ligne: "`...`" (altgr + 7) +- Très gras: ```¤...¤``` (altgr + $) +- Barré: ```~...~``` (altgr + $) +- Personnalisé: ```×...×``` (altgr + shift + ;) ### Écrire en très gras Dans l'article... ``` -•c'est en super gras (strong)• -c'est in•défini•ssable -il ad•juge• : pas de pub ! +¤c'est en super gras (strong)¤ ``` ### Écrire en gras Dans l'article... ``` -·Texte en gras· +*Texte en gras* ``` ### Écrire en Italique Dans l'article... ``` -C'est ”en italique” +C'est \en italique\ ``` ### Créer un texte "barré" Dans l'article... ``` -La réunion aura lieu ×demain× dans une semaine +La réunion aura lieu ~demain~ dans une semaine ``` ### Écrire un Code en ligne Dans l'article... ``` -¤gsl help -w && echo "Be Happy"¤ +`gsl help -w && echo "Be Happy"` +``` + +### Personnaliser un élément via CSS +Ce marqueur permet d'appliquer un ```...``` afin +dde personnaliser une partie spécifique d'un texte ciblé grâce à ses +propriétés CSS (voir la doc CSS) +``` +Personnaliser ces ×jolis mots× ``` ### Abréviations @@ -147,10 +154,9 @@ Définir en METAS... - L'écriture longue de l'abréviation - Optionnel: valeur au choix pour forcer l'écriture HTML de "CSS" en minuscule - ``` abbr: CSS : Cascading Style Sheets -abbr: POUET : Nom donnés aux message dans le fédivers : low +abbr: POUET : Nom donnés aux messages dans le fédivers : low ``` Dans l'article: @@ -167,7 +173,7 @@ Ce POUET est chouette # Affiche "pouet" sur la page Dans l'article... ``` ( p3 -Paragraphe avec une classe p3 en css +Paragraphe avec une classe p3 en CSS ) ( @@ -247,7 +253,7 @@ Images affichées l'une à côté de l'autre ``` ( _image:1 # Image 1, taille originale, sans lien -_image:2:r:+ # Image 2 classe right, taille originale, lien local +_image:2:r:+ # Image 2, classe right, taille originale, lien local _image:3:g:640px:https://echolib.re/ # Image 3, classe left, largeur 640px, hauteur déduite, lien externe _image:4:maclass:320:200:+ # Image 4, classe maclass, largeur 320px, hauteur 200px, lien local _image:5:maclass:0:20%:https://echolib.re/ # Image 5, classe maclass, largeur déduite, hauteur 20%, lien externe @@ -305,7 +311,10 @@ Une citation simple dans un paragraphe ``` ### Citation avancée -Dans l'article... Stallman est une classe CSS +Dans l'article... + +"Stallman" est une classe CSS personnalisée + ``` --- Stallman _cite : Richard Matthew Stallman diff --git a/var/lib/gsl/help/gsl_help.md b/var/lib/gsl/help/gsl_help.md index 012272c..8ac5244 100644 --- a/var/lib/gsl/help/gsl_help.md +++ b/var/lib/gsl/help/gsl_help.md @@ -15,6 +15,7 @@ $ gsl (ARG) domain : Configure your DOMAIN author : Same as gsl author edit (TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl + : (TYPE) can be 'page' or 'post' setdir | -D : Show current directory DOMAIN or set it diff --git a/var/lib/gsl/help/how-to_CSS_classes.md b/var/lib/gsl/help/how-to_CSS_classes.md index d80a17e..0b113d4 100644 --- a/var/lib/gsl/help/how-to_CSS_classes.md +++ b/var/lib/gsl/help/how-to_CSS_classes.md @@ -23,8 +23,9 @@ X is 1 to 6 from current title - bold: xxx_bold - strong: xxx_strong - emphasis: xxx_em -- strike: xxx_strike (span) +- cross: xxx_cross (span) - inline code: xxx_icode +- del: xxx_del ### Paragraphs myclass is the content value used (i.e.```( myclass```) @@ -68,6 +69,9 @@ myclass is used on - ```
``` if "_cite" - - figure: xxx_quote-fig myclass +### Write a code in line +If you want to use "`...`" in an inline-code, replace it with ```$(...)``` + ## Sidebar Content - aside: xxx_sidebar - - div: xxx__wrapper @@ -91,5 +95,3 @@ myclass is used on - footer: xxx_footer (ID) - - div: xxx_footer-infos (ID) - - div: xxx_footer-about (ID) - - diff --git a/var/lib/gsl/new-version.md b/var/lib/gsl/new-version.md index 0ff326d..a57cb9c 100644 --- a/var/lib/gsl/new-version.md +++ b/var/lib/gsl/new-version.md @@ -1,17 +1,15 @@ -## [0.1.6] -### Fix: -- invalid argument -- site_css variable called in sidebar -- make : even if page created, article must be check if changed -- FR date on template only ; replace "-" with "/" -- Sidebar item link with add/replace +## [0.1.9] +### Added: +- gawk dependance ### Changes -- images marker in content: use external http/ftp link -- - No more needed unity: defaut "px" if not known in content marker -- - See examples output HTML in help folder (how-to_Tips_And_Advises.md) -- - See main usage in help folder (comment_ecrire_article.md) -- Ask to confirm both wip & www sync with gsl sync - -### Add -- Stats : local link from slug (/...) counted after new check if added to www +- date: Format YYYY-MM-DD (in RAW article only) +- - new page|post follows this rule +- HTML markers +- - strong: '¤' +- - Inline-code: '`' +- - Bold: '*' +- - Emphasis: '\' +- - Cross: '×' ; was strike. Use it to customize your text with CSS +- - del: '~' +- new article creator ; gsl new page 404 diff --git a/var/lib/gsl/scripts/gsl__HTML_template b/var/lib/gsl/scripts/gsl__HTML_template index 74b16be..7c7e864 100644 --- a/var/lib/gsl/scripts/gsl__HTML_template +++ b/var/lib/gsl/scripts/gsl__HTML_template @@ -84,7 +84,12 @@ if [[ `grep -i "fr" <<<"$site_lang"` ]];then gsl_by="par" gsl_read="Lire l'article de" gsl_rss_info="Tous les titres de" - gsl_date="${article_Date//-//}" + + # Convert date from INT to shit FR format (Yes, i love it...) + gsl_date_y=`awk -F- '{print $1}' <<<"$article_Date"` + gsl_date_m=`awk -F- '{print $2}' <<<"$article_Date"` + gsl_date_d=`awk -F- '{print $3}' <<<"$article_Date"` + gsl_date="$gsl_date_d/$gsl_date_m/$gsl_date_y" else gsl_welcome="Welcome page of" diff --git a/var/lib/gsl/scripts/gsl__db_manager b/var/lib/gsl/scripts/gsl__db_manager index 1680ea4..a89b944 100644 --- a/var/lib/gsl/scripts/gsl__db_manager +++ b/var/lib/gsl/scripts/gsl__db_manager @@ -209,6 +209,7 @@ stat_Strongs=$gsl_stat_strongs stat_Bolds=$gsl_stat_bolds stat_Emphasis=$gsl_stat_italics stat_Strikes=$gsl_stat_strikes +stat_Dels=$gsl_stat_dels stat_Icodes=$gsl_stat_icodes stat_Lists=$gsl_stat_lists stat_Lists_Items=$gsl_list_items diff --git a/var/lib/gsl/scripts/gsl__domain_manager b/var/lib/gsl/scripts/gsl__domain_manager index 52884a5..ce2eb6e 100644 --- a/var/lib/gsl/scripts/gsl__domain_manager +++ b/var/lib/gsl/scripts/gsl__domain_manager @@ -158,7 +158,6 @@ gsl_dir_srv_www="$site_server/$site_ndd/www" # Get arguments from COMMAND (new) #====================================================================== new__OPTIONS() { -echo "$1 $2" case "$1" in domain) new__domain "$2" @@ -181,17 +180,16 @@ esac #====================================================================== -# Create an "empty" article +# Create a pre-filled article #====================================================================== new__article() { [[ -f "$2.gsl" ]] \ && echo "! $2.gsl already exists" \ && exit -[[ `grep -i "fr" <<<"$site_lang"` ]] \ - && cur_date=`date +%d-%m-%Y` \ - || cur_date=`date +%Y-%m-%d` +cur_date=`date +%Y-%m-%d` +touch "$2.gsl" cat < "$2.gsl" type: $1 #css: @@ -202,7 +200,7 @@ author: date: $cur_date tags: -#abbr: COURT : LONG +#abbr: COURT : Long : lower #file: NOM : NOM-DU-FICHIER : Text alternatif #link: NOM : URL : Text alternatif #code: NUMERO : NOM-DU-FICHIER : Text alternatif @@ -210,12 +208,26 @@ tags: #image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF #1 +( +*Bold* +| +¤Strong¤ +| +\Emphasis\ is good +| +×Custom× +| +~del~ restore +| +\`cat -n "$PWD/$gsl_postname.gsl"\` +| +) EONEWARTICLE echo cat "$2.gsl" echo -gsl check "$2.gsl" +echo "! This article has to be edited before check. You can use gsl edit $2.gsl" exit } diff --git a/var/lib/gsl/scripts/gsl__post_checkers b/var/lib/gsl/scripts/gsl__post_checkers index ecba397..9981444 100644 --- a/var/lib/gsl/scripts/gsl__post_checkers +++ b/var/lib/gsl/scripts/gsl__post_checkers @@ -67,7 +67,7 @@ case "$4" in meta) check__meta_header "$3" ;; - + metas|content) case "$3" in "title") check__titles ;; @@ -77,11 +77,6 @@ case "$4" in "flink") check__file_link ;; "fcode") check__file_code ;; "fbrut") check__file_brut ;; - "icode") check__icode ;; - "strong") check__strong ;; - "bold") check__bold ;; - "em") check__emphasis ;; - "strike") check__strike ;; esac ;; esac @@ -107,7 +102,7 @@ case "$1" in # TYPE "$gsl_marker_type") gsl_post_type="$header_f1" - + case "$gsl_post_type" in page|post) gsl__logs_print -i -h \ @@ -123,7 +118,7 @@ case "$1" in ;; esac ;; - + # CSS "$gsl_marker_css") gsl_post_css=" $header_f1" @@ -132,49 +127,43 @@ case "$1" in "Body template: $header_f1" \ "$PWD/$gsl_post" ;; - + # Title "$gsl_marker_title") gsl_post_title="$header_f1" ;; - + # DATE "$gsl_marker_date") gsl_post_date="$header_f1" - if [[ `grep -i "fr" <<<"$site_lang"` ]];then - gsl_test_date='^[0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]+$' - gsl_log_content="DD-MM-YYYY" - else - gsl_test_date='^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]+$' - gsl_log_content="YYYY-MM-DD" - fi - - if [[ "$gsl_post_date" =~ $gsl_test_date ]];then - gsl_date_m=`awk -F- '{print $2}' <<<"$gsl_post_date"` - (( "$gsl_date_m" > 12 )) \ - && gsl__logs_print -e -h \ + case "$gsl_post_date" in + [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]) + gsl_date_m=`awk -F- '{print $2}' <<<"$gsl_post_date"` + if (( "$gsl_date_m" > 12 ));then + gsl__logs_print -e -h \ "$1" \ "'$gsl_post_date' ; Month: $gsl_date_m > 12..." \ "${PWD}/$gsl_post" - else - gsl__logs_print -e -h \ - "$1" \ - "Mismatch '$gsl_post_date' ; not $gsl_log_content" \ - "${PWD}/$gsl_post" - fi + return + fi + + # timestamp date to db too (sidebar sort) + false_time=`date +%T` - # timestamp date to db too (sidebar sort) - false_time=`date +%T` - if [[ `grep -i "fr" <<<"$site_lang"` ]];then - gsl_date_y=`awk -F- '{print $3}' <<<"$gsl_post_date"` - gsl_date_d=`awk -F- '{print $1}' <<<"$gsl_post_date"` - - else gsl_date_y=`awk -F- '{print $1}' <<<"$gsl_post_date"` gsl_date_d=`awk -F- '{print $3}' <<<"$gsl_post_date"` - fi - date_epoch="$gsl_date_y-$gsl_date_m-$gsl_date_d $false_time" - date_epoch=`date +%s -u -d "$date_epoch"` + + date_epoch="$gsl_date_y-$gsl_date_m-$gsl_date_d $false_time" + date_epoch=`date +%s -u -d "$date_epoch"` + ;; + + *) + gsl__logs_print -e -h \ + "$1" \ + "Mismatch '$gsl_post_date' ; not YYYY-MM-DD" \ + "${PWD}/$gsl_post" + ;; + esac ;; # SLUG @@ -182,7 +171,7 @@ case "$1" in gsl_post_slug="$header_f1" gsl_post_slug_src="$gsl_post_slug" gsl_hash_slug_src=`cksum <<<"$gsl_post_slug_src"` - + # Type page with "/" in if [[ "$gsl_post_type" == "page" ]] && \ [[ `grep '/' <<<"$gsl_post_slug"` ]];then @@ -192,10 +181,10 @@ case "$1" in "Has '/' for type $gsl_post_type ; Replaced with '-'" \ "${PWD}/$gsl_post" fi - + # Ensure no ending / for slug gsl_post_slug=${gsl_post_slug/%\//} - + # Has space gsl_post_slug=${gsl_post_slug// /-} gsl_hash_slug=`cksum <<<"$gsl_post_slug"` @@ -212,7 +201,7 @@ case "$1" in article__sum "$gsl_post" fi - + # Already used slug while read -r "file_db" do @@ -309,36 +298,20 @@ read__line_with "^$gsl_marker_fbrut" "check" \ read__line_with "^#[1-6]" "check" \ "title" "content" "$gsl_tmp_post" -# Check icode marks match -read__line_with "$gsl_mark_icode" "check" \ - "icode" "content" "$gsl_tmp_post" - -# Check strong marks match -read__line_with "$gsl_mark_strong" "check" \ - "strong" "content" "$gsl_tmp_post" -# Check bold marks match -read__line_with "$gsl_mark_bold" "check" \ - "bold" "content" "$gsl_tmp_post" - -# Check emphasis marks match -read__line_with "$gsl_mark_em" "check" \ - "em" "content" "$gsl_tmp_post" - -# Check strike (line-through) marks match -read__line_with "$gsl_mark_strike" "check" \ - "strike" "content" "$gsl_tmp_post" # Independant modules check__paragraphs "$gsl_tmp_post" # Check for paragraphs markers check__lists "$gsl_tmp_post" # Check for lists markers check__blockquote "$gsl_tmp_post" # Check for blockquote markers +check__bsis "$gsl_tmp_post" # Check paired & stats +check__icode "$gsl_tmp_post" # Check paired & stats for inline-code # Errors => remove from DB and srv WIP [[ "$gsl_checker_err" ]] \ && article_Errors="yes" \ || article_Errors="no" - + Stat__words "$gsl_tmp_post" DB__set_status chk @@ -418,7 +391,7 @@ case "$header_f2" in "$header_f2" 2>/dev/null \ || url_status="T"` ;; - + *) url_status=NS ;; @@ -440,7 +413,7 @@ case "$url_status" in "No status ; ${header_f2:0:30}..." \ "${PWD}/$gsl_post" ;; - + T) gsl__logs_print -w -h \ "$gsl_marker_link" \ @@ -734,110 +707,181 @@ printf '%s\n' \ #====================================================================== -# Check iCode marks match nbr + stats +# Check bsis + stats +# $1: file (gsl_tmp_post) +#====================================================================== +check__bsis() { +while read -r "ln" "gsl_line" +do + ln=$(( ln + $gsl_post_begin - 1 )) + unset line_has_bold \ + line_has_strong \ + line_has_em \ + line_has_cross \ + line_has_del + + case "$gsl_line" in + *"$gsl_mark_bold"*|\ + *"$gsl_mark_strike"*|\ + *"$gsl_mark_em"*|\ + *"$gsl_mark_strong"*|\ + *"$gsl_mark_del"*) + check__bsis_stats + ;; + esac + + if [[ $line_has_bold ]];then + bold_paired=$(( $found_bold % 2 )) + if ! [[ "$bold_paired" -eq 0 ]];then + gsl__logs_print -e -c \ + "Bold" \ + "Line: $ln ; $found_bold '$gsl_mark_bold' ; not paired" \ + "$PWD/$gsl_post" + + else + gsl_stat_bolds=$(( gsl_stat_bolds + found_bold / 2 )) + fi + fi + + if [[ $line_has_strong ]];then + strong_paired=$(( $found_strong % 2 )) + if ! [[ "$strong_paired" -eq 0 ]];then + gsl__logs_print -e -c \ + "Strong" \ + "Line: $ln ; $found_strong '$gsl_mark_strong' ; not paired" \ + "$PWD/$gsl_post" + + else + gsl_stat_strongs=$(( gsl_stat_strongs + found_strong / 2 )) + fi + fi + + if [[ $line_has_em ]];then + em_paired=$(( $found_em % 2 )) + if ! [[ "$em_paired" -eq 0 ]];then + gsl__logs_print -e -c \ + "Emphasis" \ + "Line: $ln ; $found_em '$gsl_mark_em' ; not paired" \ + "$PWD/$gsl_post" + + else + gsl_stat_italics=$(( gsl_stat_italics + found_em / 2 )) + fi + fi + + if [[ $line_has_cross ]];then + cross_paired=$(( $found_cross % 2 )) + if ! [[ "$cross_paired" -eq 0 ]];then + gsl__logs_print -e -c \ + "Cross" \ + "Line: $ln ; $found_cross '$gsl_mark_cross' ; not paired" \ + "$PWD/$gsl_post" + + else + gsl_stat_strikes=$(( gsl_stat_strikes + found_cross / 2 )) + fi + fi + + if [[ $line_has_del ]];then + del_paired=$(( $found_del % 2 )) + if ! [[ "$del_paired" -eq 0 ]];then + gsl__logs_print -e -c \ + "Del" \ + "Line: $ln ; $found_del '$gsl_mark_del' ; not paired" \ + "$PWD/$gsl_post" + + else + gsl_stat_dels=$(( gsl_stat_dels + found_del / 2 )) + fi + fi +done < <(cat -n "$1") +} + +check__bsis_stats() { +found_bold=0 +found_strong=0 +found_em=0 +found_cross=0 +found_del=0 +for (( i=0; i<${#gsl_line}; i++ )) +do + case "${gsl_line:$i:1}" in + "$gsl_mark_icode") + [[ $code_open ]] \ + && unset code_open \ + || code_open=true + ;; + + "$gsl_mark_bold") + [[ $code_open ]] && continue + ((found_bold++)) + line_has_bold=true + ;; + + *"$gsl_mark_strong"*) + [[ $code_open ]] && continue + ((found_strong++)) + line_has_strong=true + ;; + + *"$gsl_mark_em"*) + [[ $code_open ]] && continue + ((found_em++)) + line_has_em=true + ;; + + *"$gsl_mark_cross"*) + [[ $code_open ]] && continue + ((found_cross++)) + line_has_cross=true + ;; + + *"$gsl_mark_del"*) + [[ $code_open ]] && continue + ((found_del++)) + line_has_del=true + ;; + esac +done +} + + +#====================================================================== +# Check iCode + stats +# $1: file (gsl_tmp_post) #====================================================================== check__icode() { -post_ln=$((ln + gsl_post_begin - 1)) -mark_icode_nbr="${gsl_line//[^$gsl_mark_icode]}" -mark_icode_nbr=${#mark_icode_nbr} -mark_icode_paired=$(( $mark_icode_nbr % 2 )) +while read -r "ln" "gsl_line" +do + ln=$(( ln + $gsl_post_begin - 1 )) + unset line_has_icode + case "$gsl_line" in + *"$gsl_mark_icode"*) + found_icode=0 + for (( i=0; i<${#gsl_line}; i++ )) + do + case "${gsl_line:$i:1}" in + "$gsl_mark_icode") + ((found_icode++)) + line_has_icode=true + ;; + esac + done + ;; + esac -if [[ "$mark_icode_paired" -eq 0 ]];then - stat_icode_nbr=$(( mark_icode_nbr / 2 )) - gsl_stat_icodes=$(( gsl_stat_icodes + stat_icode_nbr )) + if [[ $line_has_icode ]];then + icode_paired=$(( $found_icode % 2 )) + if ! [[ "$icode_paired" -eq 0 ]];then + gsl__logs_print -e -c \ + "i-Code" \ + "Line: $ln ; $found_icode '$gsl_mark_icode' ; not paired" \ + "$PWD/$gsl_post" + + else + gsl_stat_icodes=$(( gsl_stat_icodes + found_icode / 2 )) + fi + fi -else - gsl__logs_print -e -c \ - "iCode" \ - "Line: $post_ln ; '$gsl_mark_icode...$gsl_mark_icode' not paired" \ - "$PWD/$gsl_post" -fi -} - - -#====================================================================== -# Check stronng marks match nbr + stats -#====================================================================== -check__strong() { -post_ln=$((ln + gsl_post_begin - 1)) -mark_strong_nbr="${gsl_line//[^$gsl_mark_strong]}" -mark_strong_nbr=${#mark_strong_nbr} -mark_strong_paired=$(( $mark_strong_nbr % 2 )) - -if [[ "$mark_strong_paired" -eq 0 ]];then - stat_strong_nbr=$(( mark_strong_nbr / 2 )) - gsl_stat_strongs=$(( gsl_stat_strongs + stat_strong_nbr )) - -else - gsl__logs_print -e -c \ - "Strong" \ - "Line: $post_ln ; '$gsl_mark_strong...$gsl_mark_strong' not paired" \ - "$PWD/$gsl_post" -fi -} - - -#====================================================================== -# Check Bold marks match nbr + stats -#====================================================================== -check__bold() { -post_ln=$((ln + gsl_post_begin - 1)) -mark_bold_nbr="${gsl_line//[^$gsl_mark_bold]}" -mark_bold_nbr=${#mark_bold_nbr} -mark_bold_paired=$(( $mark_bold_nbr % 2 )) - -if [[ "$mark_bold_paired" -eq 0 ]];then - stat_bold_nbr=$(( mark_bold_nbr / 2 )) - gsl_stat_bolds=$(( gsl_stat_bolds + stat_bold_nbr )) - -else - gsl__logs_print -e -c \ - "Bold" \ - "Line: $post_ln ; '$gsl_mark_bold...$gsl_mark_bold' not paired" \ - "$PWD/$gsl_post" -fi -} - - -#====================================================================== -# Check Bold marks match nbr + stats -#====================================================================== -check__emphasis() { -post_ln=$((ln + gsl_post_begin - 1)) -mark_em_nbr="${gsl_line//[^$gsl_mark_em]}" -mark_em_nbr=${#mark_em_nbr} -mark_em_paired=$(( $mark_em_nbr % 2 )) - -if [[ "$mark_em_paired" -eq 0 ]];then - stat_em_nbr=$(( mark_em_nbr / 2 )) - gsl_stat_italics=$(( gsl_stat_italics + stat_em_nbr )) - -else - gsl__logs_print -e -c \ - "Emphasis" \ - "Line: $post_ln ; '$gsl_mark_em...$gsl_mark_em' not paired" \ - "$PWD/$gsl_post" -fi -} - - -#====================================================================== -# Check strike (lt) marks match nbr + stats -#====================================================================== -check__strike() { -post_ln=$((ln + gsl_post_begin - 1)) -mark_lt_nbr="${gsl_line//[^$gsl_mark_strike]}" -mark_lt_nbr=${#mark_lt_nbr} -mark_lt_paired=$(( $mark_lt_nbr % 2 )) - -if [[ "$mark_lt_paired" -eq 0 ]];then - stat_lt_nbr=$(( mark_lt_nbr / 2 )) - gsl_stat_strikes=$(( gsl_stat_strikes + stat_lt_nbr )) - -else - gsl__logs_print -e -c \ - "Strike" \ - "Line: $post_ln ; '$gsl_mark_strike...$gsl_mark_strike' not paired" \ - "$PWD/$gsl_post" -fi +done < <(cat -n "$1") } diff --git a/var/lib/gsl/scripts/gsl__post_makers b/var/lib/gsl/scripts/gsl__post_makers index a1bba1e..b55afb1 100644 --- a/var/lib/gsl/scripts/gsl__post_makers +++ b/var/lib/gsl/scripts/gsl__post_makers @@ -17,7 +17,7 @@ # $3: file #====================================================================== sidebar__OPTIONS() { - + # Check OPTIONS except for "latest" # --------------------------------- sidebar__check_args() { @@ -29,7 +29,7 @@ sidebar__OPTIONS() { && gsl__invalid_option "$1" "position (1 to $site_max_list)" position="$1" - + # file post if__file "$2" post gsl_post="$2" @@ -37,27 +37,26 @@ sidebar__OPTIONS() { && echo "! Article not check yet" \ && exit } - + case "$1" in add|-a) sidebar__check_args "$2" "$3" ;; - + replace|-r) sidebar__check_args "$2" "$3" ;; - + latest|-l|oldest|-o) position="1 to $site_max_list" ;; - + *) gsl__invalid_option "$1" "add|replace|latest|oldest" ;; esac # Start process -create__HTML_translation sidebar__create "$1" "$position" } @@ -166,7 +165,7 @@ do gsl_force_make=true log_info_force="Force " ;; - + *".gsl") if__file "$2" post gsl_post="$2" @@ -232,16 +231,6 @@ fi ! [[ "$gsl_do_make" ]] && return -#---------------------------------------------------------------------- -# Set HTML to replace first marker -# Closed HTML are static > in gsl.conf -#---------------------------------------------------------------------- -HTML_icode_start="" -HTML_strong_start="" -HTML_em_start="" -HTML_strike_start="" -HTML_bold_start="" - #---------------------------------------------------------------------- # makers modules #---------------------------------------------------------------------- @@ -266,36 +255,24 @@ read__line_with "^$gsl_marker_link" "make" \ read__line_with "^$gsl_marker_flink" "make" \ "flink" "metas" "$gsl_tmp_head" -#---------------------------------------------------------------------- -# Convert words between marks (icode, strong, emphasis, bolds) -# If these markers are in inline code, replace by temp marker + sed back -# Strong -make__loop_line "$gsl_mark_strong" "between" "$gsl_tmp_post" \ - "$HTML_strong_start" "$HTML_strong_close" "ß" -# Bold -make__loop_line "$gsl_mark_bold" "between" "$gsl_tmp_post" \ - "$HTML_bold_start" "$HTML_bold_close" "ð" -# Emphasis -make__loop_line "$gsl_mark_em" "between" "$gsl_tmp_post" \ - "$HTML_em_start" "$HTML_em_close" "đ" -# Strike -make__loop_line "$gsl_mark_strike" "between" "$gsl_tmp_post" \ - "$HTML_strike_start" "$HTML_strike_close" "ŋ" -# ! At last do : iCodes -make__loop_line "$gsl_mark_icode" "between" "$gsl_tmp_post" \ - "$HTML_icode_start" "$HTML_icode_close" -# For lines having markers in inline-code, replace temp markers -if [[ ${incode_line[@]} ]];then - for ln in ${incode_line[@]} - do - sed -i "${ln}s^ß^•^g" "$gsl_tmp_post" # Strong - sed -i "${ln}s^ð^·^g" "$gsl_tmp_post" # Bold - sed -i "${ln}s^đ^”^g" "$gsl_tmp_post" # Emphasis - sed -i "${ln}s^ŋ^×^g" "$gsl_tmp_post" # Strike - done -fi #---------------------------------------------------------------------- +# Method bsis (Bold, String, Italic, Strike) +# Same for inline_code, done after bsis +# Search all lines for bsis mark +## Read each letter from line, excluding ones inside inline_code +## Convert mark with specific special charcter +## Convert specific special character to HTML +#---------------------------------------------------------------------- +# Convert bsis +make__bsis_search "$gsl_tmp_post" +make__bsis "$gsl_tmp_post" + +# Convert inlinde_code +make__icode_convert "$gsl_tmp_post" +make__icode "$gsl_tmp_post" +#---------------------------------------------------------------------- + # Image read__line_with "^$gsl_marker_image" "make" \ @@ -331,25 +308,6 @@ DB__set_status "wip" } -#====================================================================== -# Loop called by each content module, till nothing found -# $1: marker -# $2: mark (between) -# $3: file -# $4: HTML Start -# $5: HTML Close -# $6: Temp character replacement -#====================================================================== -make__loop_line() { -read__line_with \ - "$1" "make" \ - "$2" "content" \ - "$3" "$4" "$5" "$6" - -! [[ "$gsl_line" ]] && return -} - - #====================================================================== # Filter content # Called from read__line_with() in gsl__do_commons @@ -362,7 +320,6 @@ read__line_with \ make__headers_from_filter() { case "$2" in title) make__titles "$3" ;; - between) make__words "$1" "$2" "$3" "$4" "$5" "$6" ;; abbr) make__abbrs "$5" "$gsl_tmp_post" ;; link|flink) make__links "$gsl_tmp_post" "$2" ;; fcode) make__file_codes "$gsl_tmp_post" ;; @@ -835,7 +792,7 @@ do "="*) list[$i]="ul" ;; "+"*) list[$i]="ol" ;; esac -done < <(awk '($1 ~ "=" || $1 ~ "+" || $1 ~ ">>" ) \ +done < <(awk '($1 ~ "=" || $1 ~ "+" || $1 ~ ">>") \ {print NR,$0}' \ "$gsl_tmp_list_brut") @@ -1220,3 +1177,197 @@ echo "" >> "$1" sed -i "s^NODIV^^g" "$1" sed -i "s^ENDIV^^g" "$1" } + + +#====================================================================== +# bsis: Search all lines for bsis mark +# $1: file (gsl_tmp_post) +#====================================================================== +make__bsis_search() { +while read -r "ln" "gsl_line" +do + case "$gsl_line" in + *"$gsl_mark_bold"*|\ + *"$gsl_mark_strike"*|\ + *"$gsl_mark_em"*|\ + *"$gsl_mark_del"*|\ + *"$gsl_mark_strong"*) + make__bsis_convert "$ln" "$1" + ;; + esac +done < <(cat -n "$1") +} + + +#====================================================================== +# Called from make__bsis_search +# bsis: Read each letter from line, excluding ones inside inline_code +# $1: line number +# $2: file (gsl_tmp_post) +#====================================================================== +make__bsis_convert() { +for (( i=0; i<${#gsl_line}; i++ )) +do + case "${gsl_line:$i:1}" in + "$gsl_mark_icode") + if [[ $code_open ]];then + unset code_open + else + code_open=true + fi + ;; + + "$gsl_mark_bold") + [[ $code_open ]] && continue + if [[ $bold_open ]];then + sed -i -r "$1s|^(.{"$i"})"'\*'"|\1$bold_close|" "$2" + unset bold_open + + else + sed -i -r "$1s|^(.{"$i"})"'\*'"|\1$bold_start|" "$2" + bold_open=true + article_has_bold=true + fi + ;; + + "$gsl_mark_cross") + [[ $code_open ]] && continue + if [[ $cross_open ]];then + sed -i -r "$1s|^(.{"$i"})"$gsl_mark_cross"|\1$cross_close|" "$2" + unset cross_open + + else + sed -i -r "$1s|^(.{"$i"})"$gsl_mark_cross"|\1$cross_start|" "$2" + cross_open=true + article_has_cross=true + fi + ;; + + "$gsl_mark_del") + [[ $code_open ]] && continue + if [[ $del_open ]];then + sed -i -r "$1s|^(.{"$i"})"$gsl_mark_del"|\1$del_close|" "$2" + unset del_open + + else + sed -i -r "$1s|^(.{"$i"})"$gsl_mark_del"|\1$del_start|" "$2" + del_open=true + article_has_del=true + fi + ;; + + "$gsl_mark_em") + [[ $code_open ]] && continue + if [[ $em_open ]];then + sed -i -r "$1s|^(.{"$i"})"'\\'"|\1$em_close|" "$2" + unset em_open + + else + sed -i -r "$1s|^(.{"$i"})"'\\'"|\1$em_start|" "$2" + em_open=true + article_has_em=true + fi + ;; + + "$gsl_mark_strong") + [[ $code_open ]] && continue + if [[ $strong_open ]];then + sed -i -r "$1s|^(.{"$i"})"'¤'"|\1$strong_close|" "$2" + unset strong_open + + else + sed -i -r "$1s|^(.{"$i"})"'¤'"|\1$strong_start|" "$2" + strong_open=true + article_has_strong=true + fi + ;; + esac +done +} + + +#====================================================================== +# bsis: Convert specific characters to HTML +# $1: file (gsl_tmp_post) +#====================================================================== +make__bsis() { +if [[ $article_has_bold ]];then + HTML_bold_start="" + + sed -i "s^$bold_start^$HTML_bold_start^g" "$1" + sed -i "s^$bold_close^^g" "$1" +fi + +if [[ $article_has_em ]];then + HTML_em_start="" + + sed -i "s^$em_start^$HTML_em_start^g" "$1" + sed -i "s^$em_close^^g" "$1" +fi + +if [[ $article_has_cross ]];then + HTML_cross_start="" + + sed -i "s^$cross_start^$HTML_cross_start^g" "$1" + sed -i "s^$cross_close^^g" "$1" +fi + +if [[ $article_has_del ]];then + HTML_del_start="" + + sed -i "s^$del_start^$HTML_del_start^g" "$1" + sed -i "s^$del_close^^g" "$1" +fi + +if [[ $article_has_strong ]];then + HTML_strong_start="" + + sed -i "s^$strong_start^$HTML_strong_start^g" "$1" + sed -i "s^$strong_close^^g" "$1" +fi +} + + +#====================================================================== +# inline-code: Read each letter from line, convert to specific character +# $1: file (gsl_tmp_post) +#====================================================================== +make__icode_convert() { +while read -r "ln" "gsl_line" +do + case "$gsl_line" in + *"$gsl_mark_icode"*) + for (( i=0; i<${#gsl_line}; i++ )) + do + case "${gsl_line:$i:1}" in + "$gsl_mark_icode") + if [[ $icode_open ]];then + sed -i -r "${ln}s|^(.{"$i"})"$gsl_mark_icode"|\1$icode_close|" "$1" + unset icode_open + + else + sed -i -r "${ln}s|^(.{"$i"})"$gsl_mark_icode"|\1$icode_start|" "$1" + icode_open=true + article_has_icode=true + fi + ;; + esac + done + ;; + esac +done < <(cat -n "$1") +} + + +#====================================================================== +# inline-code: Convert specific characters to HTML +# $1: file (gsl_tmp_post) +#====================================================================== +make__icode() { +if [[ $article_has_icode ]];then + HTML_icode_start="" + + sed -i "s^$icode_start^$HTML_icode_start^g" "$1" + sed -i "s^$icode_close^^g" "$1" +fi +} diff --git a/var/lib/gsl/scripts/gsl__post_manager b/var/lib/gsl/scripts/gsl__post_manager index aae6664..801d3fd 100644 --- a/var/lib/gsl/scripts/gsl__post_manager +++ b/var/lib/gsl/scripts/gsl__post_manager @@ -13,7 +13,7 @@ posts__loop() { for gsl_post in `ls -1 *.gsl 2>/dev/null` do - + # Do specific asked Post [[ "$gsl_this_post" ]] && ! [[ "$gsl_post" == "$gsl_this_post" ]] \ && continue @@ -40,7 +40,7 @@ do www) WWW__OPTIONS "$2" ;; wip) WIP__remove ;; # wip command is only a remove case || make esac - + # In DB, show logs for server if [[ "$article_Type" ]];then if [[ $article_new_hash ]];then @@ -154,67 +154,3 @@ gsl__logs_print -i -A -src \ "Hash: $article_Hash ; Size: $article_Size" \ "${PWD}/$1" } - - -#====================================================================== -# Get arguments from COMMAND (create) -# $2: post type -# $3: post name -#====================================================================== -new__article_OPTIONS() { -gsl__find_domain -author__check || exit 0 - -# exit if no postname -! [[ "$3" ]] \ - && gsl__invalid_option "$3" "Please set a name for your $2" - -gsl_postname="$3" -case "$gsl_postname" in - *".gsl") gsl_postname=${gsl_postname/%.gsl/} -esac - -# File exists -[[ -f "$gsl_postname.gsl" ]] \ - && echo "! $PWD/$gsl_postname.gsl already exists..." \ - && exit - -gsl_proc="create" -[[ `grep -i "fr" <<<"$gsl_site_lang"` ]] \ - && gsl_today=`printf '%(%d-%m-%Y)T'` \ - || gsl_today=`date +%F` - -gsl_post="$gsl_postname.gsl" -log__process_begin "Create $2" - -touch "$PWD/$gsl_post" -cat << EONEWP >> "$PWD/$gsl_post" -type: $2 -title: -slug: -info: -author: -tags: -date: $gsl_today - -# Uncomment and fill -#link: NAME : URL : Alt-Text -#image: NBR : URI : ALT-TEXT -#abbr: SHORT : LONG - -#1 -·Bold· •Strong• ”Emphasis” ×Stile× ¤cat -n "$PWD/$gsl_postname.gsl"¤ -EONEWP - -get__post_sum "$gsl_post" -gsl__logs_print -i -f -src \ - "Hash: $gsl_post_hash ; Size: $gsl_post_size" \ - "$PWD/$gsl_post" - -log__process_end "Create $2" - -cat -n "$PWD/$gsl_post" -echo -gsl check "$gsl_post" -exit -}