From 37a18a3af4eb3d95f0738a9fb5d94f288f563c2a Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Thu, 23 Jun 2022 12:24:01 +0200 Subject: [PATCH] New Image marker Options ; Fixes --- README.md | 12 +- control | 2 +- help/comment_ecrire-article.md | 37 +++-- help/how-to_Tips_Advises.md | 25 +++- new-version.md | 154 ++------------------- usr/local/bin/gsl | 7 +- var/lib/gsl/README.md | 12 +- var/lib/gsl/help/comment_ecrire-article.md | 37 +++-- var/lib/gsl/help/how-to_Tips_Advises.md | 25 +++- var/lib/gsl/new-version.md | 154 ++------------------- var/lib/gsl/scripts/gsl__db_manager | 19 ++- var/lib/gsl/scripts/gsl__post_checkers | 27 +++- var/lib/gsl/scripts/gsl__post_makers | 151 +++++++++++++++----- var/lib/gsl/scripts/gsl__srv_manager | 15 +- 14 files changed, 304 insertions(+), 373 deletions(-) diff --git a/README.md b/README.md index 4c84d19..b435703 100644 --- a/README.md +++ b/README.md @@ -99,13 +99,19 @@ gsl help -w # Comment gérer la sidebar ------------------------------------------------------------------------ La gestion de la sidebar est manuelle. Un article doit être convertit -avec make avant de pouvoir l'ajouter à la position désirée. Le nombre -d'articles maximum dans la sidebar est configurable dans le fichier de -configuration du domaine (DOMAIN.conf) (via le questionnaire) +avec make (ou wip add) avant de pouvoir l'ajouter à la position désirée. +Le nombre d'articles maximum dans la sidebar est configurable dans le +fichier de configuration du domaine (DOMAIN.conf) (via le questionnaire) ``` +# Crée la sidebar avec les derniers articles publiés gsl sidebar latest + +# Remplace l'article à la position 2 gsl sidebar replace 2 monarticle.gsl + +# Place l'article à la position 3, déplace les suivants (enlève le dernier) +gsl sidebar add 3 monarticle.gsl ``` ## Astuces diff --git a/control b/control index ec1a891..e093750 100644 --- a/control +++ b/control @@ -1,5 +1,5 @@ Package: egsl -Version: 0.1.2 +Version: 0.1.3 Section: custom Priority: optional Architecture: all diff --git a/help/comment_ecrire-article.md b/help/comment_ecrire-article.md index bbe4513..82a21ee 100644 --- a/help/comment_ecrire-article.md +++ b/help/comment_ecrire-article.md @@ -206,20 +206,30 @@ image: 2 : FILENAME : ALT-TEXT ``` Dans l'article... -Définir le marqueur ```_image``` et spécifiez les -valeurs séparées par ```:```. ```+``` indique l'ouverture dans une -nouvelle fenêtre. Seuls le "numéro d'image" est obligatoire +Définir le marqueur ```_image``` et spécifiez 5 valeurs séparées par +```:```. Placez ```+``` pour faire un lien vers l'image ou définir un +lien http/ftp pour faire un lien externe sur l'image. + +Seul la prelière valeur est obligatoire. Les suivantes peuvent être soit +la valeur prévue, soit un lien Les valeurs: -- Numero d'image -- Alignement: l,r,(g,d également),c pour gauche, droite, centre) +1. Numero d'image +2. Alignement: l,r,(g,d également),c pour gauche, droite, centre) - - maclasse au lieu de l,r,g,d,c pour utiliser la classe css "maclasse" -- - + (class="center") -- Longueur width: (avec unité) -- - + (taille originale) -- Largeur height: (avec unité) -- - + (longueur définie, largeur originale) -- + (Lien de l'image dans un nouvel onglet) +- - ```+``` : CSS center. Lien vers l'image +- - ```http/ftp``` : CSS center. Lien externe sur l'image +3. Longueur width : unité par défaut: px si inconnue +- - ```0``` : longueur non définie +- - ```+``` : CSS maclasse. Lien vers l'image +- - ```http/ftp``` : CSS maclasse. Lien externe sur l'image +4. Largeur height : unité par défaut: px si inconnue +- - ```0``` : largeur non définie +- - ```+``` : CSS maclasse. Lien vers l'image +- - ```http/ftp``` : CSS maclasse. Lien externe sur l'image +5. lien : vers l'image interne ou un lien externe +- - ```+``` : CSS maclasse. Lien vers l'image +- - ```http/ftp``` : CSS maclasse. Lien externe sur l'image Exemple d'images affichées l'une à côté de l'autre @@ -227,7 +237,8 @@ Exemple d'images affichées l'une à côté de l'autre ( _image:1 _image:2:c:640px:25% -_image:3:maclass:320px:240px:+ +_image:3:maclass:320:+ +_image:4:maclass:0:400:https://echolib.re ) ``` @@ -240,7 +251,7 @@ center _image:1:+ ) ( -_image:2:c:1920px:25% +_image:2:c:1920px:25%:https://echolib.re ) ``` diff --git a/help/how-to_Tips_Advises.md b/help/how-to_Tips_Advises.md index 682eb74..b755610 100644 --- a/help/how-to_Tips_Advises.md +++ b/help/how-to_Tips_Advises.md @@ -16,13 +16,24 @@ image: 1 : dir/dir1/pic.png ``` ## Images: set style and target +Examples HTML Ouput according to marker "_image:" marker in content ``` -# Open in new tab pic, keep origin sizes -_image:1:+ +image: 5 : avatar-echolib.png : echolib -# Open pic in new tab, using your css class and with width in pixel -# (height is kept) -_image:1:c:640px:+ +_image:5:l:234:567:https://echolib.re +echolib + +_image:5:http://echolib.re +echolib + +_image:5:CSS-B:128:http://echolib.re +echolib + +_image:5:CSS-A:http://echolib.re +echolib + +_image:5:+ +echolib ``` ## Make (changes in your template) @@ -44,3 +55,7 @@ If your remove a www or wip page, and you have put it in the sidebar, do not forget to replace it with another article. You can also have an automatic sidebar with - gsl sidebar latest + +## Stats +For local URL (i.e. /index.html (or /)), online stats will be couted only +after article is in www on new check (command) diff --git a/new-version.md b/new-version.md index cab8454..cab35f9 100644 --- a/new-version.md +++ b/new-version.md @@ -1,145 +1,15 @@ -## [0.1.0] - -## Please, see help (and documentations in help folder) - -### Add -- New code about everywhere, more comments, cleaner -- nano dependence -- Check installed configuration at launch -- Dedicated functions for ARGUMENTS in specific files category -- - check: gsl__post_checkers -- - make,sidebar: gsl__post_makers -- - sync,www,wip gsl__srv_manager -- - log: gsl__log_manager -- - db: gsl__db_manager -- - author,new,setdir: gsl__domain_manager -- - edit: gsl__edit_file -- - stats: gsl__stats -- Basic RSS feed created at each www (COMMAND) -- - on root server: /DOMAIN/www/rss.xml -- Basic footer with new list (added RSS feed). -- - Do not forget to add link in your footer, to /rss.xml - -### Installation -- new files: -- - gsl__srv_manager: for all about server -- - gsl__version: for -v, -vv, --version options -- - gsl__domain_manager: for OPT author, new, setdir -- - gsl__edit_file: functions to edit some configuration files -- - gsl__do_commons: Common functions to filter article lines -- - gsl__HTML_template: functions to create HTML pages -- New empty folder in installation: -- - /var/lib/gsl/db: for all DBs (.gitkepp) -- - /var/lib/gsl/domains: for all domains (.gitkeep) -- - /var/log/gsl: for logs files (.gitkeep) -- New help folder in -- - /var/lib/gsl/help (removed "helps" one) -- - - Renamed documentation files (not all translated ; some in french) - -### Logs -- Better logs harmony -- New fields in log for article filename and domain name -- Specific number of characters spaces in some log fields -- More verbose -- "automatic" level log set from called functions -- Colored levels: war (yellow), err (red) - -### Databases -- Dedicated per article -- Folder: /var/lib/gsl/db/ -- New file format: domains.db -- More datas with new stats. Quicker sourced datas -- Dedicated articles in sub-directory "DOMAIN" -- Check if corrupted DB -- Database and wip files won't be removed if errors in article -- If corrupted Database, try restoring www & wip statuses at new check +## [0.1.3] +### Fix: +- invalid argument +- site_css variable called in sidebar +- make : even if page created, article must be check if changed ### Changes -- Changes in mapping process: -- - Processes get needed headers FIRST, then split article in 2 sections -- DOMAIN Profile is only in /var/lib/gsl/domains/DOMAIN/ -- Variables in DOMAIN.conf file has no more "gsl_" -- Some translated words in HTML page from lang set DOMAIN (fr || en) -- Between markers (code): put "everything" you want -- New CSS classes: see gsl help css or documentation -- Mark image (i.e. "_image:1:mycss:50%:25%:+)" -- - define your own css class 'mycss' -- - define unity ("%","px"... with height and witdth) -- New lists. Mix "+" (ol) and "=" (ul) and write an item on several lines -- Between hX titles: new div css (none if empty content) -- Changing article Type will remove old wip file (not www file !) -- sync: Logs not shown but added -- stats properties file is now in /www (online) +- 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 -### Process check [argument] -- slug: log err if already exists (log war if not well formated) - -### new ARGUMENTS -- new (page|post) (name): Create article, show its content + check it -- new domain: New domain configuration creator -- new author: Same as author edit -- edit domains: Set/Edit registred domains database -- edit author: Same as author edit -- author edit: Opens nano to Add/Remove authors (one per line) by DOMAIN -- setdir: Set current folder for your DOMAIN (show if one) -- check -N: Only check newer articles not in DB -- clean all: Remove all backups (only) files -- sidebar: add|replace|latest|oldest (See gsl help) -- www sync: Same as sync www (see gsl help) -- wip ...: Same as www but for wip (see gsl help) - -### Markers -- css: MYCLASS Customize each article with your CSS (optional) -- brut: Insert brut code from file -- - In article header: "NBR : FILENAME"`` -- - In article content: "_brut: NBR" -- "_image:VALUE:MYCSS:WIDTH:HEIGHT:TARGET" (no target=no HTML link) -- Strong mark: '•...•' (alt+gr + ;) on french azerty keyboard) -- Bold mark: '·...·' (alt+gr + :) on french azerty keyboard) -- Emphasis mark: '”...”' (alt+gr + n) on french azerty keyboard) -- Strike mark: '×...×' (alt+gr + shift + ;) on french azerty keyboard -- ```<<``` and ```>>``` as "start" and "close" marker for lists - -### Template -- included basic header, metas and footer -- All about template is in /var/lib/gsl/scripts/gsl__HTML_template -- - No more header.html in templates folder -- - - Edit your own in create__HTML_header() function -- In /var/lib/gsl/domains/DOMAIN/templates/ -- - Auto created metas.html and footer.html if not exist -- - Edit your own footer.html -- - Edit your own metas per DOMAIN for HTML `````` in metas.html -- - - included basic pre-registred meta from datas article -- - No CSS styles included: create your own (see classes and IDs used in doc) -- For all changes here, after gsl make, use gsl sync... - -### Sidebar -- No more /var/lib/gsl/domains/DOMAIN/templates/last-posts-list.html -- - Remove it with files xxx.X in /var/lib/gsl/domains/DOMAIN/X-tra/ -- New HTML file: /var/lib/gsl/domains/DOMAIN/templates/sidebar.html -- - Created with files /var/lib/gsl/domains/DOMAIN/X-tra/sidebar/(POS).html -- articles are sorted from epoch date (in DB) with false time at check - -### Statoolinfos (added properties for www status) -- Genereated at each www (add/remove) -- gsl.articles -- gsl.articles.pages -- gsl.articles.posts -- gsl.authors -- gsl.articles.tags -- gsl.articles.words -- gsl.articles.quotes -- gsl.articles.paragraphs -- gsl.articles.links -- gsl.articles.links.online -- gsl.articles.lists -- gsl.articles.lists.items -- gsl_articles.images - -### CRITIK -- Remove all files in /var/lib/gsl/db/ -- Use: ```gsl new domain```, give your registred DOMAIN name -- - Answer Y to autofix old configurations files and folders -- - Do it for each DOMAIN you registred -- - will add site_max_list=5 (default) in domain configuration file -- Use ```gsl check``` in your articles folder +### Add +- Stats : local link from slug (/...) counted after new check if added to www diff --git a/usr/local/bin/gsl b/usr/local/bin/gsl index 5ee165d..7d80844 100755 --- a/usr/local/bin/gsl +++ b/usr/local/bin/gsl @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.1.2 +# Version: 0.1.3 # file: gsl # Folder: /usr/local/bin # By echolib (XMPP: im@echolib.re) @@ -61,7 +61,7 @@ done #====================================================================== # Helper -# $2: arguments list +# $1: arguments list from help #====================================================================== help__OPTIONS() { clear @@ -141,12 +141,14 @@ esac if__gsl_post # from gsl__post_manager: check if .gsl case "$1" in + db|sync|-s|edit|-E) true ;; check|-C) check__OPTIONS "$@" ;; make|-M) make__OPTIONS "$@" ;; sidebar|-S) sidebar__OPTIONS "$2" "$3" "$4" ;; www) srv__OPTIONS "$1" "$2" "$3" ;; wip) srv__OPTIONS "$1" "$2" "$3" ;; stats) stats__datas;exit ;; + *) gsl__invalid_option "$1" "See help argument";exit ;; esac #====================================================================== @@ -172,3 +174,4 @@ if [[ "$gsl_checker_err" ]];then gsl_logs_err=true gsl__logs_show fi +exit diff --git a/var/lib/gsl/README.md b/var/lib/gsl/README.md index 4c84d19..b435703 100644 --- a/var/lib/gsl/README.md +++ b/var/lib/gsl/README.md @@ -99,13 +99,19 @@ gsl help -w # Comment gérer la sidebar ------------------------------------------------------------------------ La gestion de la sidebar est manuelle. Un article doit être convertit -avec make avant de pouvoir l'ajouter à la position désirée. Le nombre -d'articles maximum dans la sidebar est configurable dans le fichier de -configuration du domaine (DOMAIN.conf) (via le questionnaire) +avec make (ou wip add) avant de pouvoir l'ajouter à la position désirée. +Le nombre d'articles maximum dans la sidebar est configurable dans le +fichier de configuration du domaine (DOMAIN.conf) (via le questionnaire) ``` +# Crée la sidebar avec les derniers articles publiés gsl sidebar latest + +# Remplace l'article à la position 2 gsl sidebar replace 2 monarticle.gsl + +# Place l'article à la position 3, déplace les suivants (enlève le dernier) +gsl sidebar add 3 monarticle.gsl ``` ## Astuces diff --git a/var/lib/gsl/help/comment_ecrire-article.md b/var/lib/gsl/help/comment_ecrire-article.md index bbe4513..82a21ee 100644 --- a/var/lib/gsl/help/comment_ecrire-article.md +++ b/var/lib/gsl/help/comment_ecrire-article.md @@ -206,20 +206,30 @@ image: 2 : FILENAME : ALT-TEXT ``` Dans l'article... -Définir le marqueur ```_image``` et spécifiez les -valeurs séparées par ```:```. ```+``` indique l'ouverture dans une -nouvelle fenêtre. Seuls le "numéro d'image" est obligatoire +Définir le marqueur ```_image``` et spécifiez 5 valeurs séparées par +```:```. Placez ```+``` pour faire un lien vers l'image ou définir un +lien http/ftp pour faire un lien externe sur l'image. + +Seul la prelière valeur est obligatoire. Les suivantes peuvent être soit +la valeur prévue, soit un lien Les valeurs: -- Numero d'image -- Alignement: l,r,(g,d également),c pour gauche, droite, centre) +1. Numero d'image +2. Alignement: l,r,(g,d également),c pour gauche, droite, centre) - - maclasse au lieu de l,r,g,d,c pour utiliser la classe css "maclasse" -- - + (class="center") -- Longueur width: (avec unité) -- - + (taille originale) -- Largeur height: (avec unité) -- - + (longueur définie, largeur originale) -- + (Lien de l'image dans un nouvel onglet) +- - ```+``` : CSS center. Lien vers l'image +- - ```http/ftp``` : CSS center. Lien externe sur l'image +3. Longueur width : unité par défaut: px si inconnue +- - ```0``` : longueur non définie +- - ```+``` : CSS maclasse. Lien vers l'image +- - ```http/ftp``` : CSS maclasse. Lien externe sur l'image +4. Largeur height : unité par défaut: px si inconnue +- - ```0``` : largeur non définie +- - ```+``` : CSS maclasse. Lien vers l'image +- - ```http/ftp``` : CSS maclasse. Lien externe sur l'image +5. lien : vers l'image interne ou un lien externe +- - ```+``` : CSS maclasse. Lien vers l'image +- - ```http/ftp``` : CSS maclasse. Lien externe sur l'image Exemple d'images affichées l'une à côté de l'autre @@ -227,7 +237,8 @@ Exemple d'images affichées l'une à côté de l'autre ( _image:1 _image:2:c:640px:25% -_image:3:maclass:320px:240px:+ +_image:3:maclass:320:+ +_image:4:maclass:0:400:https://echolib.re ) ``` @@ -240,7 +251,7 @@ center _image:1:+ ) ( -_image:2:c:1920px:25% +_image:2:c:1920px:25%:https://echolib.re ) ``` diff --git a/var/lib/gsl/help/how-to_Tips_Advises.md b/var/lib/gsl/help/how-to_Tips_Advises.md index 682eb74..b755610 100644 --- a/var/lib/gsl/help/how-to_Tips_Advises.md +++ b/var/lib/gsl/help/how-to_Tips_Advises.md @@ -16,13 +16,24 @@ image: 1 : dir/dir1/pic.png ``` ## Images: set style and target +Examples HTML Ouput according to marker "_image:" marker in content ``` -# Open in new tab pic, keep origin sizes -_image:1:+ +image: 5 : avatar-echolib.png : echolib -# Open pic in new tab, using your css class and with width in pixel -# (height is kept) -_image:1:c:640px:+ +_image:5:l:234:567:https://echolib.re +echolib + +_image:5:http://echolib.re +echolib + +_image:5:CSS-B:128:http://echolib.re +echolib + +_image:5:CSS-A:http://echolib.re +echolib + +_image:5:+ +echolib ``` ## Make (changes in your template) @@ -44,3 +55,7 @@ If your remove a www or wip page, and you have put it in the sidebar, do not forget to replace it with another article. You can also have an automatic sidebar with - gsl sidebar latest + +## Stats +For local URL (i.e. /index.html (or /)), online stats will be couted only +after article is in www on new check (command) diff --git a/var/lib/gsl/new-version.md b/var/lib/gsl/new-version.md index cab8454..cab35f9 100644 --- a/var/lib/gsl/new-version.md +++ b/var/lib/gsl/new-version.md @@ -1,145 +1,15 @@ -## [0.1.0] - -## Please, see help (and documentations in help folder) - -### Add -- New code about everywhere, more comments, cleaner -- nano dependence -- Check installed configuration at launch -- Dedicated functions for ARGUMENTS in specific files category -- - check: gsl__post_checkers -- - make,sidebar: gsl__post_makers -- - sync,www,wip gsl__srv_manager -- - log: gsl__log_manager -- - db: gsl__db_manager -- - author,new,setdir: gsl__domain_manager -- - edit: gsl__edit_file -- - stats: gsl__stats -- Basic RSS feed created at each www (COMMAND) -- - on root server: /DOMAIN/www/rss.xml -- Basic footer with new list (added RSS feed). -- - Do not forget to add link in your footer, to /rss.xml - -### Installation -- new files: -- - gsl__srv_manager: for all about server -- - gsl__version: for -v, -vv, --version options -- - gsl__domain_manager: for OPT author, new, setdir -- - gsl__edit_file: functions to edit some configuration files -- - gsl__do_commons: Common functions to filter article lines -- - gsl__HTML_template: functions to create HTML pages -- New empty folder in installation: -- - /var/lib/gsl/db: for all DBs (.gitkepp) -- - /var/lib/gsl/domains: for all domains (.gitkeep) -- - /var/log/gsl: for logs files (.gitkeep) -- New help folder in -- - /var/lib/gsl/help (removed "helps" one) -- - - Renamed documentation files (not all translated ; some in french) - -### Logs -- Better logs harmony -- New fields in log for article filename and domain name -- Specific number of characters spaces in some log fields -- More verbose -- "automatic" level log set from called functions -- Colored levels: war (yellow), err (red) - -### Databases -- Dedicated per article -- Folder: /var/lib/gsl/db/ -- New file format: domains.db -- More datas with new stats. Quicker sourced datas -- Dedicated articles in sub-directory "DOMAIN" -- Check if corrupted DB -- Database and wip files won't be removed if errors in article -- If corrupted Database, try restoring www & wip statuses at new check +## [0.1.3] +### Fix: +- invalid argument +- site_css variable called in sidebar +- make : even if page created, article must be check if changed ### Changes -- Changes in mapping process: -- - Processes get needed headers FIRST, then split article in 2 sections -- DOMAIN Profile is only in /var/lib/gsl/domains/DOMAIN/ -- Variables in DOMAIN.conf file has no more "gsl_" -- Some translated words in HTML page from lang set DOMAIN (fr || en) -- Between markers (code): put "everything" you want -- New CSS classes: see gsl help css or documentation -- Mark image (i.e. "_image:1:mycss:50%:25%:+)" -- - define your own css class 'mycss' -- - define unity ("%","px"... with height and witdth) -- New lists. Mix "+" (ol) and "=" (ul) and write an item on several lines -- Between hX titles: new div css (none if empty content) -- Changing article Type will remove old wip file (not www file !) -- sync: Logs not shown but added -- stats properties file is now in /www (online) +- 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 -### Process check [argument] -- slug: log err if already exists (log war if not well formated) - -### new ARGUMENTS -- new (page|post) (name): Create article, show its content + check it -- new domain: New domain configuration creator -- new author: Same as author edit -- edit domains: Set/Edit registred domains database -- edit author: Same as author edit -- author edit: Opens nano to Add/Remove authors (one per line) by DOMAIN -- setdir: Set current folder for your DOMAIN (show if one) -- check -N: Only check newer articles not in DB -- clean all: Remove all backups (only) files -- sidebar: add|replace|latest|oldest (See gsl help) -- www sync: Same as sync www (see gsl help) -- wip ...: Same as www but for wip (see gsl help) - -### Markers -- css: MYCLASS Customize each article with your CSS (optional) -- brut: Insert brut code from file -- - In article header: "NBR : FILENAME"`` -- - In article content: "_brut: NBR" -- "_image:VALUE:MYCSS:WIDTH:HEIGHT:TARGET" (no target=no HTML link) -- Strong mark: '•...•' (alt+gr + ;) on french azerty keyboard) -- Bold mark: '·...·' (alt+gr + :) on french azerty keyboard) -- Emphasis mark: '”...”' (alt+gr + n) on french azerty keyboard) -- Strike mark: '×...×' (alt+gr + shift + ;) on french azerty keyboard -- ```<<``` and ```>>``` as "start" and "close" marker for lists - -### Template -- included basic header, metas and footer -- All about template is in /var/lib/gsl/scripts/gsl__HTML_template -- - No more header.html in templates folder -- - - Edit your own in create__HTML_header() function -- In /var/lib/gsl/domains/DOMAIN/templates/ -- - Auto created metas.html and footer.html if not exist -- - Edit your own footer.html -- - Edit your own metas per DOMAIN for HTML `````` in metas.html -- - - included basic pre-registred meta from datas article -- - No CSS styles included: create your own (see classes and IDs used in doc) -- For all changes here, after gsl make, use gsl sync... - -### Sidebar -- No more /var/lib/gsl/domains/DOMAIN/templates/last-posts-list.html -- - Remove it with files xxx.X in /var/lib/gsl/domains/DOMAIN/X-tra/ -- New HTML file: /var/lib/gsl/domains/DOMAIN/templates/sidebar.html -- - Created with files /var/lib/gsl/domains/DOMAIN/X-tra/sidebar/(POS).html -- articles are sorted from epoch date (in DB) with false time at check - -### Statoolinfos (added properties for www status) -- Genereated at each www (add/remove) -- gsl.articles -- gsl.articles.pages -- gsl.articles.posts -- gsl.authors -- gsl.articles.tags -- gsl.articles.words -- gsl.articles.quotes -- gsl.articles.paragraphs -- gsl.articles.links -- gsl.articles.links.online -- gsl.articles.lists -- gsl.articles.lists.items -- gsl_articles.images - -### CRITIK -- Remove all files in /var/lib/gsl/db/ -- Use: ```gsl new domain```, give your registred DOMAIN name -- - Answer Y to autofix old configurations files and folders -- - Do it for each DOMAIN you registred -- - will add site_max_list=5 (default) in domain configuration file -- Use ```gsl check``` in your articles folder +### Add +- Stats : local link from slug (/...) counted after new check if added to www diff --git a/var/lib/gsl/scripts/gsl__db_manager b/var/lib/gsl/scripts/gsl__db_manager index 9071887..1680ea4 100644 --- a/var/lib/gsl/scripts/gsl__db_manager +++ b/var/lib/gsl/scripts/gsl__db_manager @@ -85,12 +85,19 @@ case "$1" in && return [[ $article_is_new ]] && return - [[ $article_Errors == "yes" ]] \ - && gsl__logs_print -e -A -inv \ - "Found errors ; Cannot continue" \ - "$PWD/$gsl_post" \ - && return - + if (( $article_Hash != $article_Status_chk ));then + gsl__logs_print -e -A -inv \ + "Article not checked yet" \ + "$PWD/$gsl_post" + return + + elif [[ $article_Errors == "yes" ]];then + gsl__logs_print -e -A -inv \ + "Found errors ; Cannot continue" \ + "$PWD/$gsl_post" + return + fi + gsl_do_make=true ;; esac diff --git a/var/lib/gsl/scripts/gsl__post_checkers b/var/lib/gsl/scripts/gsl__post_checkers index c5f6cfa..ecba397 100644 --- a/var/lib/gsl/scripts/gsl__post_checkers +++ b/var/lib/gsl/scripts/gsl__post_checkers @@ -104,6 +104,7 @@ if ! [[ "$header_f1" ]];then fi case "$1" in +# TYPE "$gsl_marker_type") gsl_post_type="$header_f1" @@ -122,7 +123,8 @@ case "$1" in ;; esac ;; - + +# CSS "$gsl_marker_css") gsl_post_css=" $header_f1" gsl__logs_print -i -h \ @@ -130,11 +132,13 @@ 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 @@ -172,7 +176,8 @@ case "$1" in date_epoch="$gsl_date_y-$gsl_date_m-$gsl_date_d $false_time" date_epoch=`date +%s -u -d "$date_epoch"` ;; - + +# SLUG "$gsl_marker_slug") gsl_post_slug="$header_f1" gsl_post_slug_src="$gsl_post_slug" @@ -232,7 +237,8 @@ case "$1" in done < <(grep -sl "article_Slug=\"$gsl_post_slug\"" \ $gsl_dir_db_domain/*.db) ;; - + +# AUTHOR "$gsl_marker_author") gsl_post_author="$header_f1" if ! [[ `grep "^$gsl_post_author$" "$gsl_file_domain_authors"` ]];then @@ -243,6 +249,7 @@ case "$1" in fi ;; +# INFO "$gsl_marker_info") gsl_post_info="$header_f1" if (( ${#gsl_post_info} <= 18 ));then @@ -253,6 +260,7 @@ case "$1" in fi ;; +# TAGS "$gsl_marker_tags") gsl_post_tags="$header_f1" gsl_stat_tags=`awk -F, '{print NF}' <<<$gsl_post_tags` @@ -391,6 +399,15 @@ if ! [[ `grep "\<_$header_f1\>" "$gsl_tmp_post"` ]];then return fi +# For online stats, convert /... url +# article not yet in www ; do not check status and count +case "$header_f2" in + "/"*) + [[ $gsl_srv_www_file ]] \ + && header_f2="$site_url$header_f2" + ;; +esac + # Get Online status case "$header_f2" in "http"*) diff --git a/var/lib/gsl/scripts/gsl__post_makers b/var/lib/gsl/scripts/gsl__post_makers index d2a208c..febdb47 100644 --- a/var/lib/gsl/scripts/gsl__post_makers +++ b/var/lib/gsl/scripts/gsl__post_makers @@ -230,7 +230,6 @@ fi ! [[ "$gsl_do_make" ]] && return - #---------------------------------------------------------------------- # Set HTML to replace first marker # Closed HTML are static > in gsl.conf @@ -628,8 +627,20 @@ make__file_bruts "$1" # $1: file post #====================================================================== make__file_images() { -this_image=`grep -n "$gsl_mark_image:$header_f1" "$1"` +unset ${!image_@} +link_class="${site_css}_image-link" +this_image=`grep -n "$gsl_mark_image:$header_f1" "$1" | head -n 1` [[ "$this_image" ]] || return +echo "$this_image" + + # local link with "+" or external link if http* + # $1: field + make__file_image_link() { + case "$1" in + "+") image_link="${srv_uri}images/$header_f2" ;; + "http"*|"ftp"*) image_link="$image_field_link" ;; + esac + } mark_image=${this_image#*:} # Get content mark to replace while IFS=: read -r "ln" \ @@ -640,51 +651,129 @@ while IFS=: read -r "ln" \ "height" \ "target" do - case "$class" in - R|r|D|d) image_class="${site_css}_image-right" ;; - G|g|L|l) image_class="${site_css}_image-left" ;; - C|c|D|d) image_class="${site_css}_image-center" ;; - "+") image_class="${site_css}_image-center";target=true ;; - "") image_class="${site_css}_image-center";unset width height ;; - *) image_class="$class";link_class=" $class" ;; - esac - - case "$width" in - "+") target=true;unset width ;; - esac +# Class + if [[ "$class" ]];then + image_field_link="$class$width" + case "$class" in + R|r|D|d) image_class="${site_css}_image-right" ;; + G|g|L|l) image_class="${site_css}_image-left" ;; + C|c|D|d) image_class="${site_css}_image-center" ;; - case "$height" in - "+") target=true;unset height ;; - esac + # Use this class if not known target + *) + make__file_image_link "$class" + if [[ $image_link ]];then + image_class="${site_css}_image-center" + unset width height + else + image_class="$class" + link_class+=" $class" + fi + ;; + esac + + else + image_class="${site_css}_image-center" + fi + +# Width + if [[ "$width" ]];then + image_field_link="$width$height" + make__file_image_link "$width" + if [[ $image_link ]];then + unset width height target + + else + image_width=` + grep -Eo '[[:alpha:]]+|[0-9]+' \ + <<<"$width" \ + | head -n 1` + if (( $image_width == 0 ));then + unset width + + else + image_unitw=${width/$image_width/} + ! [[ "$image_unitw" ]] && image_unitw="px" + fi + fi + fi + +# Height + if [[ "$height" ]];then + image_field_link="$height$target" + make__file_image_link "$height" + if [[ $image_link ]];then + unset height target + + else + image_height=` + grep -Eo '[[:alpha:]]+|[0-9]+' \ + <<<"$height" \ + | head -n 1` + if (( $image_height == 0 ));then + unset height + + else + image_unith=${height/$image_height/} + ! [[ "$image_unith" ]] && image_unith="px" + fi + fi + fi + +# Target + if [[ "$target" ]];then + image_field_link="$target" + make__file_image_link "$target" + fi + + +# Create HTML width & height for "` - - if [[ "$target" ]];then - image_clink="class=\"${site_css}_image-link$link_class\"" + + if [[ "$image_link" ]];then + link_css="class=\"$link_class\"" HTML_image=` printf '%s%s%s\n' \ - "" \ + "" \ "$HTML_image" \ ""` fi + + echo "$HTML_image" + echo + sed -i "${ln}s^$mark_image^$HTML_image^" "$1" + done <<<"$this_image" -sed -i "${ln}s^$mark_image^$HTML_image^" "$1" make__file_images "$1" } diff --git a/var/lib/gsl/scripts/gsl__srv_manager b/var/lib/gsl/scripts/gsl__srv_manager index 3f616fb..36d0898 100644 --- a/var/lib/gsl/scripts/gsl__srv_manager +++ b/var/lib/gsl/scripts/gsl__srv_manager @@ -300,12 +300,23 @@ case "$1" in log__process_begin "Sync $srv_proc" case "$1" in "") - sync__srv "$srv_proc" "$gsl_srv_wip" - sync__srv "$srv_proc" "$gsl_srv_www" + read -rp "! Sync Template for both wip and www (Y|*) ? " sync_ask + case "$sync_ask" in + Y) + sync__srv "$srv_proc" "$gsl_srv_wip" + sync__srv "$srv_proc" "$gsl_srv_www" + ;; + *) + echo "Abandon..." + exit + ;; + esac ;; + www) sync__srv "$srv_proc" "$gsl_srv_www" ;; + wip) sync__srv "$srv_proc" "$gsl_srv_wip" ;;