pre-beta version
This commit is contained in:
parent
be1951328c
commit
44b08ee5e0
141
CHANGELOG.md
141
CHANGELOG.md
|
@ -4,8 +4,147 @@ GSL changes from releases. You can send an issue :
|
|||
- repo: https://git.a-lec.org/echolib/gsl/-/issues
|
||||
- Contact xmpp: im@echolib.re
|
||||
|
||||
## [0.0.37]
|
||||
## [0.0.9]
|
||||
|
||||
## 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
- 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
|
||||
- wip ...: Same as www but for wip
|
||||
|
||||
### 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 ```<head>``` 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)
|
||||
- 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
|
||||
|
||||
|
||||
## [0.0.37]
|
||||
### Add
|
||||
- changelog
|
||||
- Make stats at each www call
|
||||
|
|
252
README.md
252
README.md
|
@ -2,10 +2,11 @@
|
|||
------------------------------------------------------------------------
|
||||
|
||||
GSL est un générateur de blogs/sites-web basé sur leur nom de domaine,
|
||||
écrit en bash, afin de ne réduire ses dépendances au minimum. Les pages
|
||||
écrit en bash, afin de réduire ses dépendances au minimum. Les pages
|
||||
générées sont presque entièrement statiques, à l'exception du module de
|
||||
liste des derniers articles. Nginx peut être facilement configuré pour
|
||||
interprêter ce module.
|
||||
liste des derniers articles (sidebar) placé en include. Nginx peut être
|
||||
facilement configuré pour interprêter ce module.
|
||||
|
||||
|
||||
# Dépendances
|
||||
------------------------------------------------------------------------
|
||||
|
@ -13,206 +14,179 @@ interprêter ce module.
|
|||
- bash
|
||||
- coreutils
|
||||
- curl (to check Posts links response)
|
||||
- rsync
|
||||
- rsync, nano
|
||||
|
||||
|
||||
# GSL: Installation
|
||||
------------------------------------------------------------------------
|
||||
Une procédure d'installation via un setup est en cours de test. Il est
|
||||
Une procédure d'installation via un setup est en préparation. Il est
|
||||
aussi possible et recommandé sous debian de l'installer grâce à son
|
||||
paquet deb.
|
||||
paquet deb (construit par make).
|
||||
|
||||
Pour une installation manuelle, clonez ce dépôt, et copiez les dossiers
|
||||
déjà pré-établis dans le système. GSL n'utilise pas sudo, il vous faut
|
||||
donc donner les droits aux dossiers (chown -R) à l'utilisateur
|
||||
(sauf au dossier /usr/local/bin). Pour ce dossier, vous donnerez les droits
|
||||
via chown USER:USER /usr/local/bin/gsl
|
||||
déjà pré-établis dans le système (avec sudo). GSL n'utilise pas sudo,
|
||||
il vous faut donc donner les droits des dossiers (chown -R) à l'utilisateur
|
||||
(sauf au dossier /usr/local/bin). Pour ce dossier, vous donnerez les
|
||||
droits au fichier gsl seulement
|
||||
|
||||
## Configuration du DOMAIN (selon le choix de l'utilistaeur via $ gsl new) :
|
||||
- HOME: ~/.config/gsl
|
||||
- GLOBAL: /var/lib/gsl
|
||||
- Dossier: --Prefix/domains/ (créé par GSL via $ gsl new)
|
||||
Reportez-vous à la documentation dans le dossier help
|
||||
|
||||
### Données du DOMAIN :
|
||||
- Dossier: --Prefix/DOMAIN/ (créé par GSL)
|
||||
- - Fichiers: DOMAIN.conf, authors.db (créé par GSL)
|
||||
- - Dossier: --Prefix/DOMAIN/templates/ (créé par GSL - pour vos css, logos...)
|
||||
|
||||
## Dossier de configuration de GSL : /etc/gsl/
|
||||
- Fichier: gsl.conf
|
||||
|
||||
## Dossier principal : /var/lib/gsl/
|
||||
- Folder: db (créé par GSL)
|
||||
- Dossier: helps
|
||||
- Dossier: scripts
|
||||
- Fichier: README.md, README-english.md
|
||||
|
||||
## Dossier des logs: /var/log/gsl/
|
||||
- Fichier: gsl.log (créé et géré par GSL via $ gsl log [OPT]...)
|
||||
|
||||
## Dossier de l'éxécutable : /usr/local/bin/
|
||||
- Fichier: gsl
|
||||
|
||||
## Dossier d'autocomplétion : /usr/share/bash-completion/completions/gsl/
|
||||
- Fichier: gsl
|
||||
|
||||
# Comment configurer un domaine
|
||||
------------------------------------------------------------------------
|
||||
Préparer un fichier de logo. L'important sera de renseigner le nom du
|
||||
fichier lors du questionnaire.
|
||||
|
||||
Attention: GSL aura besoin de créer des sous-dossier dans le serveur,
|
||||
renseigné dans le questionnaire. (i.e. /var/www/). Il faut donc lui
|
||||
donner les droits
|
||||
|
||||
``
|
||||
$ gsl new) domain
|
||||
```
|
||||
|
||||
Des questions vous seront posées lorsque vous voudrez ajouter un domaine
|
||||
(exemple.com). Les données renseignées seront utilisées pour créer le
|
||||
fichier DOMAIN.conf. Une question spécifique pour les fichier des articles
|
||||
vous sera posée afin d'établir un dossier de stockage de vos articles.
|
||||
Vous pourrez en créer à loisir autant que vous voulez plus tard.
|
||||
(exemple.com). Les données renseignées seront utilisées pour créer la
|
||||
configuration (voir la documentation d'installation)
|
||||
|
||||
```
|
||||
# helps
|
||||
gsl help
|
||||
gsl help new
|
||||
gsl help install
|
||||
|
||||
# Ajouter un domaine
|
||||
gsl new
|
||||
```
|
||||
|
||||
## Définir un dossier pour les articles du DOMAIN
|
||||
## Définir un dossier pour les articles du DOMAIN
|
||||
------------------------------------------------------------------------
|
||||
Si ce n'est pas déjà fait par GSL, ou que vous voulez ajouter un dossier
|
||||
pour y stocker et convertir en HTML vos articles pour un DOMAIN précis :
|
||||
pour y stocker vos articles bruts pour un DOMAIN précis :
|
||||
|
||||
- Ajouter/créer un dossier de votre choix
|
||||
```
|
||||
gsl help -d
|
||||
cd MYFOLDER
|
||||
gsl setdir
|
||||
```
|
||||
|
||||
ou:
|
||||
- Aller dans/créer un dossier de votre choix
|
||||
- Créer dedans, un fichier vide nommé gsl.DOMAIAN (gsl.exemple.com)
|
||||
|
||||
## Ajouter un auteur
|
||||
|
||||
## Ajouter / retirer un auteur
|
||||
------------------------------------------------------------------------
|
||||
Après avoir enregistré un domain et configuré un dossier pour les
|
||||
articles. **Un auteur par ligne !**
|
||||
|
||||
```
|
||||
cd MON-DOSSER-ARTICLES
|
||||
gsl author add
|
||||
gsl author edit
|
||||
```
|
||||
|
||||
|
||||
## Créer un article
|
||||
Le moteur de convertion est nouveau, et est un mélange entre markdown et
|
||||
------------------------------------------------------------------------
|
||||
Le moteur de convertion est nouveau. C'est un mélange entre markdown et
|
||||
reSTructuredText. Il est simple à apprendre et à utiliser.
|
||||
|
||||
- Créer un fichier (monarticle).gsl (extension .gsl)
|
||||
- Suivez le guide plus bas pour comprendre les notions
|
||||
|
||||
Vous devrez le faire valider par GSL :
|
||||
Reportez-vous à la documentation dans le dossier help, ou:
|
||||
```
|
||||
gsl check
|
||||
gsl check monarticle.gsl # Vérfier que monarticle.gsl
|
||||
gsl check -F Forcer la vérification
|
||||
gsl check -F monarticle.gsl # Forcer la vérification de monarticle.gsl
|
||||
gsl help -w
|
||||
```
|
||||
|
||||
## Convertir un ou tous les articles
|
||||
Si votre article n'a pas d'erreurs, vous pouvez le convertir en HTML.
|
||||
|
||||
```
|
||||
gsl make
|
||||
gsl make -F # Forcer la reconstruction)
|
||||
gsl make -F monarticle.gsl # Forcer la reconstruction de monarticle.gsl
|
||||
```
|
||||
|
||||
Votre article sera prêt dans le dossier webserver (ex: /var/www/DOMAIN/wip)
|
||||
Vous pourrez donc vérifier son rendu.
|
||||
|
||||
Si vous êtes satisfait, vous pouvez le déployer "officiellement" dans www
|
||||
|
||||
```
|
||||
# Vous pouvez utiliser l'autocompletion pour les articles
|
||||
gsl www add monarticle.gsl
|
||||
```
|
||||
## Procédures de prévisualisation et mise en ligne
|
||||
------------------------------------------------------------------------
|
||||
- gsl check monarticle.gsl (vérifie l'écriture en gsl)
|
||||
- gsl make monarticle.gsl (Connvertit en HTML - dossier wip)
|
||||
- gsl www add monarticle.gsl (copiel la page dans le dossier www)
|
||||
|
||||
|
||||
# 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 ddsirée. Le nombre
|
||||
d'articles maximum dans la sidebar est configurable dans /etc/gsl/gsl.conf
|
||||
|
||||
Quelques exemples d'utilisations
|
||||
d'articles maximum dans la sidebar est configurable dans le fichier de
|
||||
configuration du domaine (DOMAIN.conf)
|
||||
|
||||
```
|
||||
# Liste les articles de la sidebar dans l'ordre
|
||||
gsl sidebar
|
||||
|
||||
# Ajoute monarticle en position 1
|
||||
gsl -S add 1 monarticle
|
||||
|
||||
# Enlève monarticle2 de la sidebar
|
||||
gsl -S remove monarticle2
|
||||
|
||||
# monarticle5 est en position 3. Le replacer par monarticle4
|
||||
gsl -S -A 3 monarticle4
|
||||
gsl sidebar replace 2 monarticle.gsl
|
||||
```
|
||||
|
||||
# Besoin d'aide !
|
||||
## Astuces
|
||||
- Vous pouvez utiliser l'autocompletion pour les articles
|
||||
- Reportez-vous à la documentation dans le dossier Help
|
||||
|
||||
```
|
||||
gsl www add mona<TAB>
|
||||
```
|
||||
|
||||
|
||||
# Help
|
||||
------------------------------------------------------------------------
|
||||
Reportez vous aux explications dans le dossier *help*
|
||||
|
||||
|
||||
# HELP COMMAND
|
||||
------------------------------------------------------------------------
|
||||
```
|
||||
$ gsl [ARG]
|
||||
$ gsl (ARG)
|
||||
readme : Show README.md instructions
|
||||
help | -h [OPT] : This Help
|
||||
install : Show process installation
|
||||
new : Adding a DOMAIN
|
||||
write | -w : How to write a Post
|
||||
template | -t : Tips to create your template
|
||||
help | -h (OPT) : This Help and how to
|
||||
install | -i : Show process installation
|
||||
authors | -a : Add/Remove authors for this DOMAIN
|
||||
setdir | -d : Set a directory for article's DOMAIN
|
||||
write | -w : Write a Post
|
||||
tpl | -T : Create your template
|
||||
param | -p : Configure some parameters
|
||||
css : Show used CSS classes
|
||||
tips | -t : Show tips and advises you should know
|
||||
|
||||
new | -N : Add and configure a new DOMAIN
|
||||
|
||||
log | -L [OPTS] : Show logs from all sessions
|
||||
new | -N : Generic OPT to add/create
|
||||
domain : Configure your DOMAIN
|
||||
author : Same as gsl author edit
|
||||
(TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl
|
||||
|
||||
setdir | -D : Show current directory DOMAIN or set it
|
||||
|
||||
log | -L (OPTS) : Show logs from all sessions
|
||||
clean | -C : Logs saved to {DATE}.gsl.log and cleaned
|
||||
all : clean all saved logs, keep current
|
||||
-i | -w | -e : from levels (infos, warnings, errors)
|
||||
-s : from last session only
|
||||
[TERM] : [TERM] : case insensitive, regex 'T1.*T2'
|
||||
(TERM) : (TERM) : case insensitive, regex 'T1.*T2'
|
||||
(i.e. $ gsl log -e -s code)
|
||||
|
||||
author | -A [OPT] : List authors from DOMAIN set in PWD folder
|
||||
add : Add author(s) for DOMAIN
|
||||
remove : Remove author(s) for DOMAIN
|
||||
author | -A : List authors from DOMAIN in PWD folder
|
||||
edit : Add/Remove ! ONE author per line
|
||||
|
||||
create [TYPE] [NAME] : Create an article with [TYPE] named [NAME].gsl
|
||||
|
||||
edit | -E : Open in default EDITOR [FILE] or with nano
|
||||
edit | -E : Open in default EDITOR (FILE) or with nano
|
||||
conf : Domain configuration file
|
||||
[FILE] : [FILE] (.gsl)
|
||||
author : Same as gsl author edit
|
||||
domain : Domains registred database
|
||||
(FILE) : (FILE) ; .gsl
|
||||
|
||||
db [FILE] : Show DB statuses from [FILE]
|
||||
db (FILE) : Show DB statuses from (FILE)
|
||||
|
||||
sync [OPT] : Sync Templates to www and wip
|
||||
sync (OPT) : Sync Templates to www and wip
|
||||
wip : Only to wip server (also done with make)
|
||||
www : Only to www server (also done with www)
|
||||
|
||||
|
||||
check | -C [OPT] [FILE] : Check Posts errors from PWD folder or [FILE]
|
||||
-F : Force check again
|
||||
check | -C (OPTIONS) : Check Post(s) errors from PWD folder
|
||||
-N : Check only articles not in DB
|
||||
-F : Force Check again ; Recreate in Database
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE]
|
||||
to HTML file in server
|
||||
make | -M (OPTIONS) : Make all HTML articles or only (FILE)
|
||||
-F : Force Make again
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
www [OPT1] [OPT2] : Add/Remove Post from www server
|
||||
[OPT1]:
|
||||
add : Add all/[FILE] to www server
|
||||
rmove : remove all/[FILE] from www server
|
||||
[OPT2]:
|
||||
www (OPT1) (OPT2) : Add/Remove Post(s) in www server
|
||||
(OPT1):
|
||||
sync : Same as "sync www"
|
||||
add : Add all/(FILE) to www server
|
||||
rmove : remove all/(FILE) from www server
|
||||
(OPT2):
|
||||
all : Select all post with wip statuses
|
||||
[FILE] : Select specific post (if wip status)
|
||||
(FILE) : Select specific post (if wip status)
|
||||
|
||||
wip : Same as www for wip
|
||||
|
||||
sidebar | -S [ARG] [FILE]: Show Posts in list
|
||||
[ARG]:
|
||||
add | -A : Must set a Position number before [FILE]
|
||||
Max posts in list is set in gsl.conf
|
||||
Replace post position if post not exists in list
|
||||
remove | -R : No Position to set, just [FILE].
|
||||
add/remove will build last-posts-list.html
|
||||
create | -C : rebuild last-posts-list.html
|
||||
sidebar | -S : Show Posts in list (ARG) (POS) (FILE)
|
||||
(ARG):
|
||||
add | -a : Put article at (POS). Remove last, roll from (POS)
|
||||
replace | -r : Replace (POS) with article
|
||||
latest | -l : Create sidebar with latest (remove all existing)
|
||||
|
||||
-v : Show local versionn
|
||||
--version : Like -v + changes
|
||||
-vv : Shown local and repo Versions
|
||||
```
|
||||
|
||||
|
|
4
control
4
control
|
@ -1,10 +1,10 @@
|
|||
Package: egsl
|
||||
Version: 0.0.37
|
||||
Version: 0.0.9
|
||||
Section: custom
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Essential: no
|
||||
Depends: curl,rsync
|
||||
Depends: curl,rsync,nano
|
||||
Installed-Size: `du -ks usr|cut -f 1`
|
||||
Maintainer: echolib <echolib@a-lec.org>
|
||||
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.
|
||||
|
|
216
etc/gsl/gsl.conf
216
etc/gsl/gsl.conf
|
@ -3,105 +3,121 @@
|
|||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#=======================================================================
|
||||
# Set GSL Internal Configuration
|
||||
#=======================================================================
|
||||
# minimum size to check a post (default: 180)
|
||||
gsl_article_min_Size=180
|
||||
|
||||
#=======================================================================
|
||||
# Folders
|
||||
#=======================================================================
|
||||
# Show log by time|level (default: 'time'); not set = level
|
||||
gsl_log_order=time
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# # Directories Structure
|
||||
#----------------------------------------------------------------------
|
||||
# Main
|
||||
app_name="gsl"
|
||||
|
||||
# Librairies
|
||||
gsl_dir_lib="/var/lib/gsl"
|
||||
gsl_dir_scripts="$gsl_dir_lib/scripts"
|
||||
gsl_dir_helps="$gsl_dir_lib/helps"
|
||||
|
||||
# Management
|
||||
gsl_dir_db="$gsl_dir_lib/db"
|
||||
gsl_dir_global_domains="/var/lib/gsl/domains"
|
||||
|
||||
# Logs
|
||||
gsl_dir_help="$gsl_dir_lib/help"
|
||||
gsl_dir_logs="/var/log/gsl"
|
||||
|
||||
# User
|
||||
gsl_dir_user_domains="/home/$USER/.config/gsl/domains"
|
||||
gsl_dir_domains="$gsl_dir_lib/domains"
|
||||
gsl_dir_db="$gsl_dir_lib/db"
|
||||
|
||||
#======================================================================
|
||||
# iNSTALLATION DEPENDANCIES
|
||||
#======================================================================
|
||||
gsl_dirs=(
|
||||
$gsl_dir_lib
|
||||
$gsl_dir_scripts
|
||||
$gsl_dir_domains
|
||||
$gsl_dir_db
|
||||
$gsl_dir_logs
|
||||
$gsl_dir_help
|
||||
)
|
||||
|
||||
gsl_files_scripts=(
|
||||
$gsl_dir_scripts/gsl__db_manager
|
||||
$gsl_dir_scripts/gsl__do_commons
|
||||
$gsl_dir_scripts/gsl__domain_manager
|
||||
$gsl_dir_scripts/gsl__edit_file
|
||||
$gsl_dir_scripts/gsl__HTML_template
|
||||
$gsl_dir_scripts/gsl__log_manager
|
||||
$gsl_dir_scripts/gsl__post_checkers
|
||||
$gsl_dir_scripts/gsl__post_makers
|
||||
$gsl_dir_scripts/gsl__post_manager
|
||||
$gsl_dir_scripts/gsl__srv_manager
|
||||
$gsl_dir_scripts/gsl__stats
|
||||
$gsl_dir_scripts/gsl__version
|
||||
)
|
||||
|
||||
gsl_files_help=(
|
||||
$gsl_dir_help/comment_ecrire-article.md
|
||||
$gsl_dir_help/gsl_help.md
|
||||
$gsl_dir_help/comment_installer-GSL.md
|
||||
$gsl_dir_help/template-comment-creer.md
|
||||
$gsl_dir_help/how_to-set_directory_for_articles.md
|
||||
$gsl_dir_help/how_to-add_remove_authors.md
|
||||
$gsl_dir_help/how_to-parameters_conf.md
|
||||
$gsl_dir_help/how_to-CSS_classes.md
|
||||
$gsl_dir_help/how_to-Tips_Advises.md
|
||||
)
|
||||
|
||||
gsl_dirs_w=(
|
||||
$gsl_dir_domains
|
||||
$gsl_dir_db
|
||||
$gsl_dir_logs
|
||||
)
|
||||
|
||||
#=======================================================================
|
||||
# Files
|
||||
#=======================================================================
|
||||
# Logs
|
||||
gsl_file_db_domains="$gsl_dir_db/domains.db"
|
||||
gsl_file_logs="$gsl_dir_logs/gsl.log"
|
||||
|
||||
# Management
|
||||
gsl_file_db_domains="$gsl_dir_db/domains.db"
|
||||
gsl_file_db_posts="$gsl_dir_db/posts.db"
|
||||
gsl_file_db_files="$gsl_dir_db/files.db"
|
||||
# colors
|
||||
NC="\e[0m"
|
||||
CY="\e[33m"
|
||||
CR="\e[0;91m"
|
||||
|
||||
# Registred Authors filename
|
||||
gsl_filename_auth="authors.db"
|
||||
|
||||
#=======================================================================
|
||||
# GSL Internal Configuration
|
||||
#=======================================================================
|
||||
# minimum size to check a post
|
||||
gsl_post_min_size=150
|
||||
|
||||
# Max Posts list in sidebar
|
||||
gsl_list_max_posts=5
|
||||
|
||||
# Init log datas
|
||||
gsl_log_e='Err'
|
||||
gsl_log_w='War'
|
||||
#----------------------------------------------------------------------
|
||||
# LOGS settings
|
||||
#----------------------------------------------------------------------
|
||||
gsl_log_e="Err"
|
||||
gsl_log_w="War"
|
||||
gsl_log_i='Inf'
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Set LOG help Activity for NEEDED HEADERS
|
||||
#-----------------------------------------------------------------------
|
||||
gsl_log_act_title='POST TITLE'
|
||||
gsl_log_act_type="'page' or 'post'"
|
||||
gsl_log_act_title='ARTICLE TITLE'
|
||||
gsl_log_act_author='REGISTRED NAME'
|
||||
gsl_log_act_info='POST is ABOUT...'
|
||||
gsl_log_act_slug='POST-TITLE'
|
||||
gsl_log_act_code='NBR : FILENAME : Alt Text'
|
||||
gsl_log_act_image='NBR : NAME : ALT TEXT'
|
||||
gsl_log_act_info='it is about...'
|
||||
gsl_log_act_slug='THIS-SLUG'
|
||||
gsl_log_act_fcode='NBR : FILENAME : Alt Text'
|
||||
gsl_log_act_fbrut='NBR : FILENAME'
|
||||
gsl_log_act_flink='NAME : FILENAME : Alt Text'
|
||||
gsl_log_act_image='NBR : FILENAME : ALT TEXT'
|
||||
gsl_log_act_abbr='SHORT : LONG'
|
||||
gsl_log_act_h1='#1 POST CONTENT TITLE'
|
||||
gsl_log_act_link='NAME : URL : Alt Text'
|
||||
gsl_log_act_file='NAME : FILENAME : Alt Text'
|
||||
gsl_log_act_link='NAME : URL : Alt-Text'
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Set LOG for Process Type
|
||||
#-----------------------------------------------------------------------
|
||||
gsl_log_h_link="Header Link"
|
||||
gsl_log_h_abbr="Header ABBR"
|
||||
gsl_log_h_code="Header Code"
|
||||
gsl_log_h_image="Header Image"
|
||||
gsl_log_h_file="Header File"
|
||||
gsl_log_h_image="Header Image"
|
||||
|
||||
gsl_log_c_h1="Content Begins"
|
||||
gsl_log_c_p="Content Paragraphs"
|
||||
gsl_log_c_cite="Content Citations"
|
||||
gsl_log_c_link="Content Link"
|
||||
gsl_log_c_abbr="Content ABBR"
|
||||
gsl_log_c_code="Content Code"
|
||||
gsl_log_c_image="Content Image"
|
||||
gsl_log_c_file="Content File"
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Set CONTENT POST markers
|
||||
#-----------------------------------------------------------------------
|
||||
gsl_mo_p='('
|
||||
gsl_mc_p=')'
|
||||
gsl_mark_file='__'
|
||||
#----------------------------------------------------------------------
|
||||
# CONTENT Article markers
|
||||
#----------------------------------------------------------------------
|
||||
gsl_mark_p_start='('
|
||||
gsl_mark_p_close=')'
|
||||
gsl_mark_flink='__'
|
||||
gsl_mark_image='_image'
|
||||
gsl_mark_fcode='_code'
|
||||
gsl_mark_fbrut='_brut'
|
||||
gsl_mark_title='#'
|
||||
gsl_mark_bold='\*'
|
||||
gsl_mark_strong='\*\*'
|
||||
gsl_mark_italic='\/'
|
||||
gsl_mark_code="¤"
|
||||
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_link='_'
|
||||
gsl_mark_blockquote='---'
|
||||
gsl_mark_blockquote_cite='_cite :'
|
||||
gsl_mark_blockquote_year='_year :'
|
||||
|
@ -109,27 +125,35 @@ gsl_mark_blockquote_link='_link :'
|
|||
gsl_mark_blockquote_book='_book :'
|
||||
gsl_mark_blockquote_lang='_lang :'
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Set HEADERS markers
|
||||
#-----------------------------------------------------------------------
|
||||
# type: page / post
|
||||
gsl_marker_type='type: '
|
||||
gsl_marker_title='title: '
|
||||
gsl_marker_slug='slug: '
|
||||
gsl_marker_info='info: '
|
||||
gsl_marker_author='author: '
|
||||
gsl_marker_date='date: '
|
||||
gsl_marker_tags='tags: '
|
||||
#----------------------------------------------------------------------
|
||||
# HEADERS markers
|
||||
#----------------------------------------------------------------------
|
||||
# Needed HEADER markers
|
||||
gsl_marker_type='type:'
|
||||
gsl_marker_title='title:'
|
||||
gsl_marker_slug='slug:'
|
||||
gsl_marker_info='info:'
|
||||
gsl_marker_author='author:'
|
||||
gsl_marker_date='date:'
|
||||
gsl_marker_tags='tags:'
|
||||
|
||||
#Optional (include brut text)
|
||||
gsl_marker_code='code: '
|
||||
gsl_marker_image='image: '
|
||||
gsl_marker_abbr='abbr: '
|
||||
gsl_marker_link='link: '
|
||||
gsl_marker_file='file: '
|
||||
# Optional HEADER markers
|
||||
gsl_marker_css='css:'
|
||||
gsl_marker_fcode='code:'
|
||||
gsl_marker_fbrut='brut:'
|
||||
gsl_marker_image='image:'
|
||||
gsl_marker_abbr='abbr:'
|
||||
gsl_marker_link='link:'
|
||||
gsl_marker_flink='file:'
|
||||
|
||||
# Delimiters to seet for sed in case exists in inline-code
|
||||
gsl_d=(\, \. \? \% \# \- \: \^ \/ \_ \| )
|
||||
# Closed HTML static code
|
||||
HTML_strike_close='</strike>'
|
||||
HTML_icode_close='</code>'
|
||||
HTML_em_close='"</i>'
|
||||
HTML_strong_close='</strong>'
|
||||
HTML_bold_close='</b>'
|
||||
HTML_br='<br />'
|
||||
HTML_p_close='</p>'
|
||||
|
||||
# Onlinde Repo
|
||||
repo="https://git.a-lec.org/echolib/gsl/-/raw/main/usr/local/bin/gsl"
|
||||
|
|
|
@ -1,310 +0,0 @@
|
|||
# Créer un fichier depuis la ligne de commande
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Vous pouvez créer un fichier daté du jour avec les METAS obligatoires
|
||||
intégrés (à renseigner après). Vous devez spécifier si votre article
|
||||
sera une page ou un post (Voir section plus bas) et lui donner un nom.
|
||||
|
||||
Rendez vous dans le dossier de vos articles, enregistrés lors de l'ajout
|
||||
de votre domaine (ou celui que vous avez configuré).
|
||||
|
||||
Évitez les espaces dans le nom du fichier ou utilisez des guillemets.
|
||||
|
||||
```
|
||||
# Crréer une page nommée index
|
||||
gsl create page index
|
||||
|
||||
# Créer un article nommé mes-vacances
|
||||
gsl create post mes-vacances
|
||||
```
|
||||
|
||||
Vous pouvez l'éditer dans le terminal ou avec votre éditeur de texte.
|
||||
|
||||
```
|
||||
gsl edit mes-vacances.gsl
|
||||
```
|
||||
|
||||
# Comment écrire un article
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Votre article doit contenir 2 sections. Les METAS avant ```#1``` et
|
||||
l'article à partir de ce repère (servant de titre h1).
|
||||
|
||||
- METAS : configurer votre article (titre, date, liens...)
|
||||
- ARTICLE : contenue rédactionnel avec quelques marqueurs (gras...)
|
||||
|
||||
## METAS obligatoires (avant #1)
|
||||
|
||||
```
|
||||
title: POST TITLE
|
||||
slug: POST-TITLE (si espaces, GSL les convertira en -)
|
||||
info: DESCRIPTION (À propos de cet article)
|
||||
author: NAME (doit être enregistré via ($ gsl author add)
|
||||
date: YYYY-MM-DD
|
||||
tags: TAG1,Mon TAG2,TAG3 (séparé par une virgule)
|
||||
```
|
||||
|
||||
### Page ou Article ?
|
||||
|
||||
Vous pouvez spécifier pour chaque article si c'est une page ou un article
|
||||
Si non renseigné, GSL ajoutera le type: post (article) par défaut à la
|
||||
première ligne de votre article
|
||||
|
||||
```
|
||||
# Page (index, 404, about...)
|
||||
# Création HTML selon le slug: /POST-TITLE.html
|
||||
type: page
|
||||
|
||||
# Article (monarticle)
|
||||
# Création HTML selon le slug: /POST-TITLE/index.html
|
||||
type: post
|
||||
```
|
||||
|
||||
## METAS optionnelles (avant ```#1```)
|
||||
|
||||
Définir les marqueurs (abbr:, link:...) et utiliser ``` : ``` comme séparateur
|
||||
|
||||
```
|
||||
abbr: COURT : LONG
|
||||
file: NOM : NOM-DU-FICHIER : Text alternatif
|
||||
link: NOM : URL : Text alternatif
|
||||
code: NUMERO : NOM-DU-FICHIER : Text alternatif
|
||||
image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF
|
||||
```
|
||||
|
||||
## Contenu de l'article:
|
||||
|
||||
Les marqueurs *et leur contenu* (ex: ```= list 1...```, ```*__monfichier...```)
|
||||
**doivent commencer et finir sur la même ligne**.
|
||||
|
||||
### Abréviations
|
||||
Définir en METAS...
|
||||
|
||||
```
|
||||
abbr: CSS : Cascading Style Sheets
|
||||
```
|
||||
|
||||
Dans l'article:
|
||||
|
||||
```
|
||||
Les propriétés CSS ne sont pas définies
|
||||
```
|
||||
|
||||
### Paragraphes
|
||||
|
||||
Au début d'une nouvelle ligne, ouvrez avec ( et fermez avec ).
|
||||
Vous pouvez utiliser 4 classes de paragraphes différentes : ( 1 ( 2 ( 3
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
( 2
|
||||
Paragraphe avec une classe 2 (css)
|
||||
)
|
||||
|
||||
(
|
||||
Paragraphe sans numéro de classe
|
||||
)
|
||||
```
|
||||
|
||||
### Liens
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
link: Mon lien : URL : Alt text
|
||||
link: https://a-lec.org/ : URL : Alt text
|
||||
```
|
||||
|
||||
Dans l'article..
|
||||
- Écrivez ```_``` devant le nom du lien
|
||||
- Ajoutez ```+``` pour ouvrir le lien dans un nouvel onglet
|
||||
|
||||
```
|
||||
Visitez _Mon lien+ et charger ici la page _https://a-lec.org/
|
||||
```
|
||||
|
||||
### Fichiers
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
file: Mon fichier : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
__Mon fichier
|
||||
```
|
||||
|
||||
### Images
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
image: 1 : FILENAME : ALT-TEXT
|
||||
image: 2 : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
Définir le marqueur ```_image``` sur une seule ligne et spécifiez les
|
||||
valeurs séparées par ":"
|
||||
|
||||
- Numero d'image
|
||||
- Alignement: l,r, ou c (g,d également) pour gauche, droite, centre)
|
||||
- Longueur width: juste le nombre
|
||||
- Largeur height: juste le nombre
|
||||
- Champ non vide: Lien de l'image dans un nouvel onglet
|
||||
|
||||
Exemple d'images affichées l'une à côté de l'autre
|
||||
|
||||
```
|
||||
(
|
||||
_image:1
|
||||
_image:2:c:640:480
|
||||
_image:3:c:320:240:+
|
||||
)
|
||||
```
|
||||
|
||||
Exemple d'images affichées l'une en dessous de l'autre, dont la première
|
||||
peut s'ouvrir dans un nouvel onglet
|
||||
|
||||
```
|
||||
(
|
||||
_image:1:c:640:480:+
|
||||
)
|
||||
(
|
||||
_image:2:c:1920:1080
|
||||
)
|
||||
```
|
||||
|
||||
### Block-Code depuis un fichier
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
code: 1 : FILENAME : Alt Text
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
_code:1
|
||||
```
|
||||
|
||||
### Écrire en très gras
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
**c'est du surgras**
|
||||
c'est in**défini**ssable
|
||||
il ad**juge** : pas de pub !
|
||||
```
|
||||
|
||||
### Gras
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
*c'est en gras*
|
||||
```
|
||||
|
||||
### Italique
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
C'est /en italique/
|
||||
```
|
||||
|
||||
### Code en ligne
|
||||
|
||||
Info: ¤ = alt-gr + $ sur un clavier FR azerty)
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
¤gsl help -w¤
|
||||
```
|
||||
|
||||
### Citation simple
|
||||
|
||||
(au début de la ligne, mettez 3x -)
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
---
|
||||
(
|
||||
Une citation simple dans un paragraphe
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
---
|
||||
_cite : Richard Matthew Stallman
|
||||
_link : https://stallman.org/
|
||||
_lang : en
|
||||
(
|
||||
In the free/libre software movement, we develop software that respects
|
||||
users' freedom, so we and you can escape from software that doesn't. I
|
||||
could have made money this way, and perhaps amused myself writing code.
|
||||
But I knew that at the end of my career, I would look back on years of
|
||||
building walls to divide people, and feel I had spent my life making the
|
||||
world a worse place
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée : optionnel
|
||||
|
||||
Ajoutez ces marqueurs, si connus dans la citation, par ex sous ```_cite```
|
||||
|
||||
```
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
```
|
||||
|
||||
|
||||
### Créer des listes
|
||||
L'arborescence est "infinie".
|
||||
- Chaque contenu de la liste **doit être sur la même ligne**
|
||||
|
||||
Dans l'article...
|
||||
- utilisez ```=``` pour définir l'arborescence d'une liste simple (ul)
|
||||
- utilisez ```+``` pour définir une liste ordonnée (ol)
|
||||
|
||||
```
|
||||
(
|
||||
Voici une liste simple
|
||||
= Fruits : *mangez-en*
|
||||
== Kiwis
|
||||
== Fraises
|
||||
=== pas mûres
|
||||
== Bananes
|
||||
=== Plantins
|
||||
= Légumes
|
||||
== Haricots
|
||||
=== Rouges
|
||||
=== Verts
|
||||
Fin de la liste
|
||||
)
|
||||
```
|
||||
|
||||
### Ajouter des lignes vides
|
||||
|
||||
Vous pouvez ajouter des ```<br />``` dans votre rédaction, mais pour une
|
||||
lecture plus propre de votre article, vous pouvez utiliser le caractère
|
||||
```|``` *au tout début d'une nouvelle ligne*
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
#1 Mon titre
|
||||
(
|
||||
Ceci est un long paragraphe (Un peu d'imagination...)
|
||||
|
|
||||
Retour "forcé" à la ligne
|
||||
)
|
||||
|
||||
```
|
|
@ -0,0 +1,16 @@
|
|||
# Configurations optionnelles de GSL
|
||||
|
||||
Vous pouvez configurer quelques paramètres dans le fichier
|
||||
**/etc/gsl/gsl.conf**
|
||||
|
||||
## Afficher les logs par chronologie
|
||||
```
|
||||
# Show log by time|level (default: 'time'); not set = level
|
||||
gsl_log_order=time
|
||||
```
|
||||
|
||||
## Définir la taille en octets minimum d'un fichier
|
||||
```
|
||||
# Par défaut: 180
|
||||
gsl_article_min_Size=250
|
||||
```
|
|
@ -0,0 +1,363 @@
|
|||
# Créer un article depuis la ligne de commande
|
||||
------------------------------------------------------------------------
|
||||
Vous pouvez créer un article daté du jour avec les METAS obligatoires
|
||||
intégrées (à renseigner après) depuis la ligne de commande. Vous devez
|
||||
spécifier si votre article sera une page ou un post (Voir section plus
|
||||
bas), et lui donner un nom. Les metas optionnelles sont ajoutées enn
|
||||
commentaires.
|
||||
|
||||
Rendez vous dans le dossier de vos articles, enregistrés lors de l'ajout
|
||||
de votre domaine (ou celui que vous avez configuré).
|
||||
|
||||
Mettez des guillemets pour les nom du fichier avec espaces.
|
||||
|
||||
```
|
||||
# Crréer une page nommée index (deviendra /index.html)
|
||||
gsl new page index
|
||||
|
||||
# Créer un article nommé "mes vacances"
|
||||
gsl ew post "mes vacances"
|
||||
```
|
||||
|
||||
Vous pouvez l'éditer dans le terminal ou avec votre éditeur de texte, en
|
||||
utilisant l'autocompletion (<tab>)
|
||||
|
||||
```
|
||||
gsl edit "mes vacances.gsl"
|
||||
```
|
||||
|
||||
|
||||
# Comment écrire un article
|
||||
------------------------------------------------------------------------
|
||||
Votre article doit contenir 2 sections. Les METAS avant ```#1``` et
|
||||
l'article à partir de ce repère (servant de titre h1).
|
||||
|
||||
- METAS : configurer votre article (titre, date, liens...)
|
||||
- ARTICLE : contenue rédactionnel avec quelques marqueurs (gras...)
|
||||
|
||||
## METAS obligatoires (avant ```#1```)
|
||||
**Écrire sur une seule ligne** chaque META
|
||||
|
||||
```
|
||||
type: page
|
||||
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
|
||||
tags: TAG1,Mon TAG2,TAG3 (séparé par une virgule)
|
||||
```
|
||||
|
||||
### Page ou Article ?
|
||||
Vous devez spécifier pour chaque article si c'est une **page** ou un
|
||||
**post**
|
||||
|
||||
#### Page (index, 404, about...)
|
||||
Création HTML à la racine selon le slug: /MY-SLUG.html
|
||||
|
||||
```
|
||||
type: page
|
||||
slug: 404
|
||||
```
|
||||
|
||||
#### Post (monarticle)
|
||||
Création HTML dans un dossier selon le slug: /MY-SLUG/index.html
|
||||
**! Le slug ne doit pas commencer par un /**
|
||||
|
||||
```
|
||||
type: post
|
||||
slug: service/xmpp/configurer-gajim
|
||||
```
|
||||
|
||||
## METAS optionnelles (avant ```#1```)
|
||||
Définir UN seul marqueur CSS par article pour personnaliser chaque
|
||||
article avec sa propre CSS.
|
||||
|
||||
```
|
||||
css: myID
|
||||
```
|
||||
|
||||
Définir un ou plusieurs de ces marqueurs et utiliser ``` : ``` comme
|
||||
séparateur
|
||||
|
||||
```
|
||||
abbr: COURT : LONG
|
||||
file: NOM : NOM-DU-FICHIER : Text alternatif
|
||||
link: NOM : URL : Text alternatif
|
||||
code: NUMERO : NOM-DU-FICHIER : Text alternatif
|
||||
brut: NUMERO : NOM-DU-FICHIER
|
||||
image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF
|
||||
```
|
||||
|
||||
## Contenu de l'article:
|
||||
Les marqueurs (hors listes) *et leur contenu* (ex: ```__monfichier...```)
|
||||
**doivent être sur la même ligne**.
|
||||
|
||||
Les marqueurs à retenir et leur Combinaison de touches sur un clavier
|
||||
azerty français
|
||||
|
||||
- Très gras: '•...•' (alt+gr + ;)
|
||||
- Gras: '·...·' (alt+gr + :)
|
||||
- Italique: '”...”' (alt+gr + n)
|
||||
- Barré: '×...×' (alt+gr + shift + ;)
|
||||
- Code: '¤...¤' (alt+gr + $)
|
||||
|
||||
### É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 !
|
||||
```
|
||||
|
||||
### Écrire en gras
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
·Tout est en gras·
|
||||
```
|
||||
|
||||
### Écrire en Italique
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
C'est ”en italique”
|
||||
```
|
||||
|
||||
### Créer un texte "barré"
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
La réunion aura lieu ×demain× dans une semaine
|
||||
```
|
||||
|
||||
### Écrire un Code en ligne
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
¤gsl help -w && echo "Be Happy"¤
|
||||
```
|
||||
|
||||
### Abréviations
|
||||
Définir en METAS... (SHORT doit être en **lettres CAPITALES**)
|
||||
|
||||
```
|
||||
abbr: CSS : Cascading Style Sheets
|
||||
```
|
||||
|
||||
Dans l'article:
|
||||
|
||||
```
|
||||
Les propriétés CSS ne sont pas définies
|
||||
```
|
||||
|
||||
### Paragraphes
|
||||
Au début d'une nouvelle ligne, ouvrez avec ( et fermez avec ).
|
||||
Vous pouvez définir le nom de la classe du paragraphe en ajoutant la
|
||||
valeur désirée ; par exemple : p3
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
( p3
|
||||
Paragraphe avec une classe p3 en css
|
||||
)
|
||||
|
||||
(
|
||||
Paragraphe sans classe
|
||||
)
|
||||
```
|
||||
|
||||
### Liens
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
link: Mon lien : URL : Alt text
|
||||
link: https://a-lec.org/ : URL : Alt text
|
||||
```
|
||||
|
||||
Dans l'article..
|
||||
- Écrivez ```_``` devant le nom du lien
|
||||
- Ajoutez ```+``` pour ouvrir le lien dans un nouvel onglet
|
||||
|
||||
```
|
||||
Visitez _Mon lien+ et charger ici la page _https://a-lec.org/
|
||||
```
|
||||
|
||||
### Fichiers
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
file: Mon fichier : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
__Mon fichier
|
||||
```
|
||||
|
||||
### Images
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
image: 1 : FILENAME : ALT-TEXT
|
||||
image: 2 : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
Définir le marqueur ```_image``` sur une seule ligne 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
|
||||
|
||||
- Numero d'image
|
||||
- Alignement: l,r,(g,d également),c pour gauche, droite, centre)
|
||||
- - maclasse au lieu de l,r,c pour utiliser la classe css "maclasse"
|
||||
- - + (class="center")
|
||||
- Longueur width: (avec unité)
|
||||
- - + (taille originale)
|
||||
- Largeur height: (avec unité)
|
||||
- - + (longueur définie, largeur originale)
|
||||
- Champ non vide: Lien de l'image dans un nouvel onglet
|
||||
|
||||
Exemple d'images affichées l'une à côté de l'autre
|
||||
|
||||
```
|
||||
(
|
||||
_image:1
|
||||
_image:2:c:640px:25%
|
||||
_image:3:maclass:320px:240px:+
|
||||
)
|
||||
```
|
||||
|
||||
Exemple d'images affichées l'une en dessous de l'autre, dont la première
|
||||
s'ouvrir dans un nouvel onglet avec sa taille originale et la classe css
|
||||
center
|
||||
|
||||
```
|
||||
(
|
||||
_image:1:+
|
||||
)
|
||||
(
|
||||
_image:2:c:1920px:25%
|
||||
)
|
||||
```
|
||||
|
||||
### Block-Code depuis un fichier
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
code: python : FILENAME : Alt Text
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
_code:python
|
||||
```
|
||||
|
||||
### IMPORT de code brut (sera exécuté par le navigateur)
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
brut : 1 : FILENAME
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
_brut:1
|
||||
```
|
||||
|
||||
### Citation simple
|
||||
Définissez un bloc pour la citation. Utilisez ```---```
|
||||
Vous pouvez définir une classe CSS spécifique ```--- ma-classe-css```
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
---
|
||||
(
|
||||
Une citation simple dans un paragraphe
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée
|
||||
Dans l'article... Stallman est une classe CSS
|
||||
```
|
||||
--- Stallman
|
||||
_cite : Richard Matthew Stallman
|
||||
_link : https://stallman.org/
|
||||
_lang : en
|
||||
(
|
||||
In the free/libre software movement, we develop software that respects
|
||||
users' freedom, so we and you can escape from software that doesn't. I
|
||||
could have made money this way, and perhaps amused myself writing code.
|
||||
But I knew that at the end of my career, I would look back on years of
|
||||
building walls to divide people, and feel I had spent my life making the
|
||||
world a worse place
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée : données optionnelles
|
||||
Ajoutez ces marqueurs, si connus dans la citation
|
||||
|
||||
```
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
```
|
||||
|
||||
|
||||
### Créer des listes
|
||||
L'arborescence est "infinie".
|
||||
- Définir le début d'une liste par ```<<``` et sa fin par ```>>```
|
||||
- Définir une classe CSS après ```<< ```
|
||||
|
||||
Dans l'article...
|
||||
- utilisez ```=``` pour définir une liste simple (ul)
|
||||
- utilisez ```+``` pour définir une liste ordonnée (ol)
|
||||
- Mixez les 2 (dans la limite de ma patience :D)
|
||||
|
||||
```
|
||||
(
|
||||
Voici une liste simple
|
||||
<<
|
||||
= Fruits : *mangez-en*
|
||||
== Kiwis
|
||||
== Fraises
|
||||
=== pas mûres
|
||||
== Bananes
|
||||
=== Plantins
|
||||
= Légumes
|
||||
== Haricots
|
||||
=== Rouges
|
||||
=== Verts
|
||||
>>
|
||||
)
|
||||
|
||||
Voici une liste mixe avec sa classe "couverture"
|
||||
<< couverture
|
||||
= Livre 1
|
||||
+ Chapitre 1
|
||||
+ Chaptire 2
|
||||
++ Résumé du Ch 2
|
||||
= Livre 2
|
||||
+ Chapitre 1
|
||||
>>
|
||||
```
|
||||
|
||||
### Ajouter des lignes vides
|
||||
Vous pouvez ajouter des ```<br />``` dans votre rédaction, mais pour une
|
||||
lecture plus propre de votre article, vous pouvez utiliser le caractère
|
||||
```|``` **au tout début d'une nouvelle ligne**. Pratique dans les
|
||||
paragraphes.
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
#1 Mon titre
|
||||
(
|
||||
Ceci est un long paragraphe (Un peu d'imagination...)
|
||||
|
|
||||
Retour "forcé" à la ligne
|
||||
)
|
||||
```
|
|
@ -0,0 +1,84 @@
|
|||
# Comment installer GSL: Statique Littératueur
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Un script d'installation install.sh est prévu, mais pas encore proposé.
|
||||
- Un .deb peut être créé (merci neox) depuis le make de l'archive
|
||||
|
||||
## Installation manuelle
|
||||
- git clone https://git.a-lec.org/echolib/gsl && cd gsl
|
||||
- Commencez par créer les dossiers de base (voir ci-dessous)
|
||||
- Donnez leur les droits nécessaires
|
||||
|
||||
GSL n'utilise pas de droits sudo, et a besoin pour écrire certains
|
||||
fichiers et créer certains dossiers d'être propriétaire ou d'avoir les
|
||||
droits en écriture des dossiers
|
||||
|
||||
```
|
||||
# Pour le dossier du binaire
|
||||
sudo rsync -a usr/local/bin/gsl /usr/local/bin/gsl
|
||||
sudo chown USER:GROUP/usr/local/bin/gsl
|
||||
|
||||
# Pour les dossiers de scripts
|
||||
sudo mkdir -p "/var/lib/gsl"
|
||||
sudo chown -R USER:GROUP "/var/lib/gsl"
|
||||
rsync -a var/lib/gsl/ /var/lib/gsl/
|
||||
|
||||
# Pour le dossier de logs
|
||||
sudo mkdir -p "/var/log/gsl"
|
||||
sudo chown -R USER:GROUP "/var/log/gsl"
|
||||
|
||||
# Pour le dossier de configuration
|
||||
sudo mkdir -p /etc/gsl
|
||||
sudo chown -R USER:GROUP "/etc/gsl"
|
||||
|
||||
# Pour l'autocompletion des articles dans la commande
|
||||
sudo rsync -a usr/share/bash-completion/completions/gsl /usr/share/bash-completion/completions/gsl
|
||||
sudo chown USER:GROUP "/usr/share/bash-completion/completions/gsl"
|
||||
```
|
||||
|
||||
Attention: GSL aura besoin de créer des sous-dossier dans le serveur,
|
||||
renseigné dans le questionnaire. (i.e. /var/www/). Il faut donc lui
|
||||
donner les droits
|
||||
|
||||
# Arborescence des dossiers utilisés par GSL
|
||||
------------------------------------------------------------------------
|
||||
Note: ```+``` indique que GSL créera ces dossiers
|
||||
|
||||
- /etc/gsl
|
||||
- /var/log/gsl
|
||||
- /var/lib/gsl
|
||||
- - /help/
|
||||
- - /scripts/
|
||||
- - /domains
|
||||
- - - /DOMAIN
|
||||
- - - - /templates/ +
|
||||
- - - - /files/ +
|
||||
- - - - /images/ +
|
||||
- - - - /X-tra +
|
||||
- - - - - /sidebar +
|
||||
- - /db
|
||||
- - - /DOMAIN +
|
||||
|
||||
- /SRV (i.e. /var/www)
|
||||
- - /DOMAIN
|
||||
- - - /wip
|
||||
- - - - /TEMPLATE (sync wip (command) from /var/lib/gsl/domains/DOMAIN/)
|
||||
- - - /www
|
||||
- - - - /TEMPLATE (sync www (command) from /var/lib/gsl/domains/DOMAIN/)
|
||||
|
||||
|
||||
# Fichiers créés par GSL
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- /var/log/gsl
|
||||
- - gsl.log
|
||||
- - Y-M-D-H-M-S.gsl.log (backup when clean ; removed with clean all)
|
||||
- /var/lib/gsl
|
||||
- - /domains
|
||||
- - - DOMAIN
|
||||
- - - - authors.db
|
||||
- - - - DOMAIN.conf
|
||||
- - /db/
|
||||
- - - domains.db (registred domains)
|
||||
- - - DOMAIN/
|
||||
- - - - (file).gsl.db (Un par article)
|
|
@ -0,0 +1,74 @@
|
|||
# GSL: Statique Littérateur
|
||||
|
||||
$ gsl (ARG)
|
||||
readme : Show README.md instructions
|
||||
help | -h (OPT) : This Help and how to
|
||||
install | -i : Show process installation
|
||||
authors | -a : Add/Remove authors for this DOMAIN
|
||||
setdir | -d : Set a directory for article's DOMAIN
|
||||
write | -w : Write a Post
|
||||
tpl | -T : Create your template
|
||||
param | -p : Configure some parameters
|
||||
css : Show used CSS classes
|
||||
tips | -t : Show tips and advises you should know
|
||||
|
||||
new | -N : Generic OPT to add/create
|
||||
domain : Configure your DOMAIN
|
||||
author : Same as gsl author edit
|
||||
(TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl
|
||||
|
||||
setdir | -D : Show current directory DOMAIN or set it
|
||||
|
||||
log | -L (OPTS) : Show logs from all sessions
|
||||
clean | -C : Logs saved to {DATE}.gsl.log and cleaned
|
||||
all : clean all saved logs, keep current
|
||||
-i | -w | -e : from levels (infos, warnings, errors)
|
||||
-s : from last session only
|
||||
(TERM) : (TERM) : case insensitive, regex 'T1.*T2'
|
||||
(i.e. $ gsl log -e -s code)
|
||||
|
||||
author | -A : List authors from DOMAIN in PWD folder
|
||||
edit : Add/Remove ! ONE author per line
|
||||
|
||||
edit | -E : Open in default EDITOR (FILE) or with nano
|
||||
conf : Domain configuration file
|
||||
author : Same as gsl author edit
|
||||
domain : Domains registred database
|
||||
(FILE) : (FILE) ; .gsl
|
||||
|
||||
db (FILE) : Show DB statuses from (FILE)
|
||||
|
||||
sync (OPT) : Sync Templates to www and wip
|
||||
wip : Only to wip server (also done with make)
|
||||
www : Only to www server (also done with www)
|
||||
|
||||
|
||||
check | -C (OPTIONS) : Check Post(s) errors from PWD folder
|
||||
-N : Check only articles not in DB
|
||||
-F : Force Check again ; Recreate in Database
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
make | -M (OPTIONS) : Make all HTML articles or only (FILE)
|
||||
-F : Force Make again
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
www (OPT1) (OPT2) : Add/Remove Post(s) in www server
|
||||
(OPT1):
|
||||
sync : Same as "sync www"
|
||||
add : Add all/(FILE) to www server
|
||||
rmove : remove all/(FILE) from www server
|
||||
(OPT2):
|
||||
all : Select all post with wip statuses
|
||||
(FILE) : Select specific post (if wip status)
|
||||
|
||||
wip : Same as www for wip
|
||||
|
||||
sidebar | -S : Show Posts in list (ARG) (POS) (FILE)
|
||||
(ARG):
|
||||
add | -a : Put article at (POS). Remove last, roll from (POS)
|
||||
replace | -r : Replace (POS) with article
|
||||
latest | -l : Create sidebar with latest (remove all existing)
|
||||
|
||||
-v : Show local versionn
|
||||
--version : Like -v + changes
|
||||
-vv : Shown local and repo Versions
|
|
@ -0,0 +1,95 @@
|
|||
# CSS Classes and IDs
|
||||
```xxx``` is your choosen CSS acronym for your DOMAIN
|
||||
Note: if "myclass" or "myID" is not defined, class or ID is not used
|
||||
|
||||
## Legacy HTML
|
||||
### body
|
||||
myID is set in article with css: myID
|
||||
TYPE is set in article with type: page|post
|
||||
- body: xxx_TYPE myID
|
||||
|
||||
## Article Content
|
||||
### Metas (author, date...)
|
||||
|
||||
### Titles h1-h6
|
||||
X is 1 to 6
|
||||
- xxx_title xxx_title-X
|
||||
|
||||
### div between titles
|
||||
X is 1 to 6 from current title
|
||||
- xxx_content_hX
|
||||
|
||||
### Between markers (code, emphasis, strong...)
|
||||
- bold: xxx_bold
|
||||
- strong: xxx_strong
|
||||
- emphasis: xxx_em
|
||||
- strike: xxx_strike
|
||||
- inline code: xxx_icode
|
||||
|
||||
### Paragraphs
|
||||
myclass is the content value used (i.e.```( myclass```)
|
||||
- xxx_p myclass
|
||||
|
||||
### Links
|
||||
- xxx_link
|
||||
- xxx_link xxx_link-window (if "+" for target)
|
||||
|
||||
### Links from file
|
||||
- xxx_link-file
|
||||
- xxx_link-file xxx_link-file-window (if "+" for target)
|
||||
|
||||
### Image and image link
|
||||
myclass is from content marker (i.e. _image:1:myclass:90:90:+)
|
||||
- link: xxx_image-link myclass
|
||||
- img: xxx_image xxx_image-(left,right,cente)
|
||||
- - If myclass replace xxx_image-(left...) by myclass
|
||||
|
||||
### pre-codes from source file
|
||||
X is the NAME/NBR registred in header
|
||||
- pre: xxx_code-block xxx_code-block-X
|
||||
- span line: xxx_code-line
|
||||
- span content: xxx_code-content
|
||||
- p after pre: xxx_code-p
|
||||
- link source: xxx_code-link
|
||||
|
||||
### Liste (ol | ul | li)
|
||||
X is the item mark nbr (i.e. "+++" = 3, "=" = 1)
|
||||
myclass is the registred value after << (i.e. << myclass). Only used at
|
||||
the begining bloc.
|
||||
- ol: xxx_list xxx_list-ol xxx_myclass xxx_myclass-ol
|
||||
- ul: xxx_list xxx_list-ul xxx_myclass xxx_myclass-ul
|
||||
- li: a-lec_li a-lec_li-X
|
||||
|
||||
### Quotes
|
||||
myclass is the registred value after "---" (i.e. --- myclass)
|
||||
myclass is used on
|
||||
- ```<blockquote>``` (if no "_cite")
|
||||
- - blockquote: xxx_quote myclass
|
||||
- ```<figure>``` if "_cite"
|
||||
- - figure: xxx_quote-fig myclass
|
||||
|
||||
## Sidebar Content
|
||||
- aside: xxx_sidebar
|
||||
- - div: xxx__wrapper
|
||||
- - - nav: xxx_latest-posts
|
||||
- - - - h1: xxx_latest-posts
|
||||
- - - - ul: xxx_latest-posts
|
||||
- - - - - li: xxx_list-post-item
|
||||
- - - - - a: xxx_list-post-link
|
||||
- - - - - - span: xxx_list-post-title
|
||||
- - - - - - div: xxx__list-post-metas
|
||||
- - - - - - div: xxx__list-post-info
|
||||
|
||||
## Header content
|
||||
- header: xxx_banner
|
||||
- - div: xxx_site-logo
|
||||
- - div: xxx_site-title
|
||||
- - - h1: xxx_site-name
|
||||
- - - h2: xxx_site-description
|
||||
|
||||
## Footer content
|
||||
- footer: xxx_footer (ID)
|
||||
- - div: xxx_footer-infos (ID)
|
||||
- - div: xxx_footer-about (ID)
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Tips and Advises
|
||||
## Configuration
|
||||
- CSS acronym will always be in lower case
|
||||
|
||||
## ABBR
|
||||
- short name (HEADER): must be in CAPS LOCK (abbr: LEC : Libre en communs)
|
||||
- short name (CONTENT): must contain a space (" LEC", " LEC ", "LEC ")
|
||||
|
||||
## Files (Images, codes, scripts...)
|
||||
You can create sub-directories in DOMAIN/files or DOMAIN/images
|
||||
If you do so, in your article HEADER, set FILENAME with sub-dirs, but
|
||||
do NOT begin with /
|
||||
```
|
||||
# File put in /var/lib/gsl/domains/DOMAIN/images/dir/dir1/pic.png
|
||||
image: 1 : dir/dir1/pic.png
|
||||
```
|
||||
|
||||
## Images: set style and target
|
||||
```
|
||||
# Open in new tab pic, keep origin sizes
|
||||
_image:1:+
|
||||
|
||||
# Open pic in new tab, using your css class and with width in pixel
|
||||
# (height is kept)
|
||||
_image:1:c:640px:+
|
||||
```
|
||||
|
||||
## Make (changes in source file)
|
||||
If you change the content of a file (script code, image...), you will
|
||||
have to make -F your article, and do www add after
|
||||
|
||||
## Sidebar
|
||||
If your remove a www or wip page, and you put it in sidebar,
|
||||
do not forget to replace it with another article
|
|
@ -0,0 +1,4 @@
|
|||
# To add/remove authors:
|
||||
- cd to your article folder
|
||||
- gsl author edit
|
||||
- Set one author per line !
|
|
@ -0,0 +1,7 @@
|
|||
# Edit the file: /etc/gsl.conf
|
||||
|
||||
## Show logs by time or level (level ="")
|
||||
- gsl_logs_order=time
|
||||
|
||||
## Minimum Size of a post (default ="180")
|
||||
- gsl_article_min_Size=250
|
|
@ -0,0 +1,7 @@
|
|||
# To set a dedicated folder for your articles
|
||||
- cd myfolder ; to go into your folder of choice
|
||||
- gsl setdir ; to choose your domain ;
|
||||
|
||||
If your directory is configured, it will be mentionned, else:
|
||||
- You'll be asked to choose a reegistred one
|
||||
- You can now create articles. filename must be a .gsl
|
|
@ -34,6 +34,7 @@ gsl make -F
|
|||
```
|
||||
|
||||
## Listes de classes utilisées.
|
||||
|
||||
Rappel: les classes et IDs commencent par votre ACRONYM configuré,
|
||||
lors de la création d'un domaine avec ```gsl new```, suivi par ```_```.
|
||||
Pour une meilleure lisibilité, votre ACRONYM est marqué xxx.
|
||||
|
@ -44,10 +45,10 @@ Pour une meilleure lisibilité, votre ACRONYM est marqué xxx.
|
|||
- - body: xxx_page
|
||||
- - header: xxx_banner
|
||||
- - logo dans header: xxx_site-logo
|
||||
- - title dans header: xxxsite-title
|
||||
- - title dans header: xxx_site-title
|
||||
- - name dans header: xxx_site-name
|
||||
- - Description dans header: xxx_site-description
|
||||
- - ```<section>``` avant ```<article>```: xxxspage-wrapper
|
||||
- - ```<section>``` avant ```<article>```: xxx_page-wrapper
|
||||
- - article: xxx_SLUG (SLUG est le "slug: SLUG" de l'article)
|
||||
- - div metas (auteur, date...): xxx_metas
|
||||
- - p dans div metas: xxx_auteur
|
||||
|
@ -55,10 +56,12 @@ Pour une meilleure lisibilité, votre ACRONYM est marqué xxx.
|
|||
### Dans ```<article>```
|
||||
|
||||
- CLASS=
|
||||
- hX: xxx_title-X
|
||||
- - div après chaque titre ```<hX>```: xxx_content-p xxx_content-pX
|
||||
- - p dans div content-p: xxx_paragraph
|
||||
- - - si contenu ```( 2```: xxx_paragraph-2
|
||||
- - - si contenu ```( 1z```: xxx_paragraph-1z
|
||||
- - code pour les inline-code avec ```¤...¤```: xxx_icode
|
||||
- strikee: xxx_strike
|
||||
- - li (liste) en fonction du nombre N de ```= | +```: xxx__list-li x_list-N
|
||||
- - ul (liste) simple: xxx_list-ul
|
||||
- - ol (liste) ordonnée: xxx_list-ol
|
||||
|
|
147
new-version.md
147
new-version.md
|
@ -1,15 +1,138 @@
|
|||
## [0.0.37]
|
||||
## [0.0.9]
|
||||
|
||||
## Please, see help (and documentations in help folder)
|
||||
|
||||
### Add
|
||||
- changelog
|
||||
- Make stats at each www call
|
||||
- Set yourself a class ID for paragraphs: i.e. "( 1a"
|
||||
- Better Logs harmony
|
||||
- date: Set to DD-MM-YYYY if site lang=fr || YYYY-MM-DD
|
||||
- date: Check for month value > 12
|
||||
- some changed syntax in make process
|
||||
- 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
|
||||
|
||||
### Fix
|
||||
- link: check only online url from http...
|
||||
- if 'error' log : do not exit 1 anymore
|
||||
- Variable name propertie for stats (statoolinfos)
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
- 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
|
||||
- wip ...: Same as www but for wip
|
||||
|
||||
### 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 ```<head>``` 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)
|
||||
- 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
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Version: 0.0.37
|
||||
# Version: 0.0.9
|
||||
# file: gsl
|
||||
# Folder: /usr/local/bin
|
||||
# By echolib
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Tools
|
||||
#=======================================================================
|
||||
|
@ -14,531 +15,151 @@ if__command() {
|
|||
&& exit
|
||||
}
|
||||
|
||||
gsl__if_file() {
|
||||
if__file() {
|
||||
if ! [[ -f "$1" ]];then
|
||||
echo "! Missing file: $1"
|
||||
exit
|
||||
fi
|
||||
|
||||
case "$2" in
|
||||
source)
|
||||
source "$1" || exit
|
||||
;;
|
||||
read)
|
||||
cat "$1"
|
||||
;;
|
||||
post)
|
||||
gsl_this_post="$1"
|
||||
;;
|
||||
source) source "$1" || exit ;;
|
||||
read) clear;cat "$1";exit ;;
|
||||
post) gsl_this_post="$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
if__folder() {
|
||||
if ! [[ -d "$1" ]];then
|
||||
echo "! Missing directory: $1"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
gsl__invalid_option() {
|
||||
echo "! Invalid argument '$1': $2"
|
||||
exit
|
||||
}
|
||||
|
||||
# Get conf
|
||||
gsl__if_file "/etc/gsl/gsl.conf" source
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__log_manager" source
|
||||
gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source
|
||||
|
||||
case "$1" in
|
||||
help|--help|-h)
|
||||
clear
|
||||
case "$2" in
|
||||
"")
|
||||
gsl__if_file "$gsl_dir_helps/gsl_help" read
|
||||
;;
|
||||
new)
|
||||
gsl__if_file "$gsl_dir_helps/gsl_infos_new_website" read
|
||||
;;
|
||||
install)
|
||||
gsl__if_file "$gsl_dir_helps/gsl_help_install" read
|
||||
;;
|
||||
write|-w)
|
||||
gsl__if_file "$gsl_dir_lib/help/article-comment-ecrire.md" read
|
||||
;;
|
||||
template|-t)
|
||||
gsl__if_file "$gsl_dir_lib/help/template-comment-creer.md" read
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
;;
|
||||
|
||||
new|-N)
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__new_website" source
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"New Website" \
|
||||
"$gsl_dir_scripts/gsl__new_website"
|
||||
|
||||
gsl__new_website
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"New Website" \
|
||||
"$gsl_dir_scripts/gsl__new_website"
|
||||
|
||||
[[ -f "$gsl_file_db_domains" ]] && \
|
||||
[[ -d "$gsl_dir_user_posts" ]] \
|
||||
&& cd "$gsl_dir_user_posts" \
|
||||
&& gsl author add
|
||||
|
||||
echo
|
||||
gsl log -s -w
|
||||
exit
|
||||
;;
|
||||
|
||||
author|-A)
|
||||
gsl__find_domain
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
|
||||
case "$2" in
|
||||
"")
|
||||
gsl__authors_list
|
||||
;;
|
||||
add)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"author $2 for domain $gsl_find_domain" \
|
||||
"$gsl_file_auth_ndd"
|
||||
|
||||
gsl__authors_add
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"author $2 for domain $gsl_find_domain" \
|
||||
"$gsl_file_auth_ndd"
|
||||
;;
|
||||
remove)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"author $2 for domain $gsl_find_domain" \
|
||||
"$gsl_file_auth_ndd"
|
||||
|
||||
gsl__authors_remove
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"author $2 for domain $gsl_find_domain" \
|
||||
"$gsl_file_auth_ndd"
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
;;
|
||||
|
||||
readme)
|
||||
clear
|
||||
gsl__if_file "/var/lib/gsl/README.md" read
|
||||
exit
|
||||
;;
|
||||
|
||||
log|-L)
|
||||
[[ -z `grep '[^[:space:]]' "$gsl_file_logs" 2>/dev/null` ]] \
|
||||
&& echo "# No logs to show. File is empty." \
|
||||
&& exit
|
||||
|
||||
while test "$2"
|
||||
do
|
||||
case "$2" in
|
||||
clean|-C)
|
||||
gsl_date_logs=`date +%F-%H-%M-%S`
|
||||
mv "$gsl_file_logs" "$gsl_dir_logs/$gsl_date_logs.gsl.log"
|
||||
rm -f "$gsl_file_logs"
|
||||
printf '%s %s %s\n' \
|
||||
"# Logs saved to" \
|
||||
"$gsl_dir_logs/$gsl_date_logs.gsl.log" \
|
||||
"and cleaned"
|
||||
exit
|
||||
;;
|
||||
#======================================================================
|
||||
# Source files for help
|
||||
#======================================================================
|
||||
source__help() {
|
||||
for file_help in ${gsl_files_help[@]}
|
||||
do
|
||||
if [[ -f "$file_help" ]];then
|
||||
[[ "$file_help" == "$gsl_dir_help/gsl__help" ]] \
|
||||
&& source "$file_help"
|
||||
|
||||
-s) gsl_logs_last_session=true ;;
|
||||
-e) gsl_logs_err=true ;;
|
||||
-i) gsl_logs_inf=true ;;
|
||||
-w) gsl_logs_war=true ;;
|
||||
*) gsl_logs_search="$2" ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
else
|
||||
echo "! Installation Failure. Missing file: $file_help"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
gsl__logs_show
|
||||
exit 0
|
||||
;;
|
||||
|
||||
-v)
|
||||
awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/$app_name"
|
||||
exit
|
||||
;;
|
||||
|
||||
-vv)
|
||||
v_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/$app_name"`
|
||||
echo -n "# $app_name Current: $v_cur | "
|
||||
if__command curl
|
||||
v_onl=`curl -s "$repo" | awk 'NR==2 {print $3}'`
|
||||
echo -ne "Online: $v_onl\n"
|
||||
exit
|
||||
;;
|
||||
|
||||
--version)
|
||||
awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/$app_name"
|
||||
gsl__if_file "$gsl_dir_lib/new-version.md" read
|
||||
exit
|
||||
;;
|
||||
|
||||
#======================================================================
|
||||
# Helper
|
||||
# $2: arguments list
|
||||
#======================================================================
|
||||
help__OPTIONS() {
|
||||
clear
|
||||
case "$1" in
|
||||
write|-w) cat "$gsl_dir_help/comment_ecrire-article.md" ;;
|
||||
tpl|-T) cat "$gsl_dir_help/template-comment-creer.md" ;;
|
||||
install|-i) cat "$gsl_dir_help/comment_installer-GSL.md" ;;
|
||||
authors|-a) cat "$gsl_dir_help/how_to-add_remove_authors.md" ;;
|
||||
setdir|-d) cat "$gsl_dir_help/how_to-set_directory_for_articles.md" ;;
|
||||
param|-p) cat "$gsl_dir_help/how_to-parameters_conf.md" ;;
|
||||
css) cat "$gsl_dir_help/how_to-CSS_classes.md" ;;
|
||||
tips|-t) cat "$gsl_dir_help/how_to-Tips_Advises.md" ;;
|
||||
""|*) cat "$gsl_dir_help/gsl_help.md" ;;
|
||||
esac
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get CONF and source variables
|
||||
#======================================================================
|
||||
if__file "/etc/gsl/gsl.conf" source
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Check installation and source files
|
||||
#======================================================================
|
||||
for dir in ${gsl_dirs[@]}
|
||||
do
|
||||
! [[ -d "$dir" ]] \
|
||||
&& echo "! Installation Failure. Missing directory: $dir" \
|
||||
&& exit
|
||||
done
|
||||
|
||||
for file_script in ${gsl_files_scripts[@]}
|
||||
do
|
||||
if [[ -f "$file_script" ]];then
|
||||
source "$file_script"
|
||||
|
||||
else
|
||||
echo "! Installation Failure. Missing file: $file_help"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
for dir_w in ${gsl_dirs_w[@]}
|
||||
do
|
||||
if ! [[ -w "$dir_w" ]];then
|
||||
echo "! Installation Failure. Directory not writeable: $dir_w"
|
||||
exit
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Checking Dependancies
|
||||
#=======================================================================
|
||||
# Check/Create Files and Folders
|
||||
gsl__create_ff
|
||||
|
||||
gsl__find_domain
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
|
||||
gsl__authors_list check || exit
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__post_checkers" source
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__post_makers" source
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__page_creator" source
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__do_commons" source
|
||||
|
||||
#=======================================================================
|
||||
# Main
|
||||
# Check ARGUMENTS
|
||||
#=======================================================================
|
||||
case "$1" in
|
||||
create)
|
||||
case "$2" in
|
||||
page|post)
|
||||
true
|
||||
;;
|
||||
*)
|
||||
gsl__invalid_option "$2" "page|post"
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$3" in
|
||||
"")
|
||||
gsl__invalid_option "$3" "Please set a name for your $2"
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl_postname="$3"
|
||||
[[ "$gsl_postname" =~ ".gsl" ]] \
|
||||
&& gsl_postname=${gsl_postname/.gsl/}
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Create" \
|
||||
"$2" \
|
||||
"$PWD/$3.gsl"
|
||||
|
||||
if [[ -f "$gsl_postname.gsl" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Create" \
|
||||
"File" \
|
||||
"$3.gsl already exists !" \
|
||||
"$PWD/$3.gsl"
|
||||
gsl_checker_war=true
|
||||
else
|
||||
[[ `grep -i "fr" <<<"$gsl_site_lang"` ]] \
|
||||
&& gsl_today=`printf '%(%d-%m-%Y)T'` \
|
||||
|| gsl_today=`date +%F`
|
||||
|
||||
gsl__create_article "$2" "$gsl_today" "$gsl_postname" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Create" \
|
||||
"$2" \
|
||||
"You can edit it with 'gsl edit $3.gsl'" \
|
||||
"$PWD/$3.gsl"
|
||||
fi
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Create" \
|
||||
"$2" \
|
||||
"$PWD/$3.gsl"
|
||||
;;
|
||||
|
||||
edit|-E)
|
||||
! [[ "$2" ]] \
|
||||
&& gsl__invalid_option "$2" "[File]"
|
||||
|
||||
case "$2" in
|
||||
conf)
|
||||
echo "> $gsl_this_conf_domain/$gsl_find_domain.conf"
|
||||
gsl_this_post="$gsl_this_conf_domain/$gsl_find_domain.conf"
|
||||
gsl__if_file "$gsl_this_post"
|
||||
;;
|
||||
*)
|
||||
gsl__if_file "$PWD/$2" post
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [[ "$EDITOR" ]];then
|
||||
if__command nano
|
||||
EDITOR=`which nano`
|
||||
fi
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"edit with $EDITOR" \
|
||||
"$gsl_this_post"
|
||||
|
||||
gsl__get_sum "$gsl_this_post"
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Edit" \
|
||||
"File" \
|
||||
"Hash: $gsl_post_hash | Size: $gsl_post_size" \
|
||||
"$gsl_this_post"
|
||||
|
||||
gsl_post_hash_old=$gsl_post_hash
|
||||
$EDITOR "$gsl_this_post"
|
||||
|
||||
gsl__get_sum "$gsl_this_post"
|
||||
if (( $gsl_post_hash != $gsl_post_hash_old ));then
|
||||
gsl_log_infos="NEW > Hash. Size: $gsl_post_size"
|
||||
gsl_log_level="$gsl_log_w"
|
||||
else
|
||||
gsl_log_infos="Unchanged"
|
||||
gsl_log_level="$gsl_log_i"
|
||||
fi
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_level" \
|
||||
"Edit" \
|
||||
"File" \
|
||||
"$gsl_log_infos" \
|
||||
"$gsl_this_post"
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"edit with $EDITOR" \
|
||||
"$gsl_this_post"
|
||||
;;
|
||||
|
||||
db)
|
||||
! [[ "$2" ]] \
|
||||
&& gsl__invalid_option "$2" "[File]"
|
||||
|
||||
gsl__if_file "$2" post
|
||||
[[ -f "$gsl_dir_db/$gsl_this_post.db" ]] \
|
||||
&& cat -n "$gsl_dir_db/$gsl_this_post.db" \
|
||||
|| echo "! No DB yet for $gsl_this_post. Check it first."
|
||||
exit
|
||||
;;
|
||||
|
||||
check|-C)
|
||||
case "$2" in
|
||||
-F)
|
||||
gsl_force_check=true
|
||||
[[ "$3" ]] && gsl__if_file "$3" post
|
||||
;;
|
||||
*)
|
||||
[[ "$2" ]] && gsl__if_file "$2" post
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"check Post for domain $gsl_find_domain" \
|
||||
"$PWD"
|
||||
|
||||
gsl__loop_posts check
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"check Post for domain $gsl_find_domain" \
|
||||
"$PWD"
|
||||
;;
|
||||
|
||||
sync|-s)
|
||||
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
||||
gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www"
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"Sync Templates for domain $gsl_find_domain" \
|
||||
"$PWD"
|
||||
|
||||
case "$2" in
|
||||
"")
|
||||
gsl__srv_sync "$gsl_srv_wip"
|
||||
gsl__srv_sync "$gsl_srv_www"
|
||||
;;
|
||||
www)
|
||||
gsl__srv_sync "$gsl_srv_www"
|
||||
;;
|
||||
wip)
|
||||
gsl__srv_sync "$gsl_srv_wip"
|
||||
;;
|
||||
*)
|
||||
gsl__invalid_option "$2" "www|wip"
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Sync" \
|
||||
"Argument" \
|
||||
"Invalid $2" \
|
||||
"$PWD"
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"Sync Templates for domain $gsl_find_domain" \
|
||||
"$PWD"
|
||||
;;
|
||||
|
||||
make|-M)
|
||||
gsl_process="wip"
|
||||
gsl_post_list="Add"
|
||||
case "$2" in
|
||||
-F)
|
||||
gsl_force_make=true
|
||||
[[ "$3" ]] && gsl__if_file "$3" post
|
||||
;;
|
||||
*)
|
||||
[[ "$2" ]] && gsl__if_file "$2" post
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"make Post for domain $gsl_find_domain" \
|
||||
"$PWD"
|
||||
|
||||
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
||||
gsl__loop_posts make
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"make Post for domain $gsl_find_domain" \
|
||||
"$PWD"
|
||||
;;
|
||||
|
||||
www)
|
||||
! [[ "$2" ]] \
|
||||
&& gsl__invalid_option "$2" "add|remove"
|
||||
|
||||
if__command rsync
|
||||
gsl_www_act="$2"
|
||||
case "$2" in
|
||||
add)
|
||||
gsl_ask="! Put online ALL wip posts (yes|N)? "
|
||||
;;
|
||||
remove)
|
||||
gsl_ask="! REMOVE ALL www posts (yes|N)? "
|
||||
;;
|
||||
*)
|
||||
gsl__invalid_option "$2" "add|remove"
|
||||
;;
|
||||
esac
|
||||
|
||||
! [[ "$3" ]] \
|
||||
&& gsl__invalid_option "$3" "[FILE]|all"
|
||||
|
||||
case "$3" in
|
||||
all)
|
||||
read -rp "$gsl_ask" gsl_ask_www
|
||||
case "$gsl_ask_www" in
|
||||
YES|yes|Yes)
|
||||
true
|
||||
;;
|
||||
*)
|
||||
echo "# Abandon"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
gsl__if_file "$3" post
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"$1 ; $2 from domain $gsl_find_domain" \
|
||||
"$gsl_site_server"
|
||||
|
||||
gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www"
|
||||
gsl__loop_posts www "$2"
|
||||
|
||||
# Stats
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__stats" source
|
||||
gsl_file_sti="$gsl_site_server/$gsl_find_domain/gsl-sti.properties"
|
||||
gsl__get_stats &>/dev/null && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stats" \
|
||||
"File" \
|
||||
"Generated" \
|
||||
"$gsl_file_sti"
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"$1 ; $2 from domain $gsl_find_domain" \
|
||||
"$gsl_site_server"
|
||||
;;
|
||||
|
||||
sidebar|-S)
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__sidebar" source
|
||||
gsl__sidebar $1 $2 $3 $4
|
||||
;;
|
||||
|
||||
stats)
|
||||
echo "! Working on it..."
|
||||
gsl__if_file "$gsl_dir_scripts/gsl__stats" source
|
||||
gsl_file_sti="$gsl_site_server/$gsl_find_domain/gsl-sti.properties"
|
||||
|
||||
gsl__get_stats
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
gsl help
|
||||
exit
|
||||
;;
|
||||
new|-N) new__OPTIONS "$2" "$3" ;;
|
||||
author|-A) author__OPTIONS "$2" ;;
|
||||
log|-L) log__OPTIONS "$@" ;;
|
||||
-v|-vv|--version) version__OPTIONS "$1" ;;
|
||||
readme) if__file "$gsl_dir_lib/README.md" read ;;
|
||||
setdir|-D) setdir__OPTIONS ;;
|
||||
help|--help|-h) source__help;help__OPTIONS "$2" ;;
|
||||
esac
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Check for process errors or warnings
|
||||
#----------------------------------------------------------------------
|
||||
# Check if registred DOMAIn and authors from PWD
|
||||
domain__check
|
||||
author__check || exit 0 # Check if authors registresd
|
||||
|
||||
case "$1" in
|
||||
db) db__OPTIONS "$2" ;;
|
||||
sync|-s) sync__OPTIONS "$2" ;;
|
||||
edit|-E) edit__file_OPTIONS "$2" "$3" ;;
|
||||
esac
|
||||
|
||||
if__gsl_post # from gsl__post_manager: check if .gsl
|
||||
case "$1" in
|
||||
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 ;;
|
||||
*) gsl help; exit ;;
|
||||
esac
|
||||
|
||||
#======================================================================
|
||||
# After process, show logs
|
||||
#======================================================================
|
||||
gsl_logs_last_session=true
|
||||
|
||||
[[ $gsl_log_order ]] \
|
||||
&& gsl__logs_show \
|
||||
&& exit
|
||||
|
||||
gsl_logs_inf=true
|
||||
gsl__logs_show
|
||||
|
||||
if [[ "$gsl_checker_war" ]];then
|
||||
|
@ -551,5 +172,4 @@ if [[ "$gsl_checker_err" ]];then
|
|||
echo
|
||||
gsl_logs_err=true
|
||||
gsl__logs_show
|
||||
exit
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
# Changelog
|
||||
|
||||
GSL changes from releases. You can send an issue :
|
||||
- repo: https://git.a-lec.org/echolib/gsl/-/issues
|
||||
- Contact xmpp: im@echolib.re
|
||||
|
||||
## [0.0.9]
|
||||
|
||||
## 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
- 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
|
||||
- wip ...: Same as www but for wip
|
||||
|
||||
### 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 ```<head>``` 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)
|
||||
- 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
|
||||
|
||||
|
||||
## [0.0.37]
|
||||
### Add
|
||||
- changelog
|
||||
- Make stats at each www call
|
||||
- Set yourself a class ID for paragraphs: i.e. "( 1a"
|
||||
- Better Logs harmony
|
||||
- date: Set to DD-MM-YYYY if site lang=fr || YYYY-MM-DD
|
||||
- date: Check for month value > 12
|
||||
- some changed syntax in make process
|
||||
|
||||
### Fix
|
||||
- link: check only online url from http...
|
||||
- if 'error' log : do not exit 1 anymore
|
||||
- variable name propertie for stats (statoolinfos)
|
||||
|
||||
## [0.0.36]
|
||||
|
||||
### Add
|
||||
- New list converter (Use + for ol, not ø)
|
||||
- New block titles converter with div
|
||||
- New option: create
|
||||
- New option with edit: conf (to edit domain configuration)
|
||||
- New option: --version (to show last changes)
|
||||
- New generic function if invalid option
|
||||
- New min size for post: 150
|
||||
|
||||
### Fix
|
||||
- No ```<div></div>``` if block title empty
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
GSL Statique Littérateur
|
||||
Copyright (C) 2022 Libre en Communs / Commissions / Infrastructure
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
|
@ -2,10 +2,11 @@
|
|||
------------------------------------------------------------------------
|
||||
|
||||
GSL est un générateur de blogs/sites-web basé sur leur nom de domaine,
|
||||
écrit en bash, afin de ne réduire ses dépendances au minimum. Les pages
|
||||
écrit en bash, afin de réduire ses dépendances au minimum. Les pages
|
||||
générées sont presque entièrement statiques, à l'exception du module de
|
||||
liste des derniers articles. Nginx peut être facilement configuré pour
|
||||
interprêter ce module.
|
||||
liste des derniers articles (sidebar) placé en include. Nginx peut être
|
||||
facilement configuré pour interprêter ce module.
|
||||
|
||||
|
||||
# Dépendances
|
||||
------------------------------------------------------------------------
|
||||
|
@ -13,206 +14,179 @@ interprêter ce module.
|
|||
- bash
|
||||
- coreutils
|
||||
- curl (to check Posts links response)
|
||||
- rsync
|
||||
- rsync, nano
|
||||
|
||||
|
||||
# GSL: Installation
|
||||
------------------------------------------------------------------------
|
||||
Une procédure d'installation via un setup est en cours de test. Il est
|
||||
Une procédure d'installation via un setup est en préparation. Il est
|
||||
aussi possible et recommandé sous debian de l'installer grâce à son
|
||||
paquet deb.
|
||||
paquet deb (construit par make).
|
||||
|
||||
Pour une installation manuelle, clonez ce dépôt, et copiez les dossiers
|
||||
déjà pré-établis dans le système. GSL n'utilise pas sudo, il vous faut
|
||||
donc donner les droits aux dossiers (chown -R) à l'utilisateur
|
||||
(sauf au dossier /usr/local/bin). Pour ce dossier, vous donnerez les droits
|
||||
via chown USER:USER /usr/local/bin/gsl
|
||||
déjà pré-établis dans le système (avec sudo). GSL n'utilise pas sudo,
|
||||
il vous faut donc donner les droits des dossiers (chown -R) à l'utilisateur
|
||||
(sauf au dossier /usr/local/bin). Pour ce dossier, vous donnerez les
|
||||
droits au fichier gsl seulement
|
||||
|
||||
## Configuration du DOMAIN (selon le choix de l'utilistaeur via $ gsl new) :
|
||||
- HOME: ~/.config/gsl
|
||||
- GLOBAL: /var/lib/gsl
|
||||
- Dossier: --Prefix/domains/ (créé par GSL via $ gsl new)
|
||||
Reportez-vous à la documentation dans le dossier help
|
||||
|
||||
### Données du DOMAIN :
|
||||
- Dossier: --Prefix/DOMAIN/ (créé par GSL)
|
||||
- - Fichiers: DOMAIN.conf, authors.db (créé par GSL)
|
||||
- - Dossier: --Prefix/DOMAIN/templates/ (créé par GSL - pour vos css, logos...)
|
||||
|
||||
## Dossier de configuration de GSL : /etc/gsl/
|
||||
- Fichier: gsl.conf
|
||||
|
||||
## Dossier principal : /var/lib/gsl/
|
||||
- Folder: db (créé par GSL)
|
||||
- Dossier: helps
|
||||
- Dossier: scripts
|
||||
- Fichier: README.md, README-english.md
|
||||
|
||||
## Dossier des logs: /var/log/gsl/
|
||||
- Fichier: gsl.log (créé et géré par GSL via $ gsl log [OPT]...)
|
||||
|
||||
## Dossier de l'éxécutable : /usr/local/bin/
|
||||
- Fichier: gsl
|
||||
|
||||
## Dossier d'autocomplétion : /usr/share/bash-completion/completions/gsl/
|
||||
- Fichier: gsl
|
||||
|
||||
# Comment configurer un domaine
|
||||
------------------------------------------------------------------------
|
||||
Préparer un fichier de logo. L'important sera de renseigner le nom du
|
||||
fichier lors du questionnaire.
|
||||
|
||||
Attention: GSL aura besoin de créer des sous-dossier dans le serveur,
|
||||
renseigné dans le questionnaire. (i.e. /var/www/). Il faut donc lui
|
||||
donner les droits
|
||||
|
||||
``
|
||||
$ gsl new) domain
|
||||
```
|
||||
|
||||
Des questions vous seront posées lorsque vous voudrez ajouter un domaine
|
||||
(exemple.com). Les données renseignées seront utilisées pour créer le
|
||||
fichier DOMAIN.conf. Une question spécifique pour les fichier des articles
|
||||
vous sera posée afin d'établir un dossier de stockage de vos articles.
|
||||
Vous pourrez en créer à loisir autant que vous voulez plus tard.
|
||||
(exemple.com). Les données renseignées seront utilisées pour créer la
|
||||
configuration (voir la documentation d'installation)
|
||||
|
||||
```
|
||||
# helps
|
||||
gsl help
|
||||
gsl help new
|
||||
gsl help install
|
||||
|
||||
# Ajouter un domaine
|
||||
gsl new
|
||||
```
|
||||
|
||||
## Définir un dossier pour les articles du DOMAIN
|
||||
## Définir un dossier pour les articles du DOMAIN
|
||||
------------------------------------------------------------------------
|
||||
Si ce n'est pas déjà fait par GSL, ou que vous voulez ajouter un dossier
|
||||
pour y stocker et convertir en HTML vos articles pour un DOMAIN précis :
|
||||
pour y stocker vos articles bruts pour un DOMAIN précis :
|
||||
|
||||
- Ajouter/créer un dossier de votre choix
|
||||
```
|
||||
gsl help -d
|
||||
cd MYFOLDER
|
||||
gsl setdir
|
||||
```
|
||||
|
||||
ou:
|
||||
- Aller dans/créer un dossier de votre choix
|
||||
- Créer dedans, un fichier vide nommé gsl.DOMAIAN (gsl.exemple.com)
|
||||
|
||||
## Ajouter un auteur
|
||||
|
||||
## Ajouter / retirer un auteur
|
||||
------------------------------------------------------------------------
|
||||
Après avoir enregistré un domain et configuré un dossier pour les
|
||||
articles. **Un auteur par ligne !**
|
||||
|
||||
```
|
||||
cd MON-DOSSER-ARTICLES
|
||||
gsl author add
|
||||
gsl author edit
|
||||
```
|
||||
|
||||
|
||||
## Créer un article
|
||||
Le moteur de convertion est nouveau, et est un mélange entre markdown et
|
||||
------------------------------------------------------------------------
|
||||
Le moteur de convertion est nouveau. C'est un mélange entre markdown et
|
||||
reSTructuredText. Il est simple à apprendre et à utiliser.
|
||||
|
||||
- Créer un fichier (monarticle).gsl (extension .gsl)
|
||||
- Suivez le guide plus bas pour comprendre les notions
|
||||
|
||||
Vous devrez le faire valider par GSL :
|
||||
Reportez-vous à la documentation dans le dossier help, ou:
|
||||
```
|
||||
gsl check
|
||||
gsl check monarticle.gsl # Vérfier que monarticle.gsl
|
||||
gsl check -F Forcer la vérification
|
||||
gsl check -F monarticle.gsl # Forcer la vérification de monarticle.gsl
|
||||
gsl help -w
|
||||
```
|
||||
|
||||
## Convertir un ou tous les articles
|
||||
Si votre article n'a pas d'erreurs, vous pouvez le convertir en HTML.
|
||||
|
||||
```
|
||||
gsl make
|
||||
gsl make -F # Forcer la reconstruction)
|
||||
gsl make -F monarticle.gsl # Forcer la reconstruction de monarticle.gsl
|
||||
```
|
||||
|
||||
Votre article sera prêt dans le dossier webserver (ex: /var/www/DOMAIN/wip)
|
||||
Vous pourrez donc vérifier son rendu.
|
||||
|
||||
Si vous êtes satisfait, vous pouvez le déployer "officiellement" dans www
|
||||
|
||||
```
|
||||
# Vous pouvez utiliser l'autocompletion pour les articles
|
||||
gsl www add monarticle.gsl
|
||||
```
|
||||
## Procédures de prévisualisation et mise en ligne
|
||||
------------------------------------------------------------------------
|
||||
- gsl check monarticle.gsl (vérifie l'écriture en gsl)
|
||||
- gsl make monarticle.gsl (Connvertit en HTML - dossier wip)
|
||||
- gsl www add monarticle.gsl (copiel la page dans le dossier www)
|
||||
|
||||
|
||||
# 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 ddsirée. Le nombre
|
||||
d'articles maximum dans la sidebar est configurable dans /etc/gsl/gsl.conf
|
||||
|
||||
Quelques exemples d'utilisations
|
||||
d'articles maximum dans la sidebar est configurable dans le fichier de
|
||||
configuration du domaine (DOMAIN.conf)
|
||||
|
||||
```
|
||||
# Liste les articles de la sidebar dans l'ordre
|
||||
gsl sidebar
|
||||
|
||||
# Ajoute monarticle en position 1
|
||||
gsl -S add 1 monarticle
|
||||
|
||||
# Enlève monarticle2 de la sidebar
|
||||
gsl -S remove monarticle2
|
||||
|
||||
# monarticle5 est en position 3. Le replacer par monarticle4
|
||||
gsl -S -A 3 monarticle4
|
||||
gsl sidebar replace 2 monarticle.gsl
|
||||
```
|
||||
|
||||
# Besoin d'aide !
|
||||
## Astuces
|
||||
- Vous pouvez utiliser l'autocompletion pour les articles
|
||||
- Reportez-vous à la documentation dans le dossier Help
|
||||
|
||||
```
|
||||
gsl www add mona<TAB>
|
||||
```
|
||||
|
||||
|
||||
# Help
|
||||
------------------------------------------------------------------------
|
||||
Reportez vous aux explications dans le dossier *help*
|
||||
|
||||
|
||||
# HELP COMMAND
|
||||
------------------------------------------------------------------------
|
||||
```
|
||||
$ gsl [ARG]
|
||||
$ gsl (ARG)
|
||||
readme : Show README.md instructions
|
||||
help | -h [OPT] : This Help
|
||||
install : Show process installation
|
||||
new : Adding a DOMAIN
|
||||
write | -w : How to write a Post
|
||||
template | -t : Tips to create your template
|
||||
help | -h (OPT) : This Help and how to
|
||||
install | -i : Show process installation
|
||||
authors | -a : Add/Remove authors for this DOMAIN
|
||||
setdir | -d : Set a directory for article's DOMAIN
|
||||
write | -w : Write a Post
|
||||
tpl | -T : Create your template
|
||||
param | -p : Configure some parameters
|
||||
css : Show used CSS classes
|
||||
tips | -t : Show tips and advises you should know
|
||||
|
||||
new | -N : Add and configure a new DOMAIN
|
||||
|
||||
log | -L [OPTS] : Show logs from all sessions
|
||||
new | -N : Generic OPT to add/create
|
||||
domain : Configure your DOMAIN
|
||||
author : Same as gsl author edit
|
||||
(TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl
|
||||
|
||||
setdir | -D : Show current directory DOMAIN or set it
|
||||
|
||||
log | -L (OPTS) : Show logs from all sessions
|
||||
clean | -C : Logs saved to {DATE}.gsl.log and cleaned
|
||||
all : clean all saved logs, keep current
|
||||
-i | -w | -e : from levels (infos, warnings, errors)
|
||||
-s : from last session only
|
||||
[TERM] : [TERM] : case insensitive, regex 'T1.*T2'
|
||||
(TERM) : (TERM) : case insensitive, regex 'T1.*T2'
|
||||
(i.e. $ gsl log -e -s code)
|
||||
|
||||
author | -A [OPT] : List authors from DOMAIN set in PWD folder
|
||||
add : Add author(s) for DOMAIN
|
||||
remove : Remove author(s) for DOMAIN
|
||||
author | -A : List authors from DOMAIN in PWD folder
|
||||
edit : Add/Remove ! ONE author per line
|
||||
|
||||
create [TYPE] [NAME] : Create an article with [TYPE] named [NAME].gsl
|
||||
|
||||
edit | -E : Open in default EDITOR [FILE] or with nano
|
||||
edit | -E : Open in default EDITOR (FILE) or with nano
|
||||
conf : Domain configuration file
|
||||
[FILE] : [FILE] (.gsl)
|
||||
author : Same as gsl author edit
|
||||
domain : Domains registred database
|
||||
(FILE) : (FILE) ; .gsl
|
||||
|
||||
db [FILE] : Show DB statuses from [FILE]
|
||||
db (FILE) : Show DB statuses from (FILE)
|
||||
|
||||
sync [OPT] : Sync Templates to www and wip
|
||||
sync (OPT) : Sync Templates to www and wip
|
||||
wip : Only to wip server (also done with make)
|
||||
www : Only to www server (also done with www)
|
||||
|
||||
|
||||
check | -C [OPT] [FILE] : Check Posts errors from PWD folder or [FILE]
|
||||
-F : Force check again
|
||||
check | -C (OPTIONS) : Check Post(s) errors from PWD folder
|
||||
-N : Check only articles not in DB
|
||||
-F : Force Check again ; Recreate in Database
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE]
|
||||
to HTML file in server
|
||||
make | -M (OPTIONS) : Make all HTML articles or only (FILE)
|
||||
-F : Force Make again
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
www [OPT1] [OPT2] : Add/Remove Post from www server
|
||||
[OPT1]:
|
||||
add : Add all/[FILE] to www server
|
||||
rmove : remove all/[FILE] from www server
|
||||
[OPT2]:
|
||||
www (OPT1) (OPT2) : Add/Remove Post(s) in www server
|
||||
(OPT1):
|
||||
sync : Same as "sync www"
|
||||
add : Add all/(FILE) to www server
|
||||
rmove : remove all/(FILE) from www server
|
||||
(OPT2):
|
||||
all : Select all post with wip statuses
|
||||
[FILE] : Select specific post (if wip status)
|
||||
(FILE) : Select specific post (if wip status)
|
||||
|
||||
wip : Same as www for wip
|
||||
|
||||
sidebar | -S [ARG] [FILE]: Show Posts in list
|
||||
[ARG]:
|
||||
add | -A : Must set a Position number before [FILE]
|
||||
Max posts in list is set in gsl.conf
|
||||
Replace post position if post not exists in list
|
||||
remove | -R : No Position to set, just [FILE].
|
||||
add/remove will build last-posts-list.html
|
||||
create | -C : rebuild last-posts-list.html
|
||||
sidebar | -S : Show Posts in list (ARG) (POS) (FILE)
|
||||
(ARG):
|
||||
add | -a : Put article at (POS). Remove last, roll from (POS)
|
||||
replace | -r : Replace (POS) with article
|
||||
latest | -l : Create sidebar with latest (remove all existing)
|
||||
|
||||
-v : Show local versionn
|
||||
--version : Like -v + changes
|
||||
-vv : Shown local and repo Versions
|
||||
```
|
||||
|
||||
|
|
|
@ -1,310 +0,0 @@
|
|||
# Créer un fichier depuis la ligne de commande
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Vous pouvez créer un fichier daté du jour avec les METAS obligatoires
|
||||
intégrés (à renseigner après). Vous devez spécifier si votre article
|
||||
sera une page ou un post (Voir section plus bas) et lui donner un nom.
|
||||
|
||||
Rendez vous dans le dossier de vos articles, enregistrés lors de l'ajout
|
||||
de votre domaine (ou celui que vous avez configuré).
|
||||
|
||||
Évitez les espaces dans le nom du fichier ou utilisez des guillemets.
|
||||
|
||||
```
|
||||
# Crréer une page nommée index
|
||||
gsl create page index
|
||||
|
||||
# Créer un article nommé mes-vacances
|
||||
gsl create post mes-vacances
|
||||
```
|
||||
|
||||
Vous pouvez l'éditer dans le terminal ou avec votre éditeur de texte.
|
||||
|
||||
```
|
||||
gsl edit mes-vacances.gsl
|
||||
```
|
||||
|
||||
# Comment écrire un article
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Votre article doit contenir 2 sections. Les METAS avant ```#1``` et
|
||||
l'article à partir de ce repère (servant de titre h1).
|
||||
|
||||
- METAS : configurer votre article (titre, date, liens...)
|
||||
- ARTICLE : contenue rédactionnel avec quelques marqueurs (gras...)
|
||||
|
||||
## METAS obligatoires (avant #1)
|
||||
|
||||
```
|
||||
title: POST TITLE
|
||||
slug: POST-TITLE (si espaces, GSL les convertira en -)
|
||||
info: DESCRIPTION (À propos de cet article)
|
||||
author: NAME (doit être enregistré via ($ gsl author add)
|
||||
date: YYYY-MM-DD
|
||||
tags: TAG1,Mon TAG2,TAG3 (séparé par une virgule)
|
||||
```
|
||||
|
||||
### Page ou Article ?
|
||||
|
||||
Vous pouvez spécifier pour chaque article si c'est une page ou un article
|
||||
Si non renseigné, GSL ajoutera le type: post (article) par défaut à la
|
||||
première ligne de votre article
|
||||
|
||||
```
|
||||
# Page (index, 404, about...)
|
||||
# Création HTML selon le slug: /POST-TITLE.html
|
||||
type: page
|
||||
|
||||
# Article (monarticle)
|
||||
# Création HTML selon le slug: /POST-TITLE/index.html
|
||||
type: post
|
||||
```
|
||||
|
||||
## METAS optionnelles (avant ```#1```)
|
||||
|
||||
Définir les marqueurs (abbr:, link:...) et utiliser ``` : ``` comme séparateur
|
||||
|
||||
```
|
||||
abbr: COURT : LONG
|
||||
file: NOM : NOM-DU-FICHIER : Text alternatif
|
||||
link: NOM : URL : Text alternatif
|
||||
code: NUMERO : NOM-DU-FICHIER : Text alternatif
|
||||
image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF
|
||||
```
|
||||
|
||||
## Contenu de l'article:
|
||||
|
||||
Les marqueurs *et leur contenu* (ex: ```= list 1...```, ```*__monfichier...```)
|
||||
**doivent commencer et finir sur la même ligne**.
|
||||
|
||||
### Abréviations
|
||||
Définir en METAS...
|
||||
|
||||
```
|
||||
abbr: CSS : Cascading Style Sheets
|
||||
```
|
||||
|
||||
Dans l'article:
|
||||
|
||||
```
|
||||
Les propriétés CSS ne sont pas définies
|
||||
```
|
||||
|
||||
### Paragraphes
|
||||
|
||||
Au début d'une nouvelle ligne, ouvrez avec ( et fermez avec ).
|
||||
Vous pouvez utiliser 4 classes de paragraphes différentes : ( 1 ( 2 ( 3
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
( 2
|
||||
Paragraphe avec une classe 2 (css)
|
||||
)
|
||||
|
||||
(
|
||||
Paragraphe sans numéro de classe
|
||||
)
|
||||
```
|
||||
|
||||
### Liens
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
link: Mon lien : URL : Alt text
|
||||
link: https://a-lec.org/ : URL : Alt text
|
||||
```
|
||||
|
||||
Dans l'article..
|
||||
- Écrivez ```_``` devant le nom du lien
|
||||
- Ajoutez ```+``` pour ouvrir le lien dans un nouvel onglet
|
||||
|
||||
```
|
||||
Visitez _Mon lien+ et charger ici la page _https://a-lec.org/
|
||||
```
|
||||
|
||||
### Fichiers
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
file: Mon fichier : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
__Mon fichier
|
||||
```
|
||||
|
||||
### Images
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
image: 1 : FILENAME : ALT-TEXT
|
||||
image: 2 : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
Définir le marqueur ```_image``` sur une seule ligne et spécifiez les
|
||||
valeurs séparées par ":"
|
||||
|
||||
- Numero d'image
|
||||
- Alignement: l,r, ou c (g,d également) pour gauche, droite, centre)
|
||||
- Longueur width: juste le nombre
|
||||
- Largeur height: juste le nombre
|
||||
- Champ non vide: Lien de l'image dans un nouvel onglet
|
||||
|
||||
Exemple d'images affichées l'une à côté de l'autre
|
||||
|
||||
```
|
||||
(
|
||||
_image:1
|
||||
_image:2:c:640:480
|
||||
_image:3:c:320:240:+
|
||||
)
|
||||
```
|
||||
|
||||
Exemple d'images affichées l'une en dessous de l'autre, dont la première
|
||||
peut s'ouvrir dans un nouvel onglet
|
||||
|
||||
```
|
||||
(
|
||||
_image:1:c:640:480:+
|
||||
)
|
||||
(
|
||||
_image:2:c:1920:1080
|
||||
)
|
||||
```
|
||||
|
||||
### Block-Code depuis un fichier
|
||||
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
code: 1 : FILENAME : Alt Text
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
_code:1
|
||||
```
|
||||
|
||||
### Écrire en très gras
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
**c'est du surgras**
|
||||
c'est in**défini**ssable
|
||||
il ad**juge** : pas de pub !
|
||||
```
|
||||
|
||||
### Gras
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
*c'est en gras*
|
||||
```
|
||||
|
||||
### Italique
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
C'est /en italique/
|
||||
```
|
||||
|
||||
### Code en ligne
|
||||
|
||||
Info: ¤ = alt-gr + $ sur un clavier FR azerty)
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
¤gsl help -w¤
|
||||
```
|
||||
|
||||
### Citation simple
|
||||
|
||||
(au début de la ligne, mettez 3x -)
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
---
|
||||
(
|
||||
Une citation simple dans un paragraphe
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
---
|
||||
_cite : Richard Matthew Stallman
|
||||
_link : https://stallman.org/
|
||||
_lang : en
|
||||
(
|
||||
In the free/libre software movement, we develop software that respects
|
||||
users' freedom, so we and you can escape from software that doesn't. I
|
||||
could have made money this way, and perhaps amused myself writing code.
|
||||
But I knew that at the end of my career, I would look back on years of
|
||||
building walls to divide people, and feel I had spent my life making the
|
||||
world a worse place
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée : optionnel
|
||||
|
||||
Ajoutez ces marqueurs, si connus dans la citation, par ex sous ```_cite```
|
||||
|
||||
```
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
```
|
||||
|
||||
|
||||
### Créer des listes
|
||||
L'arborescence est "infinie".
|
||||
- Chaque contenu de la liste **doit être sur la même ligne**
|
||||
|
||||
Dans l'article...
|
||||
- utilisez ```=``` pour définir l'arborescence d'une liste simple (ul)
|
||||
- utilisez ```+``` pour définir une liste ordonnée (ol)
|
||||
|
||||
```
|
||||
(
|
||||
Voici une liste simple
|
||||
= Fruits : *mangez-en*
|
||||
== Kiwis
|
||||
== Fraises
|
||||
=== pas mûres
|
||||
== Bananes
|
||||
=== Plantins
|
||||
= Légumes
|
||||
== Haricots
|
||||
=== Rouges
|
||||
=== Verts
|
||||
Fin de la liste
|
||||
)
|
||||
```
|
||||
|
||||
### Ajouter des lignes vides
|
||||
|
||||
Vous pouvez ajouter des ```<br />``` dans votre rédaction, mais pour une
|
||||
lecture plus propre de votre article, vous pouvez utiliser le caractère
|
||||
```|``` *au tout début d'une nouvelle ligne*
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
#1 Mon titre
|
||||
(
|
||||
Ceci est un long paragraphe (Un peu d'imagination...)
|
||||
|
|
||||
Retour "forcé" à la ligne
|
||||
)
|
||||
|
||||
```
|
|
@ -0,0 +1,16 @@
|
|||
# Configurations optionnelles de GSL
|
||||
|
||||
Vous pouvez configurer quelques paramètres dans le fichier
|
||||
**/etc/gsl/gsl.conf**
|
||||
|
||||
## Afficher les logs par chronologie
|
||||
```
|
||||
# Show log by time|level (default: 'time'); not set = level
|
||||
gsl_log_order=time
|
||||
```
|
||||
|
||||
## Définir la taille en octets minimum d'un fichier
|
||||
```
|
||||
# Par défaut: 180
|
||||
gsl_article_min_Size=250
|
||||
```
|
|
@ -0,0 +1,363 @@
|
|||
# Créer un article depuis la ligne de commande
|
||||
------------------------------------------------------------------------
|
||||
Vous pouvez créer un article daté du jour avec les METAS obligatoires
|
||||
intégrées (à renseigner après) depuis la ligne de commande. Vous devez
|
||||
spécifier si votre article sera une page ou un post (Voir section plus
|
||||
bas), et lui donner un nom. Les metas optionnelles sont ajoutées enn
|
||||
commentaires.
|
||||
|
||||
Rendez vous dans le dossier de vos articles, enregistrés lors de l'ajout
|
||||
de votre domaine (ou celui que vous avez configuré).
|
||||
|
||||
Mettez des guillemets pour les nom du fichier avec espaces.
|
||||
|
||||
```
|
||||
# Crréer une page nommée index (deviendra /index.html)
|
||||
gsl new page index
|
||||
|
||||
# Créer un article nommé "mes vacances"
|
||||
gsl ew post "mes vacances"
|
||||
```
|
||||
|
||||
Vous pouvez l'éditer dans le terminal ou avec votre éditeur de texte, en
|
||||
utilisant l'autocompletion (<tab>)
|
||||
|
||||
```
|
||||
gsl edit "mes vacances.gsl"
|
||||
```
|
||||
|
||||
|
||||
# Comment écrire un article
|
||||
------------------------------------------------------------------------
|
||||
Votre article doit contenir 2 sections. Les METAS avant ```#1``` et
|
||||
l'article à partir de ce repère (servant de titre h1).
|
||||
|
||||
- METAS : configurer votre article (titre, date, liens...)
|
||||
- ARTICLE : contenue rédactionnel avec quelques marqueurs (gras...)
|
||||
|
||||
## METAS obligatoires (avant ```#1```)
|
||||
**Écrire sur une seule ligne** chaque META
|
||||
|
||||
```
|
||||
type: page
|
||||
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
|
||||
tags: TAG1,Mon TAG2,TAG3 (séparé par une virgule)
|
||||
```
|
||||
|
||||
### Page ou Article ?
|
||||
Vous devez spécifier pour chaque article si c'est une **page** ou un
|
||||
**post**
|
||||
|
||||
#### Page (index, 404, about...)
|
||||
Création HTML à la racine selon le slug: /MY-SLUG.html
|
||||
|
||||
```
|
||||
type: page
|
||||
slug: 404
|
||||
```
|
||||
|
||||
#### Post (monarticle)
|
||||
Création HTML dans un dossier selon le slug: /MY-SLUG/index.html
|
||||
**! Le slug ne doit pas commencer par un /**
|
||||
|
||||
```
|
||||
type: post
|
||||
slug: service/xmpp/configurer-gajim
|
||||
```
|
||||
|
||||
## METAS optionnelles (avant ```#1```)
|
||||
Définir UN seul marqueur CSS par article pour personnaliser chaque
|
||||
article avec sa propre CSS.
|
||||
|
||||
```
|
||||
css: myID
|
||||
```
|
||||
|
||||
Définir un ou plusieurs de ces marqueurs et utiliser ``` : ``` comme
|
||||
séparateur
|
||||
|
||||
```
|
||||
abbr: COURT : LONG
|
||||
file: NOM : NOM-DU-FICHIER : Text alternatif
|
||||
link: NOM : URL : Text alternatif
|
||||
code: NUMERO : NOM-DU-FICHIER : Text alternatif
|
||||
brut: NUMERO : NOM-DU-FICHIER
|
||||
image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF
|
||||
```
|
||||
|
||||
## Contenu de l'article:
|
||||
Les marqueurs (hors listes) *et leur contenu* (ex: ```__monfichier...```)
|
||||
**doivent être sur la même ligne**.
|
||||
|
||||
Les marqueurs à retenir et leur Combinaison de touches sur un clavier
|
||||
azerty français
|
||||
|
||||
- Très gras: '•...•' (alt+gr + ;)
|
||||
- Gras: '·...·' (alt+gr + :)
|
||||
- Italique: '”...”' (alt+gr + n)
|
||||
- Barré: '×...×' (alt+gr + shift + ;)
|
||||
- Code: '¤...¤' (alt+gr + $)
|
||||
|
||||
### É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 !
|
||||
```
|
||||
|
||||
### Écrire en gras
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
·Tout est en gras·
|
||||
```
|
||||
|
||||
### Écrire en Italique
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
C'est ”en italique”
|
||||
```
|
||||
|
||||
### Créer un texte "barré"
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
La réunion aura lieu ×demain× dans une semaine
|
||||
```
|
||||
|
||||
### Écrire un Code en ligne
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
¤gsl help -w && echo "Be Happy"¤
|
||||
```
|
||||
|
||||
### Abréviations
|
||||
Définir en METAS... (SHORT doit être en **lettres CAPITALES**)
|
||||
|
||||
```
|
||||
abbr: CSS : Cascading Style Sheets
|
||||
```
|
||||
|
||||
Dans l'article:
|
||||
|
||||
```
|
||||
Les propriétés CSS ne sont pas définies
|
||||
```
|
||||
|
||||
### Paragraphes
|
||||
Au début d'une nouvelle ligne, ouvrez avec ( et fermez avec ).
|
||||
Vous pouvez définir le nom de la classe du paragraphe en ajoutant la
|
||||
valeur désirée ; par exemple : p3
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
( p3
|
||||
Paragraphe avec une classe p3 en css
|
||||
)
|
||||
|
||||
(
|
||||
Paragraphe sans classe
|
||||
)
|
||||
```
|
||||
|
||||
### Liens
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
link: Mon lien : URL : Alt text
|
||||
link: https://a-lec.org/ : URL : Alt text
|
||||
```
|
||||
|
||||
Dans l'article..
|
||||
- Écrivez ```_``` devant le nom du lien
|
||||
- Ajoutez ```+``` pour ouvrir le lien dans un nouvel onglet
|
||||
|
||||
```
|
||||
Visitez _Mon lien+ et charger ici la page _https://a-lec.org/
|
||||
```
|
||||
|
||||
### Fichiers
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
file: Mon fichier : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
__Mon fichier
|
||||
```
|
||||
|
||||
### Images
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
image: 1 : FILENAME : ALT-TEXT
|
||||
image: 2 : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
Définir le marqueur ```_image``` sur une seule ligne 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
|
||||
|
||||
- Numero d'image
|
||||
- Alignement: l,r,(g,d également),c pour gauche, droite, centre)
|
||||
- - maclasse au lieu de l,r,c pour utiliser la classe css "maclasse"
|
||||
- - + (class="center")
|
||||
- Longueur width: (avec unité)
|
||||
- - + (taille originale)
|
||||
- Largeur height: (avec unité)
|
||||
- - + (longueur définie, largeur originale)
|
||||
- Champ non vide: Lien de l'image dans un nouvel onglet
|
||||
|
||||
Exemple d'images affichées l'une à côté de l'autre
|
||||
|
||||
```
|
||||
(
|
||||
_image:1
|
||||
_image:2:c:640px:25%
|
||||
_image:3:maclass:320px:240px:+
|
||||
)
|
||||
```
|
||||
|
||||
Exemple d'images affichées l'une en dessous de l'autre, dont la première
|
||||
s'ouvrir dans un nouvel onglet avec sa taille originale et la classe css
|
||||
center
|
||||
|
||||
```
|
||||
(
|
||||
_image:1:+
|
||||
)
|
||||
(
|
||||
_image:2:c:1920px:25%
|
||||
)
|
||||
```
|
||||
|
||||
### Block-Code depuis un fichier
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
code: python : FILENAME : Alt Text
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
_code:python
|
||||
```
|
||||
|
||||
### IMPORT de code brut (sera exécuté par le navigateur)
|
||||
Définir en METAS
|
||||
|
||||
```
|
||||
brut : 1 : FILENAME
|
||||
```
|
||||
|
||||
Dans l'article...
|
||||
```
|
||||
_brut:1
|
||||
```
|
||||
|
||||
### Citation simple
|
||||
Définissez un bloc pour la citation. Utilisez ```---```
|
||||
Vous pouvez définir une classe CSS spécifique ```--- ma-classe-css```
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
---
|
||||
(
|
||||
Une citation simple dans un paragraphe
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée
|
||||
Dans l'article... Stallman est une classe CSS
|
||||
```
|
||||
--- Stallman
|
||||
_cite : Richard Matthew Stallman
|
||||
_link : https://stallman.org/
|
||||
_lang : en
|
||||
(
|
||||
In the free/libre software movement, we develop software that respects
|
||||
users' freedom, so we and you can escape from software that doesn't. I
|
||||
could have made money this way, and perhaps amused myself writing code.
|
||||
But I knew that at the end of my career, I would look back on years of
|
||||
building walls to divide people, and feel I had spent my life making the
|
||||
world a worse place
|
||||
)
|
||||
---
|
||||
```
|
||||
|
||||
### Citation avancée : données optionnelles
|
||||
Ajoutez ces marqueurs, si connus dans la citation
|
||||
|
||||
```
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
```
|
||||
|
||||
|
||||
### Créer des listes
|
||||
L'arborescence est "infinie".
|
||||
- Définir le début d'une liste par ```<<``` et sa fin par ```>>```
|
||||
- Définir une classe CSS après ```<< ```
|
||||
|
||||
Dans l'article...
|
||||
- utilisez ```=``` pour définir une liste simple (ul)
|
||||
- utilisez ```+``` pour définir une liste ordonnée (ol)
|
||||
- Mixez les 2 (dans la limite de ma patience :D)
|
||||
|
||||
```
|
||||
(
|
||||
Voici une liste simple
|
||||
<<
|
||||
= Fruits : *mangez-en*
|
||||
== Kiwis
|
||||
== Fraises
|
||||
=== pas mûres
|
||||
== Bananes
|
||||
=== Plantins
|
||||
= Légumes
|
||||
== Haricots
|
||||
=== Rouges
|
||||
=== Verts
|
||||
>>
|
||||
)
|
||||
|
||||
Voici une liste mixe avec sa classe "couverture"
|
||||
<< couverture
|
||||
= Livre 1
|
||||
+ Chapitre 1
|
||||
+ Chaptire 2
|
||||
++ Résumé du Ch 2
|
||||
= Livre 2
|
||||
+ Chapitre 1
|
||||
>>
|
||||
```
|
||||
|
||||
### Ajouter des lignes vides
|
||||
Vous pouvez ajouter des ```<br />``` dans votre rédaction, mais pour une
|
||||
lecture plus propre de votre article, vous pouvez utiliser le caractère
|
||||
```|``` **au tout début d'une nouvelle ligne**. Pratique dans les
|
||||
paragraphes.
|
||||
|
||||
Dans l'article...
|
||||
|
||||
```
|
||||
#1 Mon titre
|
||||
(
|
||||
Ceci est un long paragraphe (Un peu d'imagination...)
|
||||
|
|
||||
Retour "forcé" à la ligne
|
||||
)
|
||||
```
|
|
@ -0,0 +1,84 @@
|
|||
# Comment installer GSL: Statique Littératueur
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Un script d'installation install.sh est prévu, mais pas encore proposé.
|
||||
- Un .deb peut être créé (merci neox) depuis le make de l'archive
|
||||
|
||||
## Installation manuelle
|
||||
- git clone https://git.a-lec.org/echolib/gsl && cd gsl
|
||||
- Commencez par créer les dossiers de base (voir ci-dessous)
|
||||
- Donnez leur les droits nécessaires
|
||||
|
||||
GSL n'utilise pas de droits sudo, et a besoin pour écrire certains
|
||||
fichiers et créer certains dossiers d'être propriétaire ou d'avoir les
|
||||
droits en écriture des dossiers
|
||||
|
||||
```
|
||||
# Pour le dossier du binaire
|
||||
sudo rsync -a usr/local/bin/gsl /usr/local/bin/gsl
|
||||
sudo chown USER:GROUP/usr/local/bin/gsl
|
||||
|
||||
# Pour les dossiers de scripts
|
||||
sudo mkdir -p "/var/lib/gsl"
|
||||
sudo chown -R USER:GROUP "/var/lib/gsl"
|
||||
rsync -a var/lib/gsl/ /var/lib/gsl/
|
||||
|
||||
# Pour le dossier de logs
|
||||
sudo mkdir -p "/var/log/gsl"
|
||||
sudo chown -R USER:GROUP "/var/log/gsl"
|
||||
|
||||
# Pour le dossier de configuration
|
||||
sudo mkdir -p /etc/gsl
|
||||
sudo chown -R USER:GROUP "/etc/gsl"
|
||||
|
||||
# Pour l'autocompletion des articles dans la commande
|
||||
sudo rsync -a usr/share/bash-completion/completions/gsl /usr/share/bash-completion/completions/gsl
|
||||
sudo chown USER:GROUP "/usr/share/bash-completion/completions/gsl"
|
||||
```
|
||||
|
||||
Attention: GSL aura besoin de créer des sous-dossier dans le serveur,
|
||||
renseigné dans le questionnaire. (i.e. /var/www/). Il faut donc lui
|
||||
donner les droits
|
||||
|
||||
# Arborescence des dossiers utilisés par GSL
|
||||
------------------------------------------------------------------------
|
||||
Note: ```+``` indique que GSL créera ces dossiers
|
||||
|
||||
- /etc/gsl
|
||||
- /var/log/gsl
|
||||
- /var/lib/gsl
|
||||
- - /help/
|
||||
- - /scripts/
|
||||
- - /domains
|
||||
- - - /DOMAIN
|
||||
- - - - /templates/ +
|
||||
- - - - /files/ +
|
||||
- - - - /images/ +
|
||||
- - - - /X-tra +
|
||||
- - - - - /sidebar +
|
||||
- - /db
|
||||
- - - /DOMAIN +
|
||||
|
||||
- /SRV (i.e. /var/www)
|
||||
- - /DOMAIN
|
||||
- - - /wip
|
||||
- - - - /TEMPLATE (sync wip (command) from /var/lib/gsl/domains/DOMAIN/)
|
||||
- - - /www
|
||||
- - - - /TEMPLATE (sync www (command) from /var/lib/gsl/domains/DOMAIN/)
|
||||
|
||||
|
||||
# Fichiers créés par GSL
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- /var/log/gsl
|
||||
- - gsl.log
|
||||
- - Y-M-D-H-M-S.gsl.log (backup when clean ; removed with clean all)
|
||||
- /var/lib/gsl
|
||||
- - /domains
|
||||
- - - DOMAIN
|
||||
- - - - authors.db
|
||||
- - - - DOMAIN.conf
|
||||
- - /db/
|
||||
- - - domains.db (registred domains)
|
||||
- - - DOMAIN/
|
||||
- - - - (file).gsl.db (Un par article)
|
|
@ -0,0 +1,74 @@
|
|||
# GSL: Statique Littérateur
|
||||
|
||||
$ gsl (ARG)
|
||||
readme : Show README.md instructions
|
||||
help | -h (OPT) : This Help and how to
|
||||
install | -i : Show process installation
|
||||
authors | -a : Add/Remove authors for this DOMAIN
|
||||
setdir | -d : Set a directory for article's DOMAIN
|
||||
write | -w : Write a Post
|
||||
tpl | -T : Create your template
|
||||
param | -p : Configure some parameters
|
||||
css : Show used CSS classes
|
||||
tips | -t : Show tips and advises you should know
|
||||
|
||||
new | -N : Generic OPT to add/create
|
||||
domain : Configure your DOMAIN
|
||||
author : Same as gsl author edit
|
||||
(TYPE) (NAME) : Create an article with (TYPE) named (NAME).gsl
|
||||
|
||||
setdir | -D : Show current directory DOMAIN or set it
|
||||
|
||||
log | -L (OPTS) : Show logs from all sessions
|
||||
clean | -C : Logs saved to {DATE}.gsl.log and cleaned
|
||||
all : clean all saved logs, keep current
|
||||
-i | -w | -e : from levels (infos, warnings, errors)
|
||||
-s : from last session only
|
||||
(TERM) : (TERM) : case insensitive, regex 'T1.*T2'
|
||||
(i.e. $ gsl log -e -s code)
|
||||
|
||||
author | -A : List authors from DOMAIN in PWD folder
|
||||
edit : Add/Remove ! ONE author per line
|
||||
|
||||
edit | -E : Open in default EDITOR (FILE) or with nano
|
||||
conf : Domain configuration file
|
||||
author : Same as gsl author edit
|
||||
domain : Domains registred database
|
||||
(FILE) : (FILE) ; .gsl
|
||||
|
||||
db (FILE) : Show DB statuses from (FILE)
|
||||
|
||||
sync (OPT) : Sync Templates to www and wip
|
||||
wip : Only to wip server (also done with make)
|
||||
www : Only to www server (also done with www)
|
||||
|
||||
|
||||
check | -C (OPTIONS) : Check Post(s) errors from PWD folder
|
||||
-N : Check only articles not in DB
|
||||
-F : Force Check again ; Recreate in Database
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
make | -M (OPTIONS) : Make all HTML articles or only (FILE)
|
||||
-F : Force Make again
|
||||
(FILE) : Only this (FILE)
|
||||
|
||||
www (OPT1) (OPT2) : Add/Remove Post(s) in www server
|
||||
(OPT1):
|
||||
sync : Same as "sync www"
|
||||
add : Add all/(FILE) to www server
|
||||
rmove : remove all/(FILE) from www server
|
||||
(OPT2):
|
||||
all : Select all post with wip statuses
|
||||
(FILE) : Select specific post (if wip status)
|
||||
|
||||
wip : Same as www for wip
|
||||
|
||||
sidebar | -S : Show Posts in list (ARG) (POS) (FILE)
|
||||
(ARG):
|
||||
add | -a : Put article at (POS). Remove last, roll from (POS)
|
||||
replace | -r : Replace (POS) with article
|
||||
latest | -l : Create sidebar with latest (remove all existing)
|
||||
|
||||
-v : Show local versionn
|
||||
--version : Like -v + changes
|
||||
-vv : Shown local and repo Versions
|
|
@ -0,0 +1,95 @@
|
|||
# CSS Classes and IDs
|
||||
```xxx``` is your choosen CSS acronym for your DOMAIN
|
||||
Note: if "myclass" or "myID" is not defined, class or ID is not used
|
||||
|
||||
## Legacy HTML
|
||||
### body
|
||||
myID is set in article with css: myID
|
||||
TYPE is set in article with type: page|post
|
||||
- body: xxx_TYPE myID
|
||||
|
||||
## Article Content
|
||||
### Metas (author, date...)
|
||||
|
||||
### Titles h1-h6
|
||||
X is 1 to 6
|
||||
- xxx_title xxx_title-X
|
||||
|
||||
### div between titles
|
||||
X is 1 to 6 from current title
|
||||
- xxx_content_hX
|
||||
|
||||
### Between markers (code, emphasis, strong...)
|
||||
- bold: xxx_bold
|
||||
- strong: xxx_strong
|
||||
- emphasis: xxx_em
|
||||
- strike: xxx_strike
|
||||
- inline code: xxx_icode
|
||||
|
||||
### Paragraphs
|
||||
myclass is the content value used (i.e.```( myclass```)
|
||||
- xxx_p myclass
|
||||
|
||||
### Links
|
||||
- xxx_link
|
||||
- xxx_link xxx_link-window (if "+" for target)
|
||||
|
||||
### Links from file
|
||||
- xxx_link-file
|
||||
- xxx_link-file xxx_link-file-window (if "+" for target)
|
||||
|
||||
### Image and image link
|
||||
myclass is from content marker (i.e. _image:1:myclass:90:90:+)
|
||||
- link: xxx_image-link myclass
|
||||
- img: xxx_image xxx_image-(left,right,cente)
|
||||
- - If myclass replace xxx_image-(left...) by myclass
|
||||
|
||||
### pre-codes from source file
|
||||
X is the NAME/NBR registred in header
|
||||
- pre: xxx_code-block xxx_code-block-X
|
||||
- span line: xxx_code-line
|
||||
- span content: xxx_code-content
|
||||
- p after pre: xxx_code-p
|
||||
- link source: xxx_code-link
|
||||
|
||||
### Liste (ol | ul | li)
|
||||
X is the item mark nbr (i.e. "+++" = 3, "=" = 1)
|
||||
myclass is the registred value after << (i.e. << myclass). Only used at
|
||||
the begining bloc.
|
||||
- ol: xxx_list xxx_list-ol xxx_myclass xxx_myclass-ol
|
||||
- ul: xxx_list xxx_list-ul xxx_myclass xxx_myclass-ul
|
||||
- li: a-lec_li a-lec_li-X
|
||||
|
||||
### Quotes
|
||||
myclass is the registred value after "---" (i.e. --- myclass)
|
||||
myclass is used on
|
||||
- ```<blockquote>``` (if no "_cite")
|
||||
- - blockquote: xxx_quote myclass
|
||||
- ```<figure>``` if "_cite"
|
||||
- - figure: xxx_quote-fig myclass
|
||||
|
||||
## Sidebar Content
|
||||
- aside: xxx_sidebar
|
||||
- - div: xxx__wrapper
|
||||
- - - nav: xxx_latest-posts
|
||||
- - - - h1: xxx_latest-posts
|
||||
- - - - ul: xxx_latest-posts
|
||||
- - - - - li: xxx_list-post-item
|
||||
- - - - - a: xxx_list-post-link
|
||||
- - - - - - span: xxx_list-post-title
|
||||
- - - - - - div: xxx__list-post-metas
|
||||
- - - - - - div: xxx__list-post-info
|
||||
|
||||
## Header content
|
||||
- header: xxx_banner
|
||||
- - div: xxx_site-logo
|
||||
- - div: xxx_site-title
|
||||
- - - h1: xxx_site-name
|
||||
- - - h2: xxx_site-description
|
||||
|
||||
## Footer content
|
||||
- footer: xxx_footer (ID)
|
||||
- - div: xxx_footer-infos (ID)
|
||||
- - div: xxx_footer-about (ID)
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Tips and Advises
|
||||
## Configuration
|
||||
- CSS acronym will always be in lower case
|
||||
|
||||
## ABBR
|
||||
- short name (HEADER): must be in CAPS LOCK (abbr: LEC : Libre en communs)
|
||||
- short name (CONTENT): must contain a space (" LEC", " LEC ", "LEC ")
|
||||
|
||||
## Files (Images, codes, scripts...)
|
||||
You can create sub-directories in DOMAIN/files or DOMAIN/images
|
||||
If you do so, in your article HEADER, set FILENAME with sub-dirs, but
|
||||
do NOT begin with /
|
||||
```
|
||||
# File put in /var/lib/gsl/domains/DOMAIN/images/dir/dir1/pic.png
|
||||
image: 1 : dir/dir1/pic.png
|
||||
```
|
||||
|
||||
## Images: set style and target
|
||||
```
|
||||
# Open in new tab pic, keep origin sizes
|
||||
_image:1:+
|
||||
|
||||
# Open pic in new tab, using your css class and with width in pixel
|
||||
# (height is kept)
|
||||
_image:1:c:640px:+
|
||||
```
|
||||
|
||||
## Make (changes in source file)
|
||||
If you change the content of a file (script code, image...), you will
|
||||
have to make -F your article, and do www add after
|
||||
|
||||
## Sidebar
|
||||
If your remove a www or wip page, and you put it in sidebar,
|
||||
do not forget to replace it with another article
|
|
@ -0,0 +1,4 @@
|
|||
# To add/remove authors:
|
||||
- cd to your article folder
|
||||
- gsl author edit
|
||||
- Set one author per line !
|
|
@ -0,0 +1,7 @@
|
|||
# Edit the file: /etc/gsl.conf
|
||||
|
||||
## Show logs by time or level (level ="")
|
||||
- gsl_logs_order=time
|
||||
|
||||
## Minimum Size of a post (default ="180")
|
||||
- gsl_article_min_Size=250
|
|
@ -0,0 +1,7 @@
|
|||
# To set a dedicated folder for your articles
|
||||
- cd myfolder ; to go into your folder of choice
|
||||
- gsl setdir ; to choose your domain ;
|
||||
|
||||
If your directory is configured, it will be mentionned, else:
|
||||
- You'll be asked to choose a reegistred one
|
||||
- You can now create articles. filename must be a .gsl
|
|
@ -34,6 +34,7 @@ gsl make -F
|
|||
```
|
||||
|
||||
## Listes de classes utilisées.
|
||||
|
||||
Rappel: les classes et IDs commencent par votre ACRONYM configuré,
|
||||
lors de la création d'un domaine avec ```gsl new```, suivi par ```_```.
|
||||
Pour une meilleure lisibilité, votre ACRONYM est marqué xxx.
|
||||
|
@ -44,10 +45,10 @@ Pour une meilleure lisibilité, votre ACRONYM est marqué xxx.
|
|||
- - body: xxx_page
|
||||
- - header: xxx_banner
|
||||
- - logo dans header: xxx_site-logo
|
||||
- - title dans header: xxxsite-title
|
||||
- - title dans header: xxx_site-title
|
||||
- - name dans header: xxx_site-name
|
||||
- - Description dans header: xxx_site-description
|
||||
- - ```<section>``` avant ```<article>```: xxxspage-wrapper
|
||||
- - ```<section>``` avant ```<article>```: xxx_page-wrapper
|
||||
- - article: xxx_SLUG (SLUG est le "slug: SLUG" de l'article)
|
||||
- - div metas (auteur, date...): xxx_metas
|
||||
- - p dans div metas: xxx_auteur
|
||||
|
@ -55,10 +56,12 @@ Pour une meilleure lisibilité, votre ACRONYM est marqué xxx.
|
|||
### Dans ```<article>```
|
||||
|
||||
- CLASS=
|
||||
- hX: xxx_title-X
|
||||
- - div après chaque titre ```<hX>```: xxx_content-p xxx_content-pX
|
||||
- - p dans div content-p: xxx_paragraph
|
||||
- - - si contenu ```( 2```: xxx_paragraph-2
|
||||
- - - si contenu ```( 1z```: xxx_paragraph-1z
|
||||
- - code pour les inline-code avec ```¤...¤```: xxx_icode
|
||||
- strikee: xxx_strike
|
||||
- - li (liste) en fonction du nombre N de ```= | +```: xxx__list-li x_list-N
|
||||
- - ul (liste) simple: xxx_list-ul
|
||||
- - ol (liste) ordonnée: xxx_list-ol
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
# GSL: Statique Littérateur
|
||||
|
||||
$ gsl [ARG]
|
||||
readme : Show README.md instructions
|
||||
help | -h [OPT] : This Help
|
||||
install : Show process installation
|
||||
new : Adding a DOMAIN
|
||||
write | -w : How to write a Post
|
||||
template | -t : Tips to create your template
|
||||
|
||||
new | -N : Add and configure a new DOMAIN
|
||||
|
||||
log | -L [OPTS] : Show logs from all sessions
|
||||
clean | -C : Logs saved to {DATE}.gsl.log and cleaned
|
||||
-i | -w | -e : from levels (infos, warnings, errors)
|
||||
-s : from last session only
|
||||
[TERM] : [TERM] : case insensitive, regex 'T1.*T2'
|
||||
(i.e. $ gsl log -e -s code)
|
||||
|
||||
author | -A [OPT] : List authors from DOMAIN set in PWD folder
|
||||
add : Add author(s) for DOMAIN
|
||||
remove : Remove author(s) for DOMAIN
|
||||
|
||||
create [TYPE] [NAME] : Create an article with [TYPE] named [NAME].gsl
|
||||
|
||||
edit | -E : Open in default EDITOR [FILE] or with nano
|
||||
conf : Domain configuration file
|
||||
[FILE] : [FILE] (.gsl)
|
||||
|
||||
db [FILE] : Show DB statuses from [FILE]
|
||||
|
||||
sync [OPT] : Sync Templates to www and wip
|
||||
wip : Only to wip server (also done with make)
|
||||
www : Only to www server (also done with www)
|
||||
|
||||
|
||||
check | -C [OPT] [FILE] : Check Posts errors from PWD folder or [FILE]
|
||||
-F : Force check again
|
||||
|
||||
make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE]
|
||||
to HTML file in server
|
||||
-F : Force Make again
|
||||
|
||||
www [OPT1] [OPT2] : Add/Remove Post from www server
|
||||
[OPT1]:
|
||||
add : Add all/[FILE] to www server
|
||||
rmove : remove all/[FILE] from www server
|
||||
[OPT2]:
|
||||
all : Select all post with wip statuses
|
||||
[FILE] : Select specific post (if wip status)
|
||||
|
||||
|
||||
sidebar | -S [ARG] [FILE]: Show Posts in list
|
||||
[ARG]:
|
||||
add | -A : Must set a Position number before [FILE]
|
||||
Max posts in list is set in gsl.conf
|
||||
Replace post position if post not exists in list
|
||||
remove | -R : No Position to set, just [FILE].
|
||||
add/remove will build last-posts-list.html
|
||||
create | -C : rebuild last-posts-list.html
|
||||
|
||||
-v : Show local versionn
|
||||
--version : Like -v + changes
|
||||
-vv : Shown local and repo Versions
|
|
@ -1,33 +0,0 @@
|
|||
# GSL: Installation
|
||||
------------------------------------------------------------------------
|
||||
|
||||
To avoid sudo, you should give permissions to USER
|
||||
|
||||
## --Prefix for DOMAIN configuration (set according to user choice):
|
||||
- HOME: ~/.config/gsl
|
||||
- GLOBAL: /var/lib/gsl
|
||||
- Folder: --Prefix/domains/ (created with $ gsl new)
|
||||
|
||||
### DOMAIN Datas from Prefix:
|
||||
- Folder: --Prefix/DOMAIN/ (Created by GSL)
|
||||
- - Files: DOMAIN.conf, authors.db (Created by GSL)
|
||||
- - Folder: --Prefix/DOMAIN/templates/ (css, logos...) (Created by GSL)
|
||||
|
||||
## Destination Folder: /etc/gsl/
|
||||
- File: gsl.conf
|
||||
|
||||
## Destination Folder: /var/lib/gsl/
|
||||
- Folder: db (Created by GSL)
|
||||
- Folder: helps
|
||||
- Folder: scripts
|
||||
- File: README.md
|
||||
|
||||
## Destination Folder: /var/log/gsl
|
||||
- File: gsl.log (Created and managed by GSL $ gsl log clean...)
|
||||
|
||||
## Destination Folder: /usr/local/bin
|
||||
- File: gsl
|
||||
|
||||
## Destination Folder: /usr/share/bash-completion/completions/gsl
|
||||
- File: gsl
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
# Stats are one Post per line
|
||||
Format : txt
|
||||
Separator : |
|
||||
|
||||
# Fields:
|
||||
1 : Post Filename
|
||||
2 : Words
|
||||
3 : Paragraphs
|
||||
4 : Abbr
|
||||
5 : Header Links
|
||||
6 : Header Images
|
||||
7 : Header Files
|
||||
8 : Citations
|
||||
9 : Block-code Files
|
||||
10 : Posted Links
|
||||
11 : Italic
|
||||
12 : Strong
|
||||
13 : Bold
|
||||
14 : Inline-Code
|
||||
15 : Posted files
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
# How to Write a Post
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Post has 2 sections : Before and After #1. #1 is the FIRST Title of your
|
||||
post. #(1-6) are HTML titles (<h1> to <h6>).
|
||||
- Before #1 is used to set METAs HEADERS to configure your Post.
|
||||
- From #1 is the CONTENT of your Post
|
||||
|
||||
## NEEDED HEADERS (before #1)
|
||||
Register METAs for HTML Page content
|
||||
|
||||
```
|
||||
title: POST TITLE
|
||||
slug: POST-TITLE (if space in slug GSL will convert them)
|
||||
info: DESCRIPTION (about the Post)
|
||||
author: NAME (must be registred ($ gsl author add)
|
||||
date: YYYY-MM-DD
|
||||
tags: TAG1,OTHER TAG2,TAG3 (comma separated)
|
||||
```
|
||||
|
||||
### Admin Header
|
||||
Admin can define specific type of content. If no type defined, GSL will
|
||||
add at first line the default value: "type: post".
|
||||
|
||||
TYPE:
|
||||
- post < classic content
|
||||
- page < used to define main index, 404, about...
|
||||
|
||||
```
|
||||
type: TYPE
|
||||
```
|
||||
|
||||
GSL will create html file according to slug. Do not add .html to slug.
|
||||
- post < /slug/index.html
|
||||
- page < /slug.html
|
||||
|
||||
## Optional HEADERS (before #1)
|
||||
Register METAs for CONTENT. " : " field separator
|
||||
|
||||
```
|
||||
abbr: SHORT : LONG
|
||||
file: NAME : FILENAME : Alt Text
|
||||
link: NAME : URL : Alt Text
|
||||
code: NBR : FILENAME : Alt Text
|
||||
image: NBR : FILENAME : ALT-TEXT
|
||||
```
|
||||
|
||||
## CONTENT Post:
|
||||
In Content Post, markers (i.e. __My Great file) must be on the SAME line.
|
||||
For ABBRs, just write SHORT in your content
|
||||
|
||||
```
|
||||
# Paragraphs
|
||||
At begining of new line, open with ( and close with )
|
||||
Set till 3 different classes with ( 1 ( 2 ( 3
|
||||
( 2
|
||||
This is a paragraph with class 2
|
||||
)
|
||||
|
||||
# Register in Header. link: My Great Link : URL : Alt text
|
||||
_My Great Link
|
||||
_My Great Link+ # Open in new tab
|
||||
|
||||
# Register in Header. file: My Great file : FILENAME : ALT-TEXT
|
||||
__My Great file
|
||||
|
||||
# Register in Header. image: 1 : FILENAME : ALT-TEXT
|
||||
_image:1:[OPT l|r|c (left, right, center, alignment)]
|
||||
_image:1:r
|
||||
|
||||
# Block-Code File: Register in Header. code: 1 : FILENAME : Alt Text
|
||||
_code:1
|
||||
|
||||
# Write in STRONG
|
||||
**this strong content**
|
||||
this un**believe**able content
|
||||
this border**line** content
|
||||
|
||||
# BOLD
|
||||
*this bold content*
|
||||
...
|
||||
|
||||
# Write in ITALIC
|
||||
/this em text/
|
||||
|
||||
# Inline-code (¤ = alt-gr + $ on FR keyboard)
|
||||
¤push()¤
|
||||
|
||||
# Simple Blockquote: Use 3 "-"
|
||||
---
|
||||
(
|
||||
A simple great quote
|
||||
)
|
||||
---
|
||||
|
||||
# Advanced Blockquote
|
||||
---
|
||||
_cite : Richard Matthew Stallman
|
||||
_link : https://stallman.org/
|
||||
_lang : en
|
||||
(
|
||||
In the free/libre software movement, we develop software that respects
|
||||
users' freedom, so we and you can escape from software that doesn't. I
|
||||
could have made money this way, and perhaps amused myself writing code.
|
||||
But I knew that at the end of my career, I would look back on years of
|
||||
building walls to divide people, and feel I had spent my life making the
|
||||
world a worse place
|
||||
)
|
||||
---
|
||||
|
||||
# For advanced blockquotes, you can also add, if known:
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
|
||||
# Create Lists
|
||||
Use = to create an item. You can use infinite sub-items, but each Item
|
||||
of a list MUST be on the same Line
|
||||
(
|
||||
Let's start a list
|
||||
= Item 1 is *great*
|
||||
== sub-item 1
|
||||
== sub-item 2
|
||||
=== sub-sub-item 1 of sub-item 2
|
||||
== sub-item 3
|
||||
= Item 2
|
||||
== sub-item 1 of Item 2
|
||||
This list is ended
|
||||
)
|
||||
```
|
|
@ -1,19 +0,0 @@
|
|||
# GSL: Statique Littérateur
|
||||
|
||||
GSL can manage multiple websites, based on their DOMAIN (example.org) Name
|
||||
When adding, set your new DOMAIN, for Global or Home Use
|
||||
|
||||
# --prefix: Domain configuration saved to
|
||||
- Home case : /home/USER/.config/gsl/domains/
|
||||
- Global case: /var/lib/gsl/domains/
|
||||
|
||||
- Website datas
|
||||
: --prefix/DOMAIN/DOMAIN.conf
|
||||
|
||||
- Website templates, where you give .css, logo, footer.html...
|
||||
: --prefix/DOMAIN/templates
|
||||
|
||||
# Adding a folder for your posts ('gsl new' command will ask to create one):
|
||||
- Add/Create or go into a folder (i.e. /home/USER/Documents/Mytexts)
|
||||
- Set an empty file in this folder named gsl.DOMAIN (i.e. gsl.example.com)
|
||||
- Save in this folder your posts in files with .gsl extension (i.e. mygreatpost.gsl)
|
|
@ -1,4 +0,0 @@
|
|||
# Tips: what to (not) do
|
||||
## Do NOT:
|
||||
- put "^" in titles (#1-6)
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
## [0.0.9]
|
||||
|
||||
## 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
|
||||
### 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)
|
||||
|
||||
### 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
|
||||
- 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
|
||||
- wip ...: Same as www but for wip
|
||||
|
||||
### 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 ```<head>``` 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)
|
||||
- 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
|
|
@ -0,0 +1,255 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__HTML_template
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
# HTML code for <heade>
|
||||
#
|
||||
# You can edit this function and create your needed HTML code
|
||||
# After editing DO: gsl make -F
|
||||
# for all your pages to be updated
|
||||
#======================================================================
|
||||
create__HTML_header() {
|
||||
cat <<EOHEADER
|
||||
<header id="${site_css}_banner">
|
||||
<div id="${site_css}_site-logo">
|
||||
<a href="/">
|
||||
<img src="${srv_uri}templates/$site_logo"
|
||||
alt="Logo: $site_title"
|
||||
title="Logo: $site_title"/>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="${site_css}_site-title">
|
||||
<h1 id="${site_css}_site-name">
|
||||
<a href="/"
|
||||
title="$gsl_welcome $site_itle">
|
||||
$site_title
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
<h2 id="${site_css}_site-description">$site_about</h2>
|
||||
</div>
|
||||
</header>
|
||||
EOHEADER
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# HTML code in <footer>
|
||||
# /domains/DOMAIN/templates/footer.html
|
||||
# ! DO NOT EDIT this function
|
||||
# It creates file -IF NOT EXISTS-
|
||||
#
|
||||
# Add / Edit your own
|
||||
# Create or Edit file /domains/DOMAIN/templates/footer.html
|
||||
# After editing DO: gsl make -F
|
||||
# for all your pages to be updated
|
||||
#======================================================================
|
||||
create__HTML_footer() {
|
||||
cat <<EOFOOTER > "$gsl_dir_domain_tpl/footer.html"
|
||||
<footer id="${site_css}_footer">
|
||||
<h1>$gsl_about $site_title</h1>
|
||||
<div id="${site_css}_footer-infos">
|
||||
<p>...<p>
|
||||
</div>
|
||||
|
||||
<div id="${site_css}_footer-about">
|
||||
<p class="${site_css_footer-p}">
|
||||
<a href="$site_url">
|
||||
<b>$site_title</b>
|
||||
</a>: $site_about
|
||||
<br />
|
||||
Contact: $site_mail
|
||||
<br />
|
||||
Copyright: $site_cr
|
||||
<br />
|
||||
$gsl_gen: <a href="https://git.a-lec.org/echolib/gsl" target="_blank">
|
||||
<b>GSL: Statique Littérateur</b>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</footer>
|
||||
EOFOOTER
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Translate some static words according to site_lang
|
||||
#======================================================================
|
||||
create__HTML_translation() {
|
||||
if [[ `grep -i "fr" <<<"$site_lang"` ]];then
|
||||
gsl_welcome="Page d'accueil de"
|
||||
gsl_written="Écrit par"
|
||||
gsl_about=" À propos de"
|
||||
gsl_gen="Propulsé par"
|
||||
gsl_the="Le"
|
||||
gsl_by="par"
|
||||
gsl_read="Lire l'article de"
|
||||
|
||||
else
|
||||
gsl_welcome="Welcome page of"
|
||||
gsl_written="Written by"
|
||||
gsl_bout="About"
|
||||
gsl_gen="Generated with"
|
||||
gsl_the="The"
|
||||
gsl_by="by"
|
||||
gsl_read="Read the post of"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Page Template
|
||||
#======================================================================
|
||||
create__HTML_page() {
|
||||
create__HTML_translation
|
||||
|
||||
! [[ -f "$gsl_dir_domain_tpl/metas.html" ]] \
|
||||
&& create__HTML_metas
|
||||
|
||||
! [[ -f "$gsl_dir_domain_tpl/footer.html" ]] \
|
||||
&& create__HTML_footer
|
||||
|
||||
# Create sub-directories if post only
|
||||
[[ $article_Type == "post" ]] \
|
||||
&& mkdir -p "$gsl_srv_wip/$article_Slug"
|
||||
|
||||
cat <<EOPAGE > "$gsl_srv_post_wip"
|
||||
<!DOCTYPE html>
|
||||
<html lang="${site_lang: :2}">
|
||||
<head>
|
||||
$(cat "$gsl_dir_domain_tpl/metas.html")
|
||||
<meta name='generator' content="GSL: Statique Littérateur">
|
||||
|
||||
<meta name='title' content="$article_Title | $site_title">
|
||||
<meta name='author' content="$article_Author">
|
||||
<meta name='description' content="$article_Info">
|
||||
<meta name='keywords' content="$site_keys,$article_Tags">
|
||||
<meta name='search_date' content="$article_Date">
|
||||
|
||||
<link rel="stylesheet" media="screen" href="${srv_uri}templates/styles.css" />
|
||||
<link rel="shortcut icon" type="image/png" href="${srv_uri}templates/favicon.png" />
|
||||
<link rel='me' type='text/html' href="$site_auth_url">
|
||||
<title>$article_Title - $site_title</title>
|
||||
</head>
|
||||
|
||||
<body id="${site_css}_$article_Type$article_CSS">
|
||||
$(create__HTML_header)
|
||||
|
||||
<section id="${site_css}_page-wrapper">
|
||||
<article id="${site_css}_$article_Slug">
|
||||
|
||||
<div id="${site_css}_metas">
|
||||
<p id="${site_css}_auteur">$gsl_written <strong>$article_Author</strong> - $article_Date</p>
|
||||
</div>
|
||||
|
||||
$(cat "$gsl_tmp_post")
|
||||
|
||||
</article>
|
||||
|
||||
<aside id="${site_css}_sidebar">
|
||||
<div class="${ite_css}_wrapper" role="navigation">
|
||||
<nav id="${site_css}_latest-posts">
|
||||
<h1 class="${site_css}_latest-posts">$site_listname</h1>
|
||||
<ul class="${site_css}_latest-posts"
|
||||
aria-label="$site_listname">
|
||||
<!--# include file="${srv_uri}templates/sidebar.html" -->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
$(cat "$gsl_dir_domain_tpl/footer.html")
|
||||
|
||||
</body>
|
||||
</html>
|
||||
EOPAGE
|
||||
|
||||
gsl__logs_print -i -S -wip \
|
||||
"Created HTML $article_Type" \
|
||||
"$gsl_srv_post_wip"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# METAS in <head>
|
||||
# /domains/DOMAIN/templates/metas.html
|
||||
# ! DO NOT EDIT this function
|
||||
# It creates file -IF NOT EXISTS-
|
||||
#
|
||||
# Edit your values in the file....
|
||||
# After editing DO: gsl make -F
|
||||
# for all your pages to be updated
|
||||
#======================================================================
|
||||
create__HTML_metas() {
|
||||
cat <<EOMETAS > "$gsl_dir_domain_tpl/metas.html"
|
||||
<meta charset="UTF-8" />
|
||||
<meta name='viewport' content="width=device-width, initial-scale=1.0">
|
||||
<meta name='robots' content="all">
|
||||
<meta name='medium' content='website'>
|
||||
<meta name='revisit-after' content="3 days">
|
||||
<meta name='language' content="$site_lang">
|
||||
<meta name='reply-to' content="$site_mail">
|
||||
<meta name='copyright' content="$site_cr">
|
||||
EOMETAS
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Called from sidebar__create in gsl__post_makers
|
||||
# file: /var/lib/gsl/domains/DOMAIN/X-tra/sidebar/[POSITION].html
|
||||
# You can edit this HTML code for your needs
|
||||
# It can get all Values from Database post
|
||||
# $1: file ($sidebar_HTML_item - see above)
|
||||
#======================================================================
|
||||
create__HTML_sidebar_item() {
|
||||
cat <<EOSIDEBARITEM > "$1"
|
||||
<li class="${site_css}_list-post-item">
|
||||
<a href="/$gsl_slug_file"
|
||||
class="a-lec_list-post-link"
|
||||
title="$gsl_read $article_Author: $article_Title">
|
||||
|
||||
<span class="a-lec_list-post-title">$article_Title</span>
|
||||
|
||||
<div class="a-lec_list-post-metas">
|
||||
$gsl_the $article_Date $gsl_by $article_Author
|
||||
</div>
|
||||
|
||||
<div class="a-lec_list-post-info">
|
||||
$article_Info
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
EOSIDEBARITEM
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Called from sidebar__create in gsl__post_makers
|
||||
# $1: log process
|
||||
# $2: file: /var/lib/gsl/domains/DOMAIN/templates/sidebar.html
|
||||
#======================================================================
|
||||
create__HTML_sidebar() {
|
||||
gsl_post="sidebar.html"
|
||||
[[ -f "$2" ]] \
|
||||
&& rm -f "$2" \
|
||||
&& gsl__logs_print -w -s $1 \
|
||||
"Removed to Set new one" \
|
||||
"$2"
|
||||
|
||||
for i in `seq 1 $site_max_list`
|
||||
do
|
||||
[[ -f "$gsl_dir_domain_sidebar/$i.html" ]] \
|
||||
&& cat "$gsl_dir_domain_sidebar/$i.html" \
|
||||
>> "$2"
|
||||
done
|
||||
|
||||
gsl__logs_print -i -s "$1" \
|
||||
"Created" \
|
||||
"$2"
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__auth_manager
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#=======================================================================
|
||||
# Manage Authors from DOMAIN
|
||||
#=======================================================================
|
||||
gsl__authors_check() {
|
||||
gsl_save_dir_ndd=`grep "$gsl_find_domain" "$gsl_file_db_domains"`
|
||||
gsl_file_auth_ndd="$gsl_save_dir_ndd/$gsl_filename_auth"
|
||||
|
||||
if [[ -f "$gsl_file_auth_ndd" ]];then
|
||||
[[ -z `grep '[^[:space:]]' "$gsl_file_auth_ndd"` ]] \
|
||||
&& echo "# Domain: $gsl_find_domain" \
|
||||
&& echo "! No Registred authors yet..." \
|
||||
&& return 1
|
||||
fi
|
||||
|
||||
touch "$gsl_file_auth_ndd"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# List Authors from DOMAIN
|
||||
#=======================================================================
|
||||
gsl__authors_list() {
|
||||
|
||||
case "$1" in
|
||||
check)
|
||||
gsl__authors_check || return
|
||||
return
|
||||
;;
|
||||
*)
|
||||
gsl__authors_check || return
|
||||
;;
|
||||
esac
|
||||
|
||||
echo -e "\n# Authors Registred:"
|
||||
while read -r "line_nbr" "author"
|
||||
do
|
||||
echo " $line_nbr: $author"
|
||||
done < <(cat -n "$gsl_file_auth_ndd")
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Add Author(s) for DOMAIN to authors.db in Profile User
|
||||
#=======================================================================
|
||||
gsl__authors_add() {
|
||||
gsl__authors_list add
|
||||
|
||||
printf '\n%s\n%s\n%s\n \n' \
|
||||
"# You can add one or more Authors" \
|
||||
" Use comma (,) delimiter (i.e. Joe Foo,Jane)" \
|
||||
" || empty field to cancel"
|
||||
|
||||
echo -ne "# Add author(s) name : " && IFS="," read -a gsl_new_authors
|
||||
[[ "$gsl_new_authors" ]] || return
|
||||
|
||||
gsl_nbr_authors=${#gsl_new_authors[@]}
|
||||
for i in `seq 0 $(( gsl_nbr_authors - 1 ))`
|
||||
do
|
||||
echo "${gsl_new_authors[i]}" >> "$gsl_file_auth_ndd" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Author" \
|
||||
"Added" \
|
||||
"${gsl_new_authors[i]} for domain $gsl_find_domain" \
|
||||
"$gsl_file_auth_ndd"
|
||||
done
|
||||
|
||||
gsl__authors_list
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Remove Author(s) for DOMAIN from authors.db in Profile User
|
||||
#=======================================================================
|
||||
gsl__authors_remove() {
|
||||
gsl__authors_list remove || exit 1
|
||||
|
||||
printf '\n%s\n%s\n%s\n \n' \
|
||||
"# You can REMOVE one or more Authors" \
|
||||
" Enter numbers (space delimiter)" \
|
||||
" || empty field to cancel"
|
||||
|
||||
read -rp "! Which numbers author to REMOVE ? " gsl_rm_authors
|
||||
gsl_rm_authors=($gsl_rm_authors)
|
||||
|
||||
gsl_nbr_authors=`cat $gsl_file_auth_ndd | wc -l`
|
||||
for line in ${gsl_rm_authors[@]}
|
||||
do
|
||||
[[ $line =~ ^[0-9]+$ ]] || continue
|
||||
(( $line < 1 )) && continue
|
||||
(( $line > $gsl_nbr_authors )) && continue
|
||||
|
||||
if [[ $rm_line ]];then
|
||||
! (( $line == 1 )) && line=$(( line - 1 ))
|
||||
fi
|
||||
gsl_rm_author=`awk -v n="$line" 'NR == n' "$gsl_file_auth_ndd"`
|
||||
sed -i "${line}d" "$gsl_file_auth_ndd" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Author" \
|
||||
"Removed" \
|
||||
"$gsl_rm_author for domain $gsl_find_domain" \
|
||||
"$gsl_file_auth_ndd"
|
||||
echo " - Removed > $gsl_rm_author <"
|
||||
rm_line=true
|
||||
done
|
||||
|
||||
gsl__authors_list
|
||||
}
|
|
@ -1,186 +1,231 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__db_manager
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (db)
|
||||
# $1 File
|
||||
#======================================================================
|
||||
db__OPTIONS() {
|
||||
author__check || exit 0 # Check if authors registresd
|
||||
|
||||
! [[ "$1" ]] \
|
||||
&& gsl__invalid_option "$1" "[File]"
|
||||
|
||||
if__file "$1" post
|
||||
[[ -f "$gsl_dir_db_domain/$gsl_this_post.db" ]] \
|
||||
&& cat "$gsl_dir_db_domain/$gsl_this_post.db" \
|
||||
|| echo "! No DB yet for $gsl_this_post. Check it first."
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get Post Hash & Status From Database
|
||||
#======================================================================
|
||||
gsl__db_get_post_datas() {
|
||||
gsl_db_post_hash=0
|
||||
|
||||
if [[ -f "$gsl_file_db_post" ]];then
|
||||
|
||||
gsl_db_post_hash=`
|
||||
awk -F: 'NR == 1 {print $3}' \
|
||||
"$gsl_file_db_post"`
|
||||
|
||||
! [[ "$gsl_db_post_hash" ]] \
|
||||
&& gsl_db_post_hash=0
|
||||
|
||||
gsl_db_post_status=`
|
||||
awk -F: 'NR == 2 {print $2}' \
|
||||
"$gsl_file_db_post"`
|
||||
DB__datas() {
|
||||
if ! [[ -f "$gsl_file_db_post" ]];then
|
||||
gsl__logs_print -w -D -f \
|
||||
"Article not yet checked" \
|
||||
"$gsl_file_db_post"
|
||||
article_is_new=true
|
||||
|
||||
else
|
||||
# if check process, do not show (useless)
|
||||
case "$1" in
|
||||
check) true ;;
|
||||
*)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"File" \
|
||||
"Missing for $gsl_post. Check it first" \
|
||||
"$gsl_file_db_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
esac
|
||||
# Check corrupted file
|
||||
Hash_DB=`cksum "$gsl_file_db_post" | awk '{print $1}'`
|
||||
if ! [[ -f $gsl_file_db_post_hash.$Hash_DB ]];then
|
||||
db_corrupt=true
|
||||
[[ `grep "article_Status_www=" "$gsl_file_db_post"` \
|
||||
|| `grep "article_Status_wip=" "$gsl_file_db_post"` ]] \
|
||||
|| return
|
||||
fi
|
||||
|
||||
source "$gsl_file_db_post"
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Get Post Hash and Compare from Database
|
||||
#======================================================================
|
||||
gsl__db_compare_post_hash() {
|
||||
gsl_checker_war=true
|
||||
|
||||
if (( $gsl_post_hash == $gsl_db_post_hash ));then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"File" \
|
||||
"Hash" \
|
||||
"$gsl_post checked with hash:$gsl_db_post_hash" \
|
||||
"${PWD}/$gsl_post"
|
||||
|
||||
else
|
||||
|
||||
gsl_post_new_hash=true
|
||||
case "$gsl_db_post_hash" in
|
||||
0)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"File" \
|
||||
"New" \
|
||||
"$gsl_post not yet checked" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
*)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"File" \
|
||||
"Hash" \
|
||||
"$gsl_post Changed ($gsl_post_hash) !" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Set Post Status in Database according to proceess
|
||||
# Compare post Hash from Database
|
||||
#======================================================================
|
||||
gsl__db_set_post_status() {
|
||||
DB__compare_hash() {
|
||||
case "$1" in
|
||||
chk)
|
||||
case "$gsl_db_post_status" in
|
||||
"")
|
||||
gsl_db_post_status=$1
|
||||
;;
|
||||
esac
|
||||
check)
|
||||
gsl_do_check=true
|
||||
[[ $article_is_new ]] && return
|
||||
|
||||
[[ $db_corrupt ]] && gsl_force_check=true
|
||||
|
||||
if ! [[ "$gsl_force_check" ]];then
|
||||
[[ "$gsl_post_new_hash" ]] || return # Do Nothing if same Hash
|
||||
if [[ $article_Errors == "no" ]];then
|
||||
if (( $article_Hash == $article_Status_chk ));then
|
||||
if ! [[ $gsl_force_check ]];then
|
||||
gsl__logs_print -w -g -C \
|
||||
"Already done ; Use -F to force" \
|
||||
"$PWD/$gsl_post"
|
||||
unset gsl_do_check
|
||||
fi
|
||||
|
||||
else
|
||||
gsl__logs_print -w -g \
|
||||
"Compare" \
|
||||
"Old Hash: $article_Status_chk" \
|
||||
"${PWD}/$gsl_post"
|
||||
fi
|
||||
fi
|
||||
gsl__db_create_post "$gsl_db_post_status"
|
||||
;;
|
||||
|
||||
make|www)
|
||||
[[ $db_corrupt ]] \
|
||||
&& gsl__logs_print -e -D -f \
|
||||
"Corrupted ; Check again first" \
|
||||
"$gsl_file_db_post" \
|
||||
&& return
|
||||
|
||||
[[ $article_is_new ]] && return
|
||||
[[ $article_Errors == "yes" ]] \
|
||||
&& gsl__logs_print -e -A -inv \
|
||||
"Found errors ; Cannot continue" \
|
||||
"$PWD/$gsl_post" \
|
||||
&& return
|
||||
|
||||
wip)
|
||||
case "$gsl_db_post_status" in
|
||||
chk|www)
|
||||
sed -i "2s/.*/Status:$1/" "$gsl_file_db_post" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"File" \
|
||||
"Status:$1 ; $gsl_post" \
|
||||
"$gsl_file_db_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
www)
|
||||
case "$gsl_db_post_status" in
|
||||
wip)
|
||||
sed -i "2s/.*/Status:$1/" "$gsl_file_db_post" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"File" \
|
||||
"Status:$1 ; $gsl_post" \
|
||||
"$gsl_file_db_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
esac
|
||||
gsl_do_make=true
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Create DB File from Data Post
|
||||
#======================================================================
|
||||
gsl__db_create_post() {
|
||||
if [[ "$gsl_checker_err" ]];then
|
||||
[[ -f "$gsl_file_db_post" ]] \
|
||||
&& rm -f "$gsl_file_db_post" \
|
||||
&& gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"File" \
|
||||
"Remove ; error in $gsl_post" \
|
||||
"$gsl_file_db_post"
|
||||
return
|
||||
fi
|
||||
|
||||
#======================================================================
|
||||
# Logger
|
||||
#======================================================================
|
||||
DB__create_log() {
|
||||
gsl__logs_print -i -D -c \
|
||||
"$article_Type ; Hash: $article_Hash" \
|
||||
"$gsl_file_db_post"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Set Post Statuses (chk, wip, www) in Database according to proceess
|
||||
#======================================================================
|
||||
DB__set_status() {
|
||||
case "$1" in
|
||||
chk)
|
||||
article_Status_chk="article_Status_chk=$article_Hash"
|
||||
! [[ $article_Status_wip ]] \
|
||||
&& article_Status_wip="article_Status_wip=0" \
|
||||
|| article_Status_wip="article_Status_wip=$article_Status_wip"
|
||||
|
||||
! [[ $article_Status_www ]] \
|
||||
&& article_Status_www="article_Status_www=0" \
|
||||
|| article_Status_www="article_Status_www=$article_Status_www"
|
||||
|
||||
DB__create_datas
|
||||
DB__create_sum
|
||||
;;
|
||||
|
||||
wip)
|
||||
sed -i "s/article_Status_wip=.*/article_Status_wip=$article_Hash/" \
|
||||
"$gsl_file_db_post"
|
||||
DB__create_sum
|
||||
;;
|
||||
|
||||
wip-del)
|
||||
sed -i "s/article_Status_wip=.*/article_Status_wip=0/" \
|
||||
"$gsl_file_db_post"
|
||||
DB__create_sum
|
||||
;;
|
||||
|
||||
www)
|
||||
sed -i "s/article_Status_www=.*/article_Status_www=$article_Hash/" \
|
||||
"$gsl_file_db_post"
|
||||
DB__create_sum
|
||||
;;
|
||||
|
||||
www-del)
|
||||
sed -i "s/article_Status_www=.*/article_Status_www=0/" \
|
||||
"$gsl_file_db_post"
|
||||
DB__create_sum
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Create DB File for this article
|
||||
#======================================================================
|
||||
DB__create_datas() {
|
||||
! [[ -d "$gsl_dir_db_domain" ]] \
|
||||
&& mkdir -p "$gsl_dir_db_domain"
|
||||
|
||||
[[ -f "$gsl_file_db_post" ]] \
|
||||
&& rm -f "$gsl_file_db_post"
|
||||
|
||||
rm -f "$gsl_file_db_post_hash."*
|
||||
touch "$gsl_file_db_post"
|
||||
|
||||
# Main Print
|
||||
printf '%s\n%s\n%s\n' \
|
||||
"$gsl_post_type:${PWD}/$gsl_post:$gsl_post_hash:$gsl_post_size" \
|
||||
"Status:$1" \
|
||||
"`cat "$gsl_db_tmp"`" \
|
||||
> "$gsl_file_db_post"
|
||||
cat << EODB > "$gsl_file_db_post"
|
||||
# File
|
||||
article_domain="$domain_name"
|
||||
article_URI="${PWD}/$gsl_post"
|
||||
$article_Status_chk
|
||||
$article_Status_wip
|
||||
$article_Status_www
|
||||
article_epoch=$date_epoch
|
||||
|
||||
# Stats Print
|
||||
printf '\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
|
||||
"Stats" \
|
||||
"Author:$gsl_header_author" \
|
||||
"Date:$gsl_header_date" \
|
||||
"Words:$gsl_stat_words" \
|
||||
"Parag:$gsl_stat_p" \
|
||||
"Links:$gsl_stat_link:$gsl_stat_links" \
|
||||
"Strongs:$gsl_stat_strongs" \
|
||||
"Bolds:$gsl_stat_bolds"\
|
||||
"Italics:$gsl_stat_italics" \
|
||||
"Abbrs:$gsl_stat_abbr:$gsl_stat_abbrs" \
|
||||
"Images:$gsl_stat_image" \
|
||||
"Files:$gsl_stat_file:$gsl_count_files" \
|
||||
"Cites:$gsl_stat_bq" \
|
||||
"ICodes:$gsl_stat_icode" \
|
||||
"FCodes:$gsl_stat_fcode" \
|
||||
>> "$gsl_file_db_post"
|
||||
# Article
|
||||
article_Errors="$article_Errors"
|
||||
article_Type=$gsl_post_type
|
||||
article_CSS="$gsl_post_css"
|
||||
article_Date="$gsl_post_date"
|
||||
article_Title="$gsl_post_title"
|
||||
article_Info="$gsl_post_info"
|
||||
article_Slug="$gsl_post_slug"
|
||||
article_Author="$gsl_post_author"
|
||||
article_Tags="$gsl_post_tags"
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"File" \
|
||||
"Create datas from $gsl_post (status: $1)" \
|
||||
"$gsl_file_db_post"
|
||||
# Import
|
||||
$(cat "$gsl_tmp_db")
|
||||
|
||||
# Stats
|
||||
stat_Titles=$gsl_stat_titles
|
||||
stat_Tags=$gsl_stat_tags
|
||||
stat_Words=$gsl_stat_words
|
||||
stat_Paragraphs=$gsl_stat_p
|
||||
stat_Links=$gsl_stat_links
|
||||
stat_Links_Online=$gsl_stat_links_online
|
||||
stat_ABBRS=$gsl_stat_abbrs
|
||||
stat_Strongs=$gsl_stat_strongs
|
||||
stat_Bolds=$gsl_stat_bolds
|
||||
stat_Emphasis=$gsl_stat_italics
|
||||
stat_Strikes=$gsl_stat_strikes
|
||||
stat_Icodes=$gsl_stat_icodes
|
||||
stat_Lists=$gsl_stat_lists
|
||||
stat_Lists_Items=$gsl_list_items
|
||||
stat_Quotes=$gsl_stat_bq
|
||||
stat_Images=$gsl_stat_images
|
||||
stat_max_Images=$gsl_total_images
|
||||
stat_Flinks=$gsl_stat_flinks
|
||||
stat_Fcodes=$gsl_stat_fcodes
|
||||
stat_max_Fcodes=$gsl_total_fcodes
|
||||
stat_Fbruts=$gsl_stat_fbruts
|
||||
stat_max_Fbruts=$gsl_total_fbruts
|
||||
EODB
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Create DB File.HASH for this article (avoid corruption)
|
||||
#======================================================================
|
||||
DB__create_sum() {
|
||||
if [[ -f "$gsl_file_db_post" ]];then
|
||||
Hash_DB=`cksum "$gsl_file_db_post" | awk '{print $1}'`
|
||||
rm -f "$gsl_file_db_post_hash."*
|
||||
touch "$gsl_file_db_post_hash.$Hash_DB"
|
||||
source "$gsl_file_db_post"
|
||||
DB__create_log "$1"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,216 +1,107 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__do_commons
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#=======================================================================
|
||||
# Get NEEDED DATAS from HEADERS
|
||||
#=======================================================================
|
||||
gsl__get_needed_headers() {
|
||||
gsl_post_type=`gsl__get_header "$gsl_marker_type" "$gsl_post"`
|
||||
gsl_header_title=`gsl__get_header "$gsl_marker_title" "$gsl_post"`
|
||||
gsl_header_slug=`gsl__get_header "$gsl_marker_slug" "$gsl_post"`
|
||||
gsl_header_author=`gsl__get_header "$gsl_marker_author" "$gsl_post"`
|
||||
gsl_header_date=`gsl__get_header "$gsl_marker_date" "$gsl_post"`
|
||||
gsl_header_info=`gsl__get_header "$gsl_marker_info" "$gsl_post"`
|
||||
gsl_header_tags=`gsl__get_header "$gsl_marker_tags" "$gsl_post"`
|
||||
|
||||
#======================================================================
|
||||
# Set/Get NEEDED DATAS from META HEADERS
|
||||
# $1: process
|
||||
# $2: file: (gsl_tmp_head)
|
||||
#======================================================================
|
||||
get__needed_headers() {
|
||||
gsl__logs_print -i -g \
|
||||
"Get" \
|
||||
"Needed Metas from header" \
|
||||
"$2"
|
||||
|
||||
read__line_with "^$gsl_marker_type" "$1" \
|
||||
"$gsl_marker_type" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_slug" "$1" \
|
||||
"$gsl_marker_slug" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_title" "$1" \
|
||||
"$gsl_marker_title" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_info" "$1" \
|
||||
"$gsl_marker_info" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_author" "$1" \
|
||||
"$gsl_marker_author" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_tags" "$1" \
|
||||
"$gsl_marker_tags" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_date" "$1" \
|
||||
"$gsl_marker_date" "meta" "$2"
|
||||
|
||||
read__line_with "^$gsl_marker_css" "$1" \
|
||||
"$gsl_marker_css" "meta" "$2"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Check | Make in Loop from header datas $1: process $2:marker $3:file
|
||||
# Read line with
|
||||
# $1: TERM
|
||||
# $2: process
|
||||
# $3: marker
|
||||
# $4: type (meta/metas)
|
||||
# $5: file
|
||||
# From "meta" ; check only one marker ; get fields
|
||||
# From "metas" ; check multiple markers ; get fields
|
||||
# From content ; read line ; no need to get fields
|
||||
#======================================================================
|
||||
gsl__do_header() {
|
||||
while read -r "gsl_header_content_line"
|
||||
read__line_with() {
|
||||
# meta must be set, and no more than one value
|
||||
if [[ "$2" == "check" && "$4" == "meta" ]];then
|
||||
meta_nbr=`grep -n "$1" "$5" | wc -l`
|
||||
if (( $meta_nbr == 0 ));then
|
||||
if [[ "$3" == "$gsl_marker_css" ]];then
|
||||
gsl__logs_print -w -h \
|
||||
"$gsl_marker_css" \
|
||||
"Body template: css not customized" \
|
||||
"$PWD/$gsl_post"
|
||||
gsl_post_css=""
|
||||
|
||||
else
|
||||
gsl__logs_print -e -h \
|
||||
"$3" \
|
||||
"Unused needed marker" \
|
||||
"${PWD}/$gsl_post"
|
||||
return
|
||||
fi
|
||||
|
||||
elif (( $meta_nbr > 1 ));then
|
||||
gsl__logs_print -e -h \
|
||||
"$3" \
|
||||
"Set only one marker ; Found $meta_nbr" \
|
||||
"${PWD}/$gsl_post"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# Read line filtered
|
||||
while IFS=: read -r "ln" "gsl_line"
|
||||
do
|
||||
gsl__get_header_fields "$2"
|
||||
|
||||
case "$1" in
|
||||
check)
|
||||
case "$2" in
|
||||
"$gsl_marker_link") gsl__check_link ;;
|
||||
"$gsl_marker_abbr") gsl__check_abbr ;;
|
||||
"$gsl_marker_file") gsl__check_file ;;
|
||||
"$gsl_marker_image") gsl__check_image ;;
|
||||
"$gsl_marker_code") gsl__check_fcode ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
make)
|
||||
case "$2" in
|
||||
"$gsl_marker_link") gsl__make_link ;;
|
||||
"$gsl_marker_abbr") gsl__make_abbr ;;
|
||||
"$gsl_marker_image") gsl__make_image ;;
|
||||
esac
|
||||
# Get values if meta(s)
|
||||
case "$4" in
|
||||
meta|metas)
|
||||
header_f1=`awk -F" : " '{print $1}' <<<"$gsl_line"`
|
||||
header_f0=`awk -F": " '{print $1}' <<<"$header_f1"`
|
||||
header_f1=`awk -F": " '{print $2}' <<<"$header_f1"`
|
||||
header_f2=`awk -F" : " '{print $2}' <<<"$gsl_line"`
|
||||
header_f3=`awk -F" : " '{print $3}' <<<"$gsl_line"`
|
||||
;;
|
||||
esac
|
||||
|
||||
done < <(gsl__get_header "$2" "$3")
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Do Strongs && Bolds + Get STATS | $1: Process $2:File
|
||||
#======================================================================
|
||||
gsl__do_strongs_bolds() {
|
||||
case "$1" in
|
||||
"stats")
|
||||
gsl_stat_strongs=0
|
||||
gsl_stat_bolds=0
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
while read -r "strong"
|
||||
do
|
||||
if [[ "$strong" ]] && \
|
||||
[[ `grep "$gsl_mark_strong$strong$gsl_mark_strong" "$2"` ]];then
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
((gsl_stat_strongs++))
|
||||
;;
|
||||
"make")
|
||||
# Check if in Inline-Code
|
||||
[[ `awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)"` \
|
||||
=~ "$strong" ]] \
|
||||
&& continue
|
||||
|
||||
echo -ne "\r\033[2K: Converting Strong... $strong"
|
||||
gsl_strong="$gsl_mark_strong$strong$gsl_mark_strong"
|
||||
gsl_html_strong="<strong>$strong</strong>"
|
||||
sed -i "s|$gsl_strong|$gsl_html_strong|g" "$2"
|
||||
;;
|
||||
esac
|
||||
|
||||
fi
|
||||
done < <(grep -oP "(?<=$gsl_mark_strong).*?(?=$gsl_mark_strong)" "$2")
|
||||
|
||||
|
||||
# Bolds
|
||||
while IFS=: read -r "n" "bold"
|
||||
do
|
||||
if [[ "$bold" ]] && \
|
||||
[[ `grep "$gsl_mark_bold$bold$gsl_mark_bold" "$2"` ]];then
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
((gsl_stat_bolds++))
|
||||
echo -ne "\r\033[2K: Counting Bolds... $gsl_stat_bolds"
|
||||
;;
|
||||
|
||||
"make")
|
||||
gsl_bold="$gsl_mark_bold$bold$gsl_mark_bold"
|
||||
# Check if in Inline-Code
|
||||
[[ `awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)"` \
|
||||
=~ "$bold" ]] \
|
||||
&& continue
|
||||
|
||||
echo -ne "\r\033[2K: Converting Bold... Line $n: $bold"
|
||||
gsl_html_bold="<b>$bold</b>"
|
||||
sed -i "s|$gsl_bold|$gsl_html_bold|g" "$2"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done < <(grep -oPn "(?<=$gsl_mark_bold).*?(?=$gsl_mark_bold)" "$2")
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
gsl_stat_bolds=$((gsl_stat_bolds - gsl_stat_strongs))
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Do Italics + Get STATS | $1: Process $2:File
|
||||
#======================================================================
|
||||
gsl__do_italics() {
|
||||
gsl_stat_italics=0
|
||||
|
||||
while IFS=: read -r "n" "italic"
|
||||
do
|
||||
|
||||
[[ `awk -v l="$n" 'NR == l && $1 ~ "link"' "$2"` ]] \
|
||||
&& continue
|
||||
|
||||
if [[ "$italic" ]] && \
|
||||
[[ `grep "$gsl_mark_italic$italic$gsl_mark_italic" "$2"` ]];then
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
((gsl_stat_italics++))
|
||||
;;
|
||||
"make")
|
||||
# Check if in Inline-Code
|
||||
[[ `awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -oP "(?<=$gsl_mark_code).*?(?=$gsl_mark_code)"` \
|
||||
=~ "$italic" ]] \
|
||||
&& continue
|
||||
|
||||
this_word=`
|
||||
awk -v l="$n" 'NR == l' "$2" \
|
||||
| grep -o "[^[:space:]]*$italic[^[:space:]]*"`
|
||||
|
||||
case "$this_word" in
|
||||
"_http"*|"_xmpp"*|"_ftp"*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl_italic="$gsl_mark_italic$italic$gsl_mark_italic"
|
||||
gsl_html_italic="<em>$italic</em>"
|
||||
|
||||
echo -ne "\r\033[2K: Converting Italic... $italic"
|
||||
sed -i "s|$gsl_italic|$gsl_html_italic|g" "$2"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done < <(grep -oPn "(?<=$gsl_mark_italic).*?(?=$gsl_mark_italic)" "$2")
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Do Italics + Get STATS | $1: Process $2:File
|
||||
#======================================================================
|
||||
gsl__do_icode() {
|
||||
gsl_stat_icode=0
|
||||
|
||||
case "$1" in
|
||||
"stats")
|
||||
gsl_mark_icode=`grep -o "$gsl_mark_code" "$2" | wc -l`
|
||||
gsl_stat_icode=$(( gsl_mark_icode / 2 ))
|
||||
;;
|
||||
|
||||
"make")
|
||||
gsl_html_icode_o="<code class=\"${gsl_site_css}_icode\">"
|
||||
gsl_html_icode_c="</code>"
|
||||
|
||||
while IFS=: read -r "n" "line"
|
||||
do
|
||||
unset gsl_icode_open
|
||||
for i in $(seq 1 ${#line})
|
||||
do
|
||||
case "${line:i-1:1}" in
|
||||
"$gsl_mark_code")
|
||||
[[ "$gsl_icode_open" ]] \
|
||||
&& gsl_html_line+="$gsl_html_icode_c" \
|
||||
&& unset gsl_icode_open && continue
|
||||
|
||||
gsl_icode_open=true
|
||||
gsl_html_line+="$gsl_html_icode_o"
|
||||
;;
|
||||
*)
|
||||
gsl_html_line+="${line:i-1:1}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo -ne "\r\033[2K: Converting inline-codes..."
|
||||
sed -i "${n}d" "$2"
|
||||
sed -i "${n}i$gsl_html_line" "$2"
|
||||
unset gsl_html_line
|
||||
|
||||
done < <(grep -n "$gsl_mark_code" "$2")
|
||||
;;
|
||||
esac
|
||||
# From process, do
|
||||
case "$2" in
|
||||
check) check__headers_from_filter "$1" "$2" "$3" "$4" ;;
|
||||
make) make__headers_from_filter "$1" "$3" "$5" "$6" "$7" "$8" ;;
|
||||
esac
|
||||
|
||||
done < <(grep -n "$1" "$5")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,471 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__domain_manager
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
#----------------------------------------------------------------------
|
||||
# AUTHORS SECTION
|
||||
#----------------------------------------------------------------------
|
||||
#======================================================================
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (author)
|
||||
# $1: conf | edit | ""|list
|
||||
#======================================================================
|
||||
author__OPTIONS() {
|
||||
domain__check
|
||||
author__check "nocheck"
|
||||
|
||||
case "$1" in
|
||||
list|"") cat "$gsl_file_domain_authors" ;;
|
||||
edit) nano "$gsl_file_domain_authors" ;;
|
||||
*) gsl__invalid_option "$2" "add|remove" ;;
|
||||
esac
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Manage Authors from DOMAIN
|
||||
#=======================================================================
|
||||
author__check() {
|
||||
touch "$gsl_file_domain_authors"
|
||||
|
||||
[[ "$1" == "nocheck" ]] \
|
||||
&& return
|
||||
|
||||
# For all Arguments except author, check if empty
|
||||
if [[ -z `grep '[^[:space:]]' "$gsl_file_domain_authors"` ]];then
|
||||
echo "! Domain: $domain_name ; No Registred authors yet"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
#----------------------------------------------------------------------
|
||||
# Set DOMAIN current folder SECTION
|
||||
#----------------------------------------------------------------------
|
||||
#======================================================================
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (-PWD)
|
||||
#======================================================================
|
||||
setdir__OPTIONS() {
|
||||
domain__check setdir
|
||||
[[ "$domain_name" ]] \
|
||||
&& echo "# Domain registred for this folder: $domain_name" \
|
||||
&& exit
|
||||
|
||||
domain_nbr_max=`cat "$gsl_file_db_domains" | wc -l`
|
||||
cat -n "$gsl_file_db_domains"
|
||||
ask_domain=`echo -e "\n# Which domain to set for this folder ? "`
|
||||
read -rp "$ask_domain" domain_nbr
|
||||
|
||||
! [[ $domain_nbr ]] \
|
||||
&& echo "# Maybe later..." \
|
||||
&& exit
|
||||
|
||||
[[ $domain_nbr =~ [^[:digit:]] ]] \
|
||||
&& echo "! Please, choose à domain number" \
|
||||
&& exit
|
||||
|
||||
(( $domain_nbr == 0 || $domain_nbr > $domain_nbr_max )) \
|
||||
&& echo "! No domain $domain_nbr" \
|
||||
&& exit
|
||||
|
||||
domain_set=`awk -v l="$domain_nbr" 'NR==l' "$gsl_file_db_domains"`
|
||||
touch "gsl.$domain_set"
|
||||
gsl setdir
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
#----------------------------------------------------------------------
|
||||
# GET DOMAIN SECTION
|
||||
#----------------------------------------------------------------------
|
||||
#======================================================================
|
||||
#======================================================================
|
||||
# Get domain_name from PWD dir
|
||||
#======================================================================
|
||||
domain__check() {
|
||||
# Mismatch folder set
|
||||
domains_nbr=`
|
||||
find . -maxdepth 1 -not -type d \
|
||||
-iname "gsl.*.*" 2>/dev/null \
|
||||
| wc -l`
|
||||
|
||||
if (( $domains_nbr > 1 ));then
|
||||
echo "! Too much domains registred in $PWD: Set only one per folder"
|
||||
exit
|
||||
|
||||
elif (( $domains_nbr == 0 ));then
|
||||
echo "! No registred domain set in $PWD"
|
||||
|
||||
# setdir OPTIONS: return || exit
|
||||
[[ "$1" == setdir ]] \
|
||||
&& return \
|
||||
|| exit
|
||||
fi
|
||||
|
||||
# Set domain name
|
||||
domain_name=`find . -maxdepth 1 -not -type d -iname "gsl.*" 2>/dev/null`
|
||||
domain_name=${domain_name#.\/gsl.*}
|
||||
|
||||
# Check Database if empty or DOMAIN not in (domains.db)
|
||||
if ! [[ -f "$gsl_file_db_domains" ]] || \
|
||||
[[ -z `grep '[^[:space:]]' "$gsl_file_db_domains"` ]];then
|
||||
echo "! Domains database is empty ; Type: gsl new domain"
|
||||
exit
|
||||
|
||||
elif ! [[ `grep "$domain_name" $gsl_file_db_domains` ]];then
|
||||
echo "! Domain $domain_name not in database: $gsl_file_db_domains"
|
||||
exit
|
||||
fi
|
||||
|
||||
# setdir OPTIONS ; return here
|
||||
[[ "$1" == setdir ]] && return
|
||||
|
||||
# Settings from DOMAIN
|
||||
gsl_dir_domain="$gsl_dir_domains/$domain_name"
|
||||
gsl_file_domain_authors="$gsl_dir_domain/authors.db"
|
||||
gsl_file_domain_conf="$gsl_dir_domain/$domain_name.conf"
|
||||
if__file "$gsl_file_domain_conf" source
|
||||
|
||||
gsl_dir_domain_tpl="$gsl_dir_domain/templates"
|
||||
gsl_dir_domain_files="$gsl_dir_domain/files"
|
||||
gsl_dir_domain_images="$gsl_dir_domain/images"
|
||||
gsl_dir_domain_listings="$gsl_dir_domain/X-tra"
|
||||
gsl_dir_domain_sidebar="$gsl_dir_domain_listings/sidebar"
|
||||
|
||||
gsl_dir_db_domain="$gsl_dir_db/$domain_name"
|
||||
|
||||
gsl_dir_srv="$site_server"
|
||||
gsl_dir_srv_ndd="$site_server/$site_ndd"
|
||||
gsl_dir_srv_wip="$site_server/$site_ndd/wip"
|
||||
gsl_dir_srv_www="$site_server/$site_ndd/www"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
#----------------------------------------------------------------------
|
||||
# Set NEW DOMAIN SECTION
|
||||
#----------------------------------------------------------------------
|
||||
#======================================================================
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (new)
|
||||
#======================================================================
|
||||
new__OPTIONS() {
|
||||
echo "$1 $2"
|
||||
case "$1" in
|
||||
domain)
|
||||
new__domain "$2"
|
||||
;;
|
||||
|
||||
page|post)
|
||||
domain__check
|
||||
new__article "$1" "$2"
|
||||
;;
|
||||
|
||||
author)
|
||||
domain__check
|
||||
author__OPTIONS edit
|
||||
;;
|
||||
|
||||
*)
|
||||
gsl__invalid_option "$1" "page|post|domain|author" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Create an "empty" 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`
|
||||
|
||||
cat <<EONEWARTICLE > "$2.gsl"
|
||||
type: $1
|
||||
#css:
|
||||
title:
|
||||
slug:
|
||||
info:
|
||||
author:
|
||||
date: $cur_date
|
||||
tags:
|
||||
|
||||
#abbr: COURT : LONG
|
||||
#file: NOM : NOM-DU-FICHIER : Text alternatif
|
||||
#link: NOM : URL : Text alternatif
|
||||
#code: NUMERO : NOM-DU-FICHIER : Text alternatif
|
||||
#brut: NUMERO : NOM-DU-FICHIER
|
||||
#image: NUMERO : NOM-DU-FICHIER : TEXT-ALTERNATIF
|
||||
|
||||
#1
|
||||
EONEWARTICLE
|
||||
|
||||
echo
|
||||
cat "$2.gsl"
|
||||
echo
|
||||
gsl check "$2.gsl"
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# New Domain creator ; set config DOMAIN file
|
||||
#======================================================================
|
||||
new__domain() {
|
||||
|
||||
answer__check() {
|
||||
! [[ "$1" ]] \
|
||||
&& echo "# Abandon" \
|
||||
&& exit
|
||||
}
|
||||
|
||||
clear
|
||||
cat <<EOINFOS
|
||||
|
||||
# Configuration of a new domain
|
||||
# Cancel with empty field
|
||||
# You will be asked to confirm at the end
|
||||
# Profile will be saved to: $gsl_dir_domains/DOMAIN/DOMAIN.conf
|
||||
|
||||
EOINFOS
|
||||
|
||||
# Domain
|
||||
#-------------------
|
||||
echo "# i.e. www.exemple.com"
|
||||
read -rp "- Domain name ? " set_ndd
|
||||
file_conf_ndd="$set_ndd.conf"
|
||||
answer__check "$set_ndd"
|
||||
|
||||
# Profile exists ?
|
||||
#-------------------
|
||||
domain_profile="$gsl_dir_domains/$set_ndd/$file_conf_ndd"
|
||||
if [[ -f "$domain_profile" ]];then
|
||||
echo -e "\n! A profile for the domain $set_ndd exists..."
|
||||
read -rp "- Edit $set_ndd configuration ? " set_edit
|
||||
|
||||
! [[ "$set_edit" == [Yy] ]] \
|
||||
&& echo "Abandon." \
|
||||
&& exit
|
||||
|
||||
echo
|
||||
# Checking for compatible version
|
||||
if [[ `grep "^gsl_" "$domain_profile"` ]];then
|
||||
sed -i "s^gsl_^^" "$domain_profile"
|
||||
echo "site_max_list=5" >> "$domain_profile"
|
||||
echo "! Configuration changed to new compatible version"
|
||||
gsl_sleep=true
|
||||
fi
|
||||
|
||||
if ! [[ -f "$gsl_file_db_domains" ]];then
|
||||
touch "$gsl_file_db_domains" && \
|
||||
echo "! Creating new Database domains"
|
||||
gsl_sleep=true
|
||||
fi
|
||||
|
||||
if ! [[ `grep "$set_ndd" "$gsl_file_db_domains"` ]];then
|
||||
echo "$set_ndd" >> "$gsl_file_db_domains"
|
||||
echo "! $set_ndd added to new Database: $gsl_file_db_domains"
|
||||
gsl_sleep=true
|
||||
fi
|
||||
|
||||
[[ "$gsl_sleep" ]] && sleep 2
|
||||
nano "$domain_profile"
|
||||
exit
|
||||
fi
|
||||
|
||||
# HTTP(S)
|
||||
#-------------------
|
||||
echo -e "\n# https or or http. Answer Y for https"
|
||||
read -rp "- Use HTTPS ? " set_protocole
|
||||
answer__check "$set_protocole"
|
||||
|
||||
case "$gsl_set_protocole" in
|
||||
Y|y) set_url="https://$gsl_set_ndd" ;;
|
||||
*) set_url="http://$gsl_set_ndd" ;;
|
||||
esac
|
||||
|
||||
# Webserver
|
||||
#-------------------
|
||||
echo -e "\n# i.e. /var/www (will create [URI]/$set_ndd/)"
|
||||
read -erp "- Webserver URI ? " set_server
|
||||
answer__check "$set_server"
|
||||
|
||||
[[ ${set_server: -1} == "/" ]] \
|
||||
&& set_server=${set_server::-1}
|
||||
|
||||
# Website title
|
||||
#-------------------
|
||||
echo -e "\n# i.e. My beautiful website"
|
||||
read -rp "- Website Title ? " set_title
|
||||
answer__check "$set_title"
|
||||
|
||||
# Website Description
|
||||
#-------------------
|
||||
echo -e "\n# i.e. writings about my website"
|
||||
read -rp "- Website Description ? " set_about
|
||||
answer__check "$set_about"
|
||||
|
||||
# Contact mail
|
||||
#-------------------
|
||||
echo -e "\n# i.e. contact@$set_ndd"
|
||||
read -rp "- Contact Mail ? " set_mail
|
||||
answer__check "$set_mail"
|
||||
|
||||
# Website Keywords
|
||||
#-------------------
|
||||
echo -e "\n# i.e. freedom,software (Will be used on each article !)"
|
||||
read -rp "- Website Keywords ? " set_keys
|
||||
answer__check "$set_keys"
|
||||
|
||||
# Website Lang
|
||||
#-------------------
|
||||
echo -e "\n# i.e. fr (or en-GB...)"
|
||||
read -rp "- Website Lang ? " set_lang
|
||||
answer__check "$set_lang"
|
||||
|
||||
# Copyright
|
||||
#-------------------
|
||||
echo -e "\n# i.e. 2022 $set_ndd CC BY-SA"
|
||||
read -rp "- Website Copyright ? " set_cr
|
||||
answer__check "$set_cr"
|
||||
|
||||
# Logo filename
|
||||
#-------------------
|
||||
echo -e "\n# i.e. logo.png (put in $gsl_dir_domains/$set_ndd/templates)"
|
||||
read -rp "- Website logo (file NAME) ? " set_logo
|
||||
answer__check "$set_logo"
|
||||
|
||||
# List Name (last posts)
|
||||
#-------------------
|
||||
echo -e "\n# i.e. My last posts"
|
||||
read -rp "- Title List Name ? " set_listname
|
||||
answer__check "$set_listname"
|
||||
|
||||
# CSS Acronym
|
||||
#-------------------
|
||||
css_ex=${set_ndd%.*}
|
||||
echo -e "\n# i.e. $css_ex (Will create HTML classes like ${css_ex}_paragraph"
|
||||
read -rp "- CSS Acronym ? " set_css
|
||||
answer__check "$set_css"
|
||||
set_css=${set_css,,}
|
||||
|
||||
# Author reference
|
||||
#-------------------
|
||||
echo -e "\n# i.e. https://mastodon.home/$set_ndd (Used for meta rel='me')"
|
||||
read -rp "- External Author URL ? " set_auth_url
|
||||
answer__check "$set_auth_url"
|
||||
|
||||
# Sidebar max list
|
||||
#-------------------
|
||||
echo -e "\n# i.e. 5 ; Numbers of post in sidebar"
|
||||
read -rp "- Sidebar max list ? " set_max_list
|
||||
answer__check "$set_max_list"
|
||||
[[ "$set_max_list" = *[!0-9]* ]] || \
|
||||
[[ "$set_max_list" == "0" ]] \
|
||||
&& echo "! $set_max_list: invalid number..." \
|
||||
&& exit
|
||||
|
||||
#---------------
|
||||
# Resuming datas
|
||||
#---------------
|
||||
cat << EORESUME
|
||||
# New domain Values...
|
||||
: Webserver: $set_server
|
||||
: URL: $set_url
|
||||
: Domain: $set_ndd
|
||||
: Title: $set_title
|
||||
: Description: $set_about
|
||||
: Contact: $set_mail
|
||||
: Keywords: $set_keys
|
||||
: Language: $set_lang
|
||||
: Copyright: $set_cr
|
||||
: Logo File $set_logo
|
||||
: Title List: $set_listname
|
||||
: CSS Acronym: $set_css
|
||||
: Ext Profile: $set_auth_url
|
||||
: Sidebar list: $set_max_list
|
||||
|
||||
EORESUME
|
||||
|
||||
echo "# Save configuration to $domain_profile"
|
||||
read -rp "- Confirm ? " set_confirm
|
||||
|
||||
! [[ "$set_confirm" == [Yy] ]] \
|
||||
&& echo "Abandon." \
|
||||
&& exit
|
||||
|
||||
domain_name="$set_ndd"
|
||||
gsl_dir_domain="$gsl_dir_domains/$domain_name"
|
||||
domain__create_conf
|
||||
|
||||
echo
|
||||
cat "$gsl_dir_help/how_to-set_directory_for_articles.md"
|
||||
echo
|
||||
cat "$gsl_dir_help/how_to-add_remove_authors.md"
|
||||
echo
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Check configuration directories from DOMAIN
|
||||
# $1: lite (if exists and writeable)
|
||||
# : full (Sown details in table)
|
||||
# : new (Write new configuration for DOMAIN)
|
||||
#======================================================================
|
||||
domain__create_conf() {
|
||||
mkdir -p "$gsl_dir_domain"
|
||||
mkdir -p "$gsl_dir_domains/$domain_name"
|
||||
mkdir -p "$gsl_dir_domain/templates"
|
||||
mkdir -p "$gsl_dir_domain/files"
|
||||
mkdir -p "$gsl_dir_domain/images"
|
||||
mkdir -p "$gsl_dir_domain/X-tra"
|
||||
mkdir -p "$gsl_dir_domain/X-tra/sidebar"
|
||||
mkdir -p "$gsl_dir_db/$domain_name"
|
||||
|
||||
mkdir -p "$set_server"
|
||||
mkdir -p "$set_server/$domain_name"
|
||||
mkdir -p "$set_server/$domain_name/wip"
|
||||
mkdir -p "$set_server/$domain_name/www"
|
||||
|
||||
touch "$gsl_dir_domains/$domain_name/authors.db"
|
||||
|
||||
cat << EOCONF > "$domain_profile"
|
||||
site_server="$set_server"
|
||||
site_url="$set_url"
|
||||
site_ndd="$set_ndd"
|
||||
site_title="$set_title"
|
||||
site_about="$set_about"
|
||||
site_mail="$set_mail"
|
||||
site_keys="$set_keys"
|
||||
site_lang="$set_lang"
|
||||
site_cr="$set_cr"
|
||||
site_logo="$set_logo"
|
||||
site_listname="$set_listname"
|
||||
site_css="${set_css}"
|
||||
site_auth_url="$set_auth_url"
|
||||
site_max_list=$set_max_list
|
||||
EOCONF
|
||||
|
||||
! [[ -f "$gsl_file_db_domains" ]] \
|
||||
&& touch "$gsl_file_db_domains" \
|
||||
&& echo "! Creating new Database domains"
|
||||
|
||||
! [[ `grep "$set_ndd" "$gsl_file_db_domains"` ]] \
|
||||
&& echo "$set_ndd" >> "$gsl_file_db_domains" \
|
||||
&& echo "! $set_ndd added to new Database: $gsl_file_db_domains"
|
||||
|
||||
echo "# Domain: $set_ndd ; configured in $domain_profile"
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__edit_file
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (edit)
|
||||
# $2: FILE | conf
|
||||
# $3: FILE
|
||||
#======================================================================
|
||||
edit__file_OPTIONS() {
|
||||
! [[ "$1" ]] \
|
||||
&& gsl__invalid_option "$1" "[File]|conf|author|domain"
|
||||
|
||||
case "$1" in
|
||||
conf) gsl_this_post="$gsl_file_domain_conf" ;;
|
||||
author) author__OPTIONS edit ;;
|
||||
domain) gsl_this_post="$gsl_file_db_domains" ;;
|
||||
*) if__gsl_post;if__file "$PWD/$1" post ;;
|
||||
esac
|
||||
|
||||
gsl_post=`basename "$gsl_this_post"`
|
||||
|
||||
if ! [[ "$EDITOR" ]];then
|
||||
if__command nano
|
||||
EDITOR=`which nano`
|
||||
EDITOR+=" --linenumbers"
|
||||
|
||||
elif [[ "$EDITOR" =~ "nano" ]];then
|
||||
EDITOR+=" --linenumbers"
|
||||
fi
|
||||
|
||||
gsl__logs_print -i -B -P \
|
||||
"edit with $EDITOR" \
|
||||
"$gsl_this_post"
|
||||
|
||||
gsl_proc="edit"
|
||||
article__sum "$gsl_this_post"
|
||||
article_Hash_old=$article_Hash
|
||||
|
||||
$EDITOR "$gsl_this_post"
|
||||
|
||||
article__sum "$gsl_this_post"
|
||||
if (( $article_Hash != $article_Hash_old ));then
|
||||
gsl_log_infos="Changed ; Hash: $article_Hash"
|
||||
gsl_log_level="-w"
|
||||
|
||||
else
|
||||
gsl_log_infos="Unchanged"
|
||||
gsl_log_level="-i"
|
||||
fi
|
||||
|
||||
gsl__logs_print "$gsl_log_level" -f -e \
|
||||
"$gsl_log_infos" \
|
||||
"$gsl_this_post"
|
||||
|
||||
gsl__logs_print -i -E -P \
|
||||
"edit with $EDITOR" \
|
||||
"$gsl_this_post"
|
||||
}
|
|
@ -1,9 +1,83 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__log_manager
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (log)
|
||||
# $2: arguments list
|
||||
#======================================================================
|
||||
log__OPTIONS() {
|
||||
while test "$2"
|
||||
do
|
||||
case "$2" in
|
||||
clean|-C)
|
||||
shift
|
||||
if [[ "$2" == "all" ]];then
|
||||
rm -f "$gsl_dir_logs/"*".gsl.log"
|
||||
echo "! Clean all saved logs"
|
||||
exit
|
||||
fi
|
||||
|
||||
[[ -z `grep '[^[:space:]]' "$gsl_file_logs" 2>/dev/null` ]] \
|
||||
&& echo "# No logs to show. File is empty." \
|
||||
&& exit
|
||||
|
||||
gsl_date_logs=`date +%F-%H-%M-%S`
|
||||
mv "$gsl_file_logs" "$gsl_dir_logs/$gsl_date_logs.gsl.log"
|
||||
rm -f "$gsl_file_logs"
|
||||
printf '%s %s %s\n' \
|
||||
"# Logs saved to" \
|
||||
"$gsl_dir_logs/$gsl_date_logs.gsl.log" \
|
||||
"and cleaned"
|
||||
exit
|
||||
;;
|
||||
|
||||
*)
|
||||
[[ -z `grep '[^[:space:]]' "$gsl_file_logs" 2>/dev/null` ]] \
|
||||
&& echo "# No logs to show. File is empty." \
|
||||
&& exit
|
||||
|
||||
case "$2" in
|
||||
-s) gsl_logs_last_session=true ;;
|
||||
-e) gsl_logs_err=true ;;
|
||||
-i) gsl_logs_inf=true ;;
|
||||
-w) gsl_logs_war=true ;;
|
||||
*) gsl_logs_search="$2" ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
gsl__logs_show
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Print in log starting process
|
||||
# $1; process
|
||||
#======================================================================
|
||||
log__process_begin() {
|
||||
gsl__logs_print -i -B -P \
|
||||
"$1" \
|
||||
"$PWD"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Print in log ending process
|
||||
# $1; oricess
|
||||
#======================================================================
|
||||
log__process_end() {
|
||||
gsl__logs_print -i -E -P \
|
||||
"$1" \
|
||||
"$PWD"
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Print in log file
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -13,13 +87,56 @@ gsl__logs_print() {
|
|||
#3: Process
|
||||
#4: Infos
|
||||
#5: File
|
||||
printf '%s %s\t%s\t%s\t%s\t%s\n' \
|
||||
|
||||
case "$1" in
|
||||
-i) log_f1="$gsl_log_i";CL=${NC} ;;
|
||||
-w) log_f1="$gsl_log_w";CL=${CY};gsl_checker_war=true ;;
|
||||
-e) log_f1="$gsl_log_e";CL=${CR};gsl_checker_err=true ;;
|
||||
*) log_f1="$1";;
|
||||
esac
|
||||
|
||||
case "$2" in
|
||||
-h) log_f2="Header" ;;
|
||||
-c) log_f2="Content" ;;
|
||||
-g) log_f2="GSL" ;;
|
||||
-B) log_f2="Starting" ;;
|
||||
-E) log_f2="Stopping" ;;
|
||||
-A) log_f2="Article" ;;
|
||||
-srv) log_f2="Server" ;;
|
||||
-st) log_f2="Stats" ;;
|
||||
-R) log_f2="Removed" ;;
|
||||
-D) log_f2="Database" ;;
|
||||
-sdb) log_f2="Sidebar" ;;
|
||||
*) log_f2="$2" ;;
|
||||
esac
|
||||
|
||||
case "$3" in
|
||||
-c) log_f3="Created" ;;
|
||||
-f) log_f3="file" ;;
|
||||
-e) log_f3="Edit" ;;
|
||||
-h) log_f3="Hash" ;;
|
||||
-C) log_f3="Check" ;;
|
||||
-M) log_f3="Make" ;;
|
||||
-P) log_f3="Process" ;;
|
||||
-wip) log_f3="wip" ;;
|
||||
-www) log_f3="www" ;;
|
||||
-src) log_f3="Source" ;;
|
||||
-sk) log_f3="Skip" ;;
|
||||
-inv) log_f3="Invalid" ;;
|
||||
*) log_f3="$3" ;;
|
||||
esac
|
||||
|
||||
printf '%b%s %s %-7s\t%-7s\t%-38s\t%s\t%s\t%s%b\n' \
|
||||
"${CL}" \
|
||||
"`date +%F' '%T`" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"$3" \
|
||||
"$log_f1" \
|
||||
"$log_f2" \
|
||||
"$log_f3" \
|
||||
"$4" \
|
||||
"$gsl_post" \
|
||||
"$domain_name" \
|
||||
"$5" \
|
||||
"${NC}" \
|
||||
>> "$gsl_file_logs"
|
||||
}
|
||||
|
||||
|
@ -42,24 +159,25 @@ if [[ "$gsl_logs_last_session" ]];then
|
|||
grep -n "Starting" "$gsl_file_logs" \
|
||||
| tail -1 \
|
||||
| awk -F: '{print $1}'`
|
||||
# echo
|
||||
|
||||
awk -v sl="$gsl_log_start_line" \
|
||||
'NR >= sl' \
|
||||
"$gsl_file_logs" \
|
||||
| grep "$gsl_logs_filter" \
|
||||
| grep -Ei "$gsl_logs_search" \
|
||||
| column -t -s$'\t'
|
||||
| column -t -s$'\t' -o' '
|
||||
|
||||
else
|
||||
while read -r "gsl_log_content"
|
||||
do
|
||||
# Let's read clear sessions
|
||||
[[ "$gsl_log_content" =~ "Starting" ]] \
|
||||
&& echo
|
||||
|
||||
echo "$gsl_log_content"
|
||||
done < <(cat "$gsl_file_logs" \
|
||||
| grep "$gsl_logs_filter" \
|
||||
| grep -Ei "$gsl_logs_search" \
|
||||
| column -t -s$'\t')
|
||||
while read -r "gsl_log_content"
|
||||
do
|
||||
# Let's read clear sessions
|
||||
[[ "$gsl_log_content" =~ "Starting" ]] \
|
||||
&& echo
|
||||
|
||||
echo "$gsl_log_content"
|
||||
done < <(cat "$gsl_file_logs" \
|
||||
| grep "$gsl_logs_filter" \
|
||||
| grep -Ei "$gsl_logs_search" \
|
||||
| column -t -s$'\t' -o' ')
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,511 +0,0 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__new_website
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#=======================================================================
|
||||
#
|
||||
# Configure new WEBSITE from DOMAIN
|
||||
#
|
||||
#=======================================================================
|
||||
gsl__new_website() {
|
||||
gsl__if_file "$gsl_dir_helps/gsl_infos_new_website" read
|
||||
|
||||
clear
|
||||
cat $gsl_dir_helps/gsl_infos_new_website
|
||||
printf '\n%s\n%s\n%s\n' \
|
||||
"# Configuration of a new website..." \
|
||||
"# Cancel with empty field" \
|
||||
"# You will be asked to confirm at the end"
|
||||
|
||||
#=======================================================================
|
||||
# Domain URL
|
||||
#=======================================================================
|
||||
printf '\n%s\n %s\n' \
|
||||
"# URL: www.example.com" \
|
||||
"(https:// will be added if missing or force with http://)"
|
||||
read -rp \
|
||||
": Website URL ? " \
|
||||
gsl_set_url
|
||||
|
||||
[[ ${gsl_set_url: -1} == "/" ]] \
|
||||
&& gsl_set_url=${gsl_set_url::-1}
|
||||
|
||||
gsl__check_settings $gsl_set_url || return
|
||||
|
||||
gsl_https='https://'
|
||||
case "$gsl_set_url" in
|
||||
"https://"*)
|
||||
gsl_set_ndd=${gsl_set_url/$gsl_https/}
|
||||
;;
|
||||
"http://"*)
|
||||
gsl_http="http://"
|
||||
gsl_set_ndd=${gsl_set_url/$gsl_http/}
|
||||
;;
|
||||
*)
|
||||
gsl_set_ndd="$gsl_set_url"
|
||||
gsl_https+=$gsl_set_url
|
||||
gsl_set_url=$gsl_https
|
||||
;;
|
||||
esac
|
||||
|
||||
# Domain NAME
|
||||
gsl_set_ndd=`awk -F"." '{print $(NF-1)"."$NF}' <<< $gsl_set_ndd`
|
||||
gsl_set_file_ndd="$gsl_set_ndd.conf"
|
||||
|
||||
[[ -f "$gsl_dir_user_domains/$gsl_set_ndd/$gsl_set_file_ndd" ]] \
|
||||
&& gsl_profile="$gsl_dir_user_domains/$gsl_set_ndd/$gsl_set_file_ndd" \
|
||||
&& gsl_set_user_conf="Y"
|
||||
|
||||
[[ -f "$gsl_dir_global_domains/$gsl_set_ndd/$gsl_set_file_ndd" ]] \
|
||||
&& gsl_profile="$gsl_dir_global_domains/$gsl_set_ndd/$gsl_set_file_ndd" \
|
||||
&& gsl_set_user_conf="N"
|
||||
|
||||
if [[ "$gsl_profile" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Found configuration from $gsl_set_ndd" \
|
||||
"$gsl_profile"
|
||||
|
||||
echo -e "\n! A Profile exists: $gsl_profile"
|
||||
read -rp ": Continue (Y|*) " gsl_continue
|
||||
case "$gsl_continue" in
|
||||
Y|y)
|
||||
source "$gsl_profile" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Load configuration from $gsl_set_ndd" \
|
||||
"$gsl_profile"
|
||||
gsl_profile_exists=true
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Webserver URI
|
||||
#=======================================================================
|
||||
[[ $gsl_profile_exists ]] \
|
||||
&& echo -e "\n# Webserver registred: $gsl_site_server" \
|
||||
|| echo -e "\n# Webserver: /var/www (Or maybe elsewhere...)"
|
||||
|
||||
read -erp \
|
||||
": Webserver URI ? " \
|
||||
gsl_set_server
|
||||
|
||||
[[ ${gsl_set_server: -1} == "/" ]] \
|
||||
&& gsl_set_server=${gsl_set_server::-1}
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_server" ]];then
|
||||
[[ "$gsl_site_server" ]] \
|
||||
&& gsl_set_server="$gsl_site_server" \
|
||||
|| gsl__check_settings $gsl_set_server || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_server || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Personal use or global use ?
|
||||
#=======================================================================
|
||||
if ! [[ "$gsl_set_user_conf" ]];then
|
||||
echo -e "\n# Save Domain in Home or Global"
|
||||
read -rp \
|
||||
": Home Use (y/n) ? " \
|
||||
gsl_set_user_conf
|
||||
fi
|
||||
|
||||
case "$gsl_set_user_conf" in
|
||||
y|Y)
|
||||
gsl_save_dir_ndd="$gsl_dir_user_domains/$gsl_set_ndd"
|
||||
gsl_save_conf_ndd="$gsl_save_dir_ndd/$gsl_set_file_ndd"
|
||||
gsl_ask="# Save to $gsl_save_conf_ndd (y|*) ? "
|
||||
;;
|
||||
n|N)
|
||||
gsl_save_dir_ndd="$gsl_dir_global_domains/$gsl_set_ndd"
|
||||
gsl_save_conf_ndd="$gsl_save_dir_ndd/$gsl_set_file_ndd"
|
||||
gsl_ask="# Save to $gsl_save_conf_ndd (y|*) ? "
|
||||
;;
|
||||
*) echo "! Abandon... Maybe next time" && return ;;
|
||||
esac
|
||||
|
||||
#=======================================================================
|
||||
# Website Title
|
||||
#=======================================================================
|
||||
[[ $gsl_profile_exists ]] \
|
||||
&& echo -e "\n# Title registred: $gsl_site_title" \
|
||||
|| echo -e "\n# Title: My Compagny (or My beautiful website)"
|
||||
|
||||
read -rp \
|
||||
": Website Title ? " \
|
||||
gsl_set_title
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_title" ]];then
|
||||
[[ "$gsl_site_title" ]] \
|
||||
&& gsl_set_title="$gsl_site_title" \
|
||||
|| gsl__check_settings $gsl_set_title || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_title || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Website Description
|
||||
#=======================================================================
|
||||
[[ $gsl_profile_exists ]] \
|
||||
&& echo -e "\n# Description registred: $gsl_site_about" \
|
||||
|| echo -e "\n# Description: writings about this website"
|
||||
|
||||
read -rp \
|
||||
": Website Description ? " \
|
||||
gsl_set_about
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_about" ]];then
|
||||
[[ "$gsl_site_about" ]] \
|
||||
&& gsl_set_about="$gsl_site_about" \
|
||||
|| gsl__check_settings $gsl_set_about || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_about || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Contact Mail
|
||||
#=======================================================================
|
||||
[[ $gsl_profile_exists ]] \
|
||||
&& echo -e "\n# Mail registred: $gsl_site_mail" \
|
||||
|| echo -e "\n# Mail: contact@example.com"
|
||||
|
||||
read -rp \
|
||||
": Contact Mail ? " \
|
||||
gsl_set_mail
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_mail" ]];then
|
||||
[[ "$gsl_site_mail" ]] \
|
||||
&& gsl_set_mail="$gsl_site_mail" \
|
||||
|| gsl__check_settings $gsl_set_mail || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_mail || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Website Keywords
|
||||
#=======================================================================
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
printf '\n%s\n %s\n' \
|
||||
"# GENERIC pages Keywords registred: $gsl_site_keys" \
|
||||
"! Will be used on each post !"
|
||||
else
|
||||
printf '\n%s\n %s\n' \
|
||||
"# GENERIC pages Keywords: geek stuff,free (comma separated)" \
|
||||
"! Will be used on each post !"
|
||||
fi
|
||||
|
||||
read -rp \
|
||||
": Website Keywords for all Pages ? " \
|
||||
gsl_set_keys
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_keys" ]];then
|
||||
[[ "$gsl_site_keys" ]] \
|
||||
&& gsl_set_keys="$gsl_site_keys" \
|
||||
|| gsl__check_settings $gsl_set_keys || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_keys || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Language
|
||||
#=======================================================================
|
||||
[[ $gsl_profile_exists ]] \
|
||||
&& echo -e "\n# Language registred: $gsl_site_lang" \
|
||||
|| echo -e "\n# Language: fr (or en-GB...)"
|
||||
|
||||
read -rp \
|
||||
": Website Lang ? " \
|
||||
gsl_set_lang
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_lang" ]];then
|
||||
[[ "$gsl_site_lang" ]] \
|
||||
&& gsl_set_lang="$gsl_site_lang" \
|
||||
|| gsl__check_settings $gsl_set_lang || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_lang || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Copyright
|
||||
#=======================================================================
|
||||
[[ $gsl_profile_exists ]] \
|
||||
&& echo -e "\n# Copyright registred: $gsl_site_cr" \
|
||||
|| echo -e "\n# Copyright: 2022 TITLE CC-BY-SA"
|
||||
|
||||
read -rp \
|
||||
": Website Copyright ? " \
|
||||
gsl_set_cr
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_cr" ]];then
|
||||
[[ "$gsl_site_cr" ]] \
|
||||
&& gsl_set_cr="$gsl_site_cr" \
|
||||
|| gsl__check_settings $gsl_set_cr || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_cr || return
|
||||
fi
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Website Logo
|
||||
#=======================================================================
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
printf '\n%s\n %s\n' \
|
||||
"# logo registred: $gsl_site_logo" \
|
||||
"Put it in $gsl_save_dir_ndd/templates/"
|
||||
else
|
||||
printf '\n%s\n %s\n' \
|
||||
"# logo: my-logo.png" \
|
||||
"Put it in $gsl_save_dir_ndd/templates/"
|
||||
fi
|
||||
|
||||
read -rp \
|
||||
": Website logo file NAME ? " \
|
||||
gsl_set_logo
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_logo" ]];then
|
||||
[[ "$gsl_site_logo" ]] \
|
||||
&& gsl_set_logo="$gsl_site_logo" \
|
||||
|| gsl__check_settings $gsl_set_logo || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_logo || return
|
||||
fi
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Last Posts listing name header
|
||||
#=======================================================================
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
printf '\n%s\n %s\n' \
|
||||
"# Title List Name registred: $gsl_site_listname" \
|
||||
"Title List to show before last posts"
|
||||
else
|
||||
printf '\n%s\n %s\n' \
|
||||
"# Title List Name: My Last Posts" \
|
||||
"Title List to show before last posts"
|
||||
fi
|
||||
|
||||
read -rp \
|
||||
": Title List Name ? " \
|
||||
gsl_set_listname
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_listname" ]];then
|
||||
[[ "$gsl_site_listname" ]] \
|
||||
&& gsl_set_listname="$gsl_site_listname" \
|
||||
|| gsl__check_settings $gsl_set_listname || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_listname || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# CSS Acronym
|
||||
#=======================================================================
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
printf '\n%s\n %s\n' \
|
||||
"# CSS (short) Acronym registred: $gsl_site_css" \
|
||||
"Will create specific HTML classes like ${gsl_site_css}_paragraph"
|
||||
else
|
||||
printf '\n%s\n %s\n' \
|
||||
"# CSS (short) Acronym: myweb !No need to end with _" \
|
||||
"Will create specific HTML classes like myweb_paragraph"
|
||||
fi
|
||||
|
||||
read -rp \
|
||||
": CSS Acronym ? " \
|
||||
gsl_set_css
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_css" ]];then
|
||||
[[ "$gsl_site_css" ]] \
|
||||
&& gsl_set_css="$gsl_site_css" \
|
||||
|| gsl__check_settings $gsl_set_css || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_css || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Author Reference
|
||||
#=======================================================================
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
printf '\n%s\n %s\n' \
|
||||
"# Author/Compagny URL Profile registred: $gsl_site_auth_url" \
|
||||
"Used for meta rel='me'"
|
||||
else
|
||||
printf '\n%s\n %s\n' \
|
||||
"# Author/Compagny URL Profile: https://..." \
|
||||
"Used for meta rel='me'"
|
||||
fi
|
||||
|
||||
read -rp \
|
||||
": Author URL Profile ? " \
|
||||
gsl_set_auth_url
|
||||
|
||||
if [[ $gsl_profile_exists ]];then
|
||||
if ! [[ "$gsl_set_auth_url" ]];then
|
||||
[[ "$gsl_site_auth_url" ]] \
|
||||
&& gsl_set_auth_url="$gsl_site_auth_url" \
|
||||
|| gsl__check_settings $gsl_set_auth_url || return
|
||||
fi
|
||||
else
|
||||
gsl__check_settings $gsl_set_auth_url || return
|
||||
fi
|
||||
|
||||
#=======================================================================
|
||||
# Folder for Posts
|
||||
#=======================================================================
|
||||
printf '\n%s\n %s\n %s\n' \
|
||||
"# You can set here a folder for your writings' Posts" \
|
||||
"Leave Empty to manually do it later (see help)" \
|
||||
"Autocompletion /NEWFOLDER (name of choice)"
|
||||
|
||||
read -erp \
|
||||
": Where will you add your files' [post].gsl ? " \
|
||||
gsl_dir_user_posts
|
||||
|
||||
#=======================================================================
|
||||
# Show Resume
|
||||
#=======================================================================
|
||||
clear
|
||||
printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
|
||||
"# New Website configurations..." \
|
||||
": Webserver|$gsl_set_server" \
|
||||
": URL|$gsl_set_url" \
|
||||
": Domain|$gsl_set_ndd" \
|
||||
": Title|$gsl_set_title" \
|
||||
": Description|$gsl_set_about" \
|
||||
": Contact|$gsl_set_mail" \
|
||||
": Keywords|$gsl_set_keys" \
|
||||
": Language|$gsl_set_lang" \
|
||||
": Copyright|$gsl_set_cr" \
|
||||
": Logo File|$gsl_set_logo" \
|
||||
": Title List|$gsl_set_listname" \
|
||||
": CSS Acro|$gsl_set_css" \
|
||||
": Author URL|$gsl_set_auth_url" \
|
||||
": User folder writings' Posts|$gsl_dir_user_posts" \
|
||||
| column -t -s'|'
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Ask to Confirm
|
||||
#=======================================================================
|
||||
echo
|
||||
read -rp "$gsl_ask " gsl_set_confirm
|
||||
|
||||
case "$gsl_set_confirm" in
|
||||
y|Y)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Confirmed configuration from $gsl_set_ndd" \
|
||||
"$gsl_save_conf_ndd"
|
||||
|
||||
if ! [[ -d "$gsl_save_dir_ndd" ]];then
|
||||
mkdir -p "$gsl_save_dir_ndd" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Create Folder configuration for $gsl_set_ndd" \
|
||||
"$gsl_save_dir_ndd/"
|
||||
fi
|
||||
|
||||
# Create et set a folder for writings' posts
|
||||
if [[ $gsl_dir_user_posts ]];then
|
||||
mkdir -p "$gsl_dir_user_posts" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Create Folder Posts for $gsl_set_ndd" \
|
||||
"$gsl_dir_user_posts/"
|
||||
|
||||
touch "$gsl_dir_user_posts/gsl.$gsl_set_ndd" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Folder set with gsl.$gsl_set_ndd" \
|
||||
"$gsl_dir_user_posts/"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
#=======================================================================
|
||||
# Save config
|
||||
#=======================================================================
|
||||
printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' \
|
||||
"gsl_site_server=\"$gsl_set_server\"" \
|
||||
"gsl_site_url=\"$gsl_set_url\"" \
|
||||
"gsl_site_ndd=\"$gsl_set_ndd\"" \
|
||||
"gsl_site_title=\"$gsl_set_title\"" \
|
||||
"gsl_site_about=\"$gsl_set_about\"" \
|
||||
"gsl_site_mail=\"$gsl_set_mail\"" \
|
||||
"gsl_site_keys=\"$gsl_set_keys\"" \
|
||||
"gsl_site_lang=\"$gsl_set_lang\"" \
|
||||
"gsl_site_cr=\"$gsl_set_cr\"" \
|
||||
"gsl_site_logo=\"$gsl_set_logo\"" \
|
||||
"gsl_site_listname=\"$gsl_set_listname\"" \
|
||||
"gsl_site_css=\"$gsl_set_css\"" \
|
||||
"gsl_site_auth_url=\"$gsl_set_auth_url\"" \
|
||||
> "$gsl_save_conf_ndd" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Write configuration for $gsl_set_ndd" \
|
||||
"$gsl_save_conf_ndd"
|
||||
|
||||
if ! [[ `grep "$gsl_save_dir_ndd" "$gsl_file_db_domains"` ]];then
|
||||
echo "$gsl_save_dir_ndd" >> "$gsl_file_db_domains" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"New" \
|
||||
"Profile" \
|
||||
"Add $gsl_save_dir_ndd to DB for $gsl_set_ndd" \
|
||||
"$gsl_file_db_domains"
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check if no Response from $@
|
||||
#=======================================================================
|
||||
gsl__check_settings() {
|
||||
[[ "$@" ]] && return
|
||||
echo "! Abandon... Maybe next time"
|
||||
exit
|
||||
}
|
|
@ -1,295 +0,0 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__page_creator
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# --------------------------------------------------
|
||||
# From: gsl__all_makers | Create HTML Page
|
||||
# --------------------------------------------------
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# MAIN
|
||||
#----------------------------------------------------------------------
|
||||
gsl__page_creator() {
|
||||
#gsl__page_prepare_datas
|
||||
gsl__check_templates
|
||||
gsl__html_meta_head
|
||||
gsl__page_create
|
||||
|
||||
# Show html result in terminal
|
||||
#cat -n "$gsl_srv_wip_page"
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Sync Files from Templates to webserver
|
||||
#======================================================================
|
||||
gsl__srv_sync() {
|
||||
# Sync Files and Folders
|
||||
mkdir -p "$1"
|
||||
for folder in `find $gsl_this_conf_domain/* -type d`
|
||||
do
|
||||
rsync -a --delete "$folder" "$1" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Server" \
|
||||
"Sync" \
|
||||
"$folder" \
|
||||
"$1"
|
||||
done
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Get Datas for Post/Page
|
||||
#----------------------------------------------------------------------
|
||||
gsl__page_prepare_datas() {
|
||||
# Set wip folder from domain
|
||||
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
||||
gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www"
|
||||
|
||||
# Post or Page
|
||||
case "$gsl_post_type" in
|
||||
post)
|
||||
gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug/index.html"
|
||||
gsl_srv_www_page="$gsl_srv_www/$gsl_header_slug/index.html"
|
||||
gsl__check_srv_files "$gsl_srv_wip_page" wip
|
||||
gsl__check_srv_files "$gsl_srv_www_page" www
|
||||
gsl_uri=".."
|
||||
;;
|
||||
page)
|
||||
gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug.html"
|
||||
gsl_srv_www_page="$gsl_srv_www/$gsl_header_slug.html"
|
||||
gsl__check_srv_files "$gsl_srv_wip_page" wip
|
||||
gsl__check_srv_files "$gsl_srv_www_page" www
|
||||
gsl_uri="."
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl_uri_site_logo="$gsl_uri/templates/$gsl_site_logo"
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Check if Post / Pages exists in server
|
||||
#----------------------------------------------------------------------
|
||||
gsl__check_srv_files() {
|
||||
if [[ -f "$1" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"SRV" \
|
||||
"$2" \
|
||||
"$gsl_post_type $gsl_post exists" \
|
||||
"$1"
|
||||
|
||||
else
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"SRV" \
|
||||
"$2" \
|
||||
"$gsl_post_type $gsl_post not yet created" \
|
||||
"$1"
|
||||
gsl_checker_war=true
|
||||
fi
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Create Final HTML Post/Page
|
||||
#----------------------------------------------------------------------
|
||||
gsl__page_create() {
|
||||
cat << EOPAGE > "$gsl_srv_wip_page"
|
||||
<!DOCTYPE html>
|
||||
<html lang="${gsl_site_lang: :2}">
|
||||
<head>
|
||||
`cat "$gsl_html_meta"`
|
||||
</head>
|
||||
|
||||
<body id="${gsl_site_css}_$gsl_post_type">
|
||||
|
||||
`cat "$gsl_dir_domain_tpl/header.html"`
|
||||
|
||||
<section id="${gsl_site_css}_page-wrapper">
|
||||
<article id="${gsl_site_css}_$gsl_header_slug">
|
||||
|
||||
<div id="${gsl_site_css}_metas">
|
||||
<p id="${gsl_site_css}_auteur">Écrit par <strong>$gsl_header_author</strong> le $gsl_header_date</p>
|
||||
</div>
|
||||
|
||||
`cat "$gsl_a11y_post"`
|
||||
</article>
|
||||
|
||||
<aside id="${gsl_site_css}_sidebar">
|
||||
<div class="${gsl_site_css}_wrapper" role="navigation">
|
||||
<nav id="${gsl_site_css}_latest-posts">
|
||||
<h1 class="${gsl_site_css}_latest-posts">$gsl_site_listname</h1>
|
||||
<ul aria-label="Liste d'Articles">
|
||||
<!--# include file="$gsl_uri/templates/last-posts-list.html" -->
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</aside>
|
||||
</section>
|
||||
|
||||
`cat "$gsl_dir_domain_tpl/footer.html"`
|
||||
|
||||
</body>
|
||||
</html>
|
||||
EOPAGE
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"SRV" \
|
||||
"wip" \
|
||||
"$gsl_post_type $gsl_post created" \
|
||||
"$gsl_srv_wip_page"
|
||||
gsl_checker_war=true
|
||||
|
||||
# No more needed html meta file
|
||||
rm -f "$gsl_html_meta"
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Create META head for Post/Page
|
||||
#----------------------------------------------------------------------
|
||||
gsl__html_meta_head() {
|
||||
# Create file with metas to be included in Post/Page
|
||||
gsl_html_meta=`mktemp`
|
||||
cat << EOMETAS >> "$gsl_html_meta"
|
||||
<meta charset="UTF-8" />
|
||||
<meta name='viewport' content="width=device-width, initial-scale=1.0">
|
||||
<meta name='robots' content="all">
|
||||
<meta name='generator' content="GSL: Statique Littérateur">
|
||||
<meta name='medium' content='website'>
|
||||
<meta name='revisit-after' content="3 days">
|
||||
|
||||
<title>$gsl_header_title - $gsl_site_title</title>
|
||||
<link rel="stylesheet" media="screen" href="$gsl_uri/templates/styles.css" />
|
||||
<link rel="shortcut icon" type="image/png" href="$gsl_uri/templates/favicon.png" />
|
||||
<link rel='me' type='text/html' href="$gsl_site_auth_url">
|
||||
|
||||
<meta name='language' content="$gsl_site_lang">
|
||||
<meta name='reply-to' content="$gsl_site_mail">
|
||||
<meta name='copyright' content="$gsl_site_cr">
|
||||
<meta name='title' content="$gsl_header_title - $gsl_site_title">
|
||||
<meta name='author' content="$gsl_header_author">
|
||||
<meta name='description' content="$gsl_header_info">
|
||||
<meta name='keywords' content="$gsl_site_keys,$gsl_header_tags">
|
||||
<meta name='search_date' content="$gsl_header_date">
|
||||
EOMETAS
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Create Generic Header
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__html_header() {
|
||||
cat << EOHEADER >> "$gsl_dir_domain_tpl/header.html"
|
||||
<header id="${gsl_site_css}_banner">
|
||||
<div id="${gsl_site_css}_site-logo">
|
||||
<a href="/">
|
||||
<img src="$gsl_uri_site_logo"
|
||||
alt="Logo de $gsl_site_title"
|
||||
title="Logo de $gsl_site_title"/>
|
||||
</a>
|
||||
</div>
|
||||
<section id="${gsl_site_css}_site-titles">
|
||||
<h1 id="${gsl_site_css}_site-name">
|
||||
<a href="/"
|
||||
title="Page d'accueil de $gsl_site_title">
|
||||
$gsl_site_title
|
||||
</a>
|
||||
</h1>
|
||||
<h2 id="${gsl_site_css}_site-description">$gsl_site_info</h2>
|
||||
</section>
|
||||
</header>
|
||||
EOHEADER
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Create Generic Footer
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__html_footer() {
|
||||
cat << EOFOOTER >> "$gsl_dir_domain_tpl/header.html"
|
||||
<footer id=${gsl_site_css}_footer">
|
||||
</footer>
|
||||
EOFOOTER
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Check for files in templates folder
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__check_templates() {
|
||||
# Create generic HEADER if not exists
|
||||
! [[ "$gsl_dir_domain_tpl/header.html" ]] \
|
||||
&& gsl__html_header
|
||||
|
||||
# Create generic FOOTER if not exists
|
||||
! [[ "$gsl_dir_domain_tpl/footer.html" ]] \
|
||||
&& gsl__html_footer
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Sidebar Posts list Manager | $1=Process | $2=Position | $3=Post
|
||||
#======================================================================
|
||||
gsl__page_sidebar() {
|
||||
gsl_post="$gsl_this_post"
|
||||
gsl__post_begin
|
||||
gsl__get_needed_headers
|
||||
gsl__page_prepare_datas
|
||||
|
||||
if [[ -f "$gsl_srv_wip_page" ]] ||
|
||||
[[ -f "$gsl_srv_www_page" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Sidebar" \
|
||||
"$gsl_listing_process" \
|
||||
"to list, position $2 ; $3 from domain $gsl_find_domain" \
|
||||
"$gsl_listing_file.$2"
|
||||
else
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Sidebar" \
|
||||
"$gsl_listing_process" \
|
||||
"make $3 from domain $gsl_find_domain first" \
|
||||
"$gsl_dir_domain_listings/"
|
||||
return
|
||||
fi
|
||||
|
||||
case "$gsl_post_type" in
|
||||
post) gsl_bpost_url="$gsl_header_slug/index.html" ;;
|
||||
page) gsl_bpost_url="$gsl_header_slug.html" ;;
|
||||
esac
|
||||
|
||||
touch "$gsl_listing_file.$2"
|
||||
cat << EOPostSide > "$gsl_listing_file.$2"
|
||||
<li>
|
||||
<span class="${gsl_site_css}_list-post-title"><a href="$gsl_uri/$gsl_bpost_url" class="${gsl_site_css}_list-post-link">$gsl_header_title</a></span>
|
||||
<div class="${gsl_site_css}_list-post-metas">Le $gsl_header_date par $gsl_header_author</div>
|
||||
<div class="${gsl_site_css}_list-post-info">$gsl_header_info</div>
|
||||
</li>
|
||||
EOPostSide
|
||||
|
||||
gsl__page_sidebar_create
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Sidebar Create from list in X-tra to file last-posts-list.html
|
||||
#======================================================================
|
||||
gsl__page_sidebar_create() {
|
||||
[[ -f "$gsl_dir_domain_tpl/last-posts-list.html" ]] \
|
||||
&& rm -f "$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
|
||||
touch "$gsl_dir_domain_tpl/last-posts-list.html" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Sidebar" \
|
||||
"Create" \
|
||||
"Build new list" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
|
||||
gsl_checker_war=true
|
||||
while read -r "postroller"
|
||||
do
|
||||
cat "$gsl_dir_domain_listings/$postroller" \
|
||||
>> "$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
done < <(ls -1X "$gsl_dir_domain_listings/")
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,231 +1,220 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__post_manager
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# -----------------------------------------------------------
|
||||
# MAIN LOOP. Read from Post list. Do according to Post Status
|
||||
# -----------------------------------------------------------
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__loop_posts() {
|
||||
gsl__check_nbr_posts
|
||||
(( $gsl_nbr_posts == 0 )) \
|
||||
&& gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Files" \
|
||||
"Not found" \
|
||||
"Nothing to do" \
|
||||
"${PWD}" \
|
||||
&& gsl_checker_war=true \
|
||||
&& return
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Files" \
|
||||
"Found" \
|
||||
"$gsl_nbr_posts" \
|
||||
"${PWD}"
|
||||
|
||||
#======================================================================
|
||||
# ---------------------------------
|
||||
# LOOP. Read ALL .gsl files in $PWD
|
||||
# ---------------------------------
|
||||
#======================================================================
|
||||
posts__loop() {
|
||||
for gsl_post in `ls -1 *.gsl 2>/dev/null`
|
||||
do
|
||||
|
||||
# Check specific asked Post
|
||||
if [[ "$gsl_this_post" ]];then
|
||||
! [[ "$gsl_post" == "$gsl_this_post" ]] \
|
||||
# Do specific asked Post
|
||||
[[ "$gsl_this_post" ]] && ! [[ "$gsl_post" == "$gsl_this_post" ]] \
|
||||
&& continue
|
||||
|
||||
# Set DB files (here, for newer post)
|
||||
gsl_file_db_post="$gsl_dir_db_domain/$gsl_post.db"
|
||||
gsl_file_db_post_hash="$gsl_dir_db_domain/.$gsl_post.db"
|
||||
|
||||
# check newer only
|
||||
[[ $gsl_check_newer ]] && [[ -f "$gsl_file_db_post" ]] \
|
||||
&& continue
|
||||
fi
|
||||
|
||||
gsl__get_sum "$gsl_post"
|
||||
|
||||
# Post too small / Should miss headers
|
||||
if (( "$gsl_post_size" <= $gsl_post_min_size ));then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"File" \
|
||||
"Content" \
|
||||
"Not enough datas $gsl_post ($gsl_post_size < $gsl_post_min_size)" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_war=true
|
||||
continue
|
||||
fi
|
||||
|
||||
# Set DB Post file
|
||||
gsl_file_db_post="$gsl_dir_db/$gsl_post.db"
|
||||
gsl__db_get_post_datas "$1"
|
||||
gsl__db_compare_post_hash
|
||||
|
||||
gsl__post_begin
|
||||
gsl__get_needed_headers
|
||||
gsl__page_prepare_datas
|
||||
|
||||
if [[ "$gsl_post_new_hash" ]];then
|
||||
unset gsl_db_post_status
|
||||
gsl_checker_war=true
|
||||
if [[ -f "$gsl_srv_wip_page" ]];then
|
||||
rm -f "$gsl_srv_wip_page" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"wip" \
|
||||
"Delete" \
|
||||
"$gsl_post_type ; $gsl_post has changed !" \
|
||||
"$gsl_srv_wip_page"
|
||||
fi
|
||||
|
||||
if [[ -f "$gsl_file_db_post" ]];then
|
||||
rm -f "$gsl_file_db_post" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
"Delete" \
|
||||
"file ; $gsl_post has changed !" \
|
||||
"$gsl_file_db_post"
|
||||
fi
|
||||
fi
|
||||
article__sum "$gsl_post" || continue
|
||||
article__splitter || return
|
||||
DB__datas "$1"
|
||||
DB__compare_hash "$1"
|
||||
[[ "$article_Type" ]] \
|
||||
&& srv__files datas
|
||||
|
||||
# From COMMAND [OPT]
|
||||
case "$1" in
|
||||
check)
|
||||
if ! [[ "$gsl_force_check" ]];then
|
||||
! [[ "$gsl_post_new_hash" ]] && continue
|
||||
fi
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Reading" \
|
||||
"File" \
|
||||
"$gsl_post" \
|
||||
"${PWD}"
|
||||
gsl__all_checkers
|
||||
;;
|
||||
|
||||
make)
|
||||
case "$gsl_db_post_status" in
|
||||
chk)
|
||||
gsl__all_makers
|
||||
;;
|
||||
|
||||
*)
|
||||
if ! [[ "$gsl_post_new_hash" ]];then
|
||||
# Should not be used...
|
||||
[[ "$gsl_force_make" ]] \
|
||||
&& gsl__all_makers \
|
||||
&& continue
|
||||
|
||||
if [[ -f "$gsl_srv_wip_page" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Post" \
|
||||
"Make" \
|
||||
"$gsl_post already Converted" \
|
||||
"$gsl_file_db_posts"
|
||||
gsl_checker_war=true
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
www)
|
||||
gsl_checker_war=true
|
||||
case "$2" in
|
||||
add)
|
||||
case "$gsl_db_post_status" in
|
||||
wip|www)
|
||||
rsync -a --delete \
|
||||
"$gsl_srv_wip_page" "$gsl_srv_www_page" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"SRV" \
|
||||
"www" \
|
||||
"Synced: $gsl_post_type $gsl_post" \
|
||||
"$gsl_srv_www_page"
|
||||
gsl__db_set_post_status www
|
||||
;;
|
||||
*)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Status" \
|
||||
"$gsl_db_post_status: $gsl_post not Converted" \
|
||||
"$gsl_file_db_posts"
|
||||
gsl_checker_err=true
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
remove)
|
||||
case "$gsl_post_type" in
|
||||
post)
|
||||
! [[ -d "$gsl_srv_www_page" ]] \
|
||||
&& return
|
||||
gsl_rm_c="rm -rf"
|
||||
;;
|
||||
page)
|
||||
! [[ -f "$gsl_srv_www_page" ]] \
|
||||
&& return
|
||||
gsl_rm_c="rm -f"
|
||||
;;
|
||||
esac
|
||||
$gsl_rm_c "$gsl_srv_www_page" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"SRV" \
|
||||
"www" \
|
||||
"REMOVED $gsl_post_type $gsl_post" \
|
||||
"$gsl_srv_www_page"
|
||||
gsl__db_set_post_status wip
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
check) Checkers ;;
|
||||
make) Makers ;;
|
||||
www) WWW__validate "$2" ;;
|
||||
wip) WIP__remove "$2" ;;
|
||||
esac
|
||||
|
||||
# In DB, show logs for server
|
||||
if [[ "$article_Type" ]];then
|
||||
if [[ $article_new_hash ]];then
|
||||
[[ "$old_Type" ]] \
|
||||
&& log_content="new TYPE" \
|
||||
|| log_content="new content"
|
||||
wip__remove "$log_content"
|
||||
fi
|
||||
|
||||
srv__files datas
|
||||
srv__files logs
|
||||
fi
|
||||
|
||||
unset ${!article_@}
|
||||
done
|
||||
|
||||
# Remove split files
|
||||
[[ -f "$gsl_tmp_post" ]] && rm -f "$gsl_tmp_post"
|
||||
[[ -f "$gsl_tmp_head" ]] && rm -f "$gsl_tmp_head"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --------------------
|
||||
# Doing some checkings
|
||||
# --------------------
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#=======================================================================
|
||||
# Check NAME post from [OPT] ; should be from autocompletion
|
||||
#=======================================================================
|
||||
gsl__check_opt_post() {
|
||||
if [[ `ls -1 *.gsl | grep "$1"` ]];then
|
||||
gsl_this_post="$1"
|
||||
else
|
||||
echo "! $1 Not Found"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check if posts from PWD folder
|
||||
#=======================================================================
|
||||
gsl__check_nbr_posts() {
|
||||
#======================================================================
|
||||
#---------------------
|
||||
# Tools for post files
|
||||
#---------------------
|
||||
#======================================================================
|
||||
#======================================================================
|
||||
# Check if .gsl files
|
||||
#======================================================================
|
||||
if__gsl_post() {
|
||||
gsl_nbr_posts=`ls -1 *.gsl 2>/dev/null | wc -l`
|
||||
|
||||
(( $gsl_nbr_posts == 0 )) \
|
||||
&& echo "! No Posts found with .gsl extension" \
|
||||
&& echo "! No .gsl file in this folder" \
|
||||
&& exit
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Create TMP file > Get Content Post Only (after #1)
|
||||
#======================================================================
|
||||
gsl__post_content_only() {
|
||||
gsl_tmp_post=`mktemp`
|
||||
awk -v l="$gsl_post_begin" \
|
||||
'NR >= l' \
|
||||
"$gsl_post" \
|
||||
> "$gsl_tmp_post"
|
||||
}
|
||||
|
||||
gsl__post_begin() {
|
||||
#======================================================================
|
||||
# Get line from first title to split header & content
|
||||
#======================================================================
|
||||
article__splitter() {
|
||||
gsl_post_begin=`
|
||||
awk -v m="#1" \
|
||||
'match($1,m) {print NR;exit}' \
|
||||
"$gsl_post"`
|
||||
|
||||
if ! [[ "$gsl_post_begin" ]];then
|
||||
gsl__logs_print -e -c \
|
||||
"Begins" \
|
||||
"Unused: '#1' TITLE" \
|
||||
"${PWD}/$gsl_post"
|
||||
return 1
|
||||
fi
|
||||
|
||||
file__header_only
|
||||
file__post_only
|
||||
|
||||
gsl__logs_print -i -g \
|
||||
"Split" \
|
||||
"line: $gsl_post_begin ; Header + Content" \
|
||||
"$gsl_tmp_head + $gsl_tmp_post"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Create TMP file > Get Headers metas Only (before #1)
|
||||
#======================================================================
|
||||
file__header_only() {
|
||||
gsl_tmp_head=`mktemp`
|
||||
awk -v l="$gsl_post_begin" \
|
||||
'NR < l' \
|
||||
"$gsl_post" \
|
||||
> "$gsl_tmp_head"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Create TMP file > Get Content Post Only (after #1)
|
||||
#======================================================================
|
||||
file__post_only() {
|
||||
gsl_tmp_post=`mktemp`
|
||||
awk -v l="$gsl_post_begin" \
|
||||
'NR >= l' \
|
||||
"$gsl_post" \
|
||||
> "$gsl_tmp_post"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get Size & cksum Hash from File... $1: File
|
||||
#======================================================================
|
||||
article__sum() {
|
||||
article_Sum=`cksum "$1"`
|
||||
article_Hash=`awk '{print $1}' <<< "$article_Sum"`
|
||||
article_Size=`awk '{print $2}' <<< "$article_Sum"`
|
||||
|
||||
case "$gsl_proc" in
|
||||
create|edit) return ;;
|
||||
esac
|
||||
|
||||
# Post too small ?
|
||||
if (( "$article_Size" <= $gsl_article_min_Size ));then
|
||||
gsl__logs_print -w -A -sk \
|
||||
"Not enough content ($article_Size < $gsl_article_min_Size)" \
|
||||
"${PWD}/$1"
|
||||
return 1
|
||||
fi
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -1,141 +0,0 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__sidebar
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#======================================================================
|
||||
# Sidebar Manager | $1=call | $2=process | $3=POS/Post | $4=Post
|
||||
#======================================================================
|
||||
gsl__sidebar() {
|
||||
case "$2" in
|
||||
"")
|
||||
ls -1X "$gsl_dir_domain_listings"
|
||||
exit
|
||||
;;
|
||||
|
||||
create|-C)
|
||||
! [[ `ls -1 "$gsl_dir_domain_listings"` ]] \
|
||||
&& echo "! No post in list: $gsl_dir_domain_listings" \
|
||||
&& exit
|
||||
|
||||
gsl__page_sidebar_create
|
||||
;;
|
||||
|
||||
add|-A)
|
||||
# $2=process | $3=Position | $4=post
|
||||
gsl_listing_process="add"
|
||||
! [[ "$3" ]] \
|
||||
&& echo "! Set a number <= $gsl_list_max_posts ; see help" \
|
||||
&& exit
|
||||
|
||||
! [[ `expr "x$3" : "x[0-9]*$"` -gt 0 ]] \
|
||||
&& gsl__list_bad_arg nbr $3
|
||||
|
||||
! (( $3 <= $gsl_list_max_posts )) \
|
||||
&& gsl__list_bad_arg nbr $3
|
||||
|
||||
! [[ "$4" ]] \
|
||||
&& gsl__list_bad_arg file
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"$1 ; $2 ; position $3 ; $4 from domain $gsl_find_domain" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
|
||||
gsl__if_file "$4" post
|
||||
gsl_listing_file="$gsl_dir_domain_listings/$4.list"
|
||||
gsl_post_old_inlist=`ls -1 "$gsl_dir_domain_listings/" | grep ".list.$3"`
|
||||
|
||||
if [[ `ls -1 "$gsl_listing_file"* 2>/dev/null` ]];then
|
||||
# Post exists (maybe with different position)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Sidebar" \
|
||||
"Post" \
|
||||
"$gsl_listing_process $4 ; already in list !" \
|
||||
"$gsl_dir_domain_listings/"
|
||||
gsl_checker_war=true
|
||||
|
||||
elif [[ "$gsl_post_old_inlist" ]];then
|
||||
# Another post exists at this position.
|
||||
# Remove and create new in roller
|
||||
rm -f "$gsl_dir_domain_listings/$gsl_post_old_inlist"
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Sidebar" \
|
||||
"Post" \
|
||||
"$gsl_listing_process $4 ; replace $gsl_post_old_inlist !" \
|
||||
"$gsl_dir_domain_listings/$gsl_post_old_inlist"
|
||||
gsl_checker_war=true
|
||||
gsl__page_sidebar $2 $3 $4
|
||||
else
|
||||
# Not gound in list, create for roller
|
||||
gsl__page_sidebar $2 $3 $4
|
||||
fi
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"$1 ; $2 ; position $3 ; $4 from domain $gsl_find_domain" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
;;
|
||||
|
||||
remove|-R)
|
||||
gsl_listing_process="remove"
|
||||
! [[ "$3" ]] \
|
||||
&& gsl__list_bad_arg file $3
|
||||
|
||||
gsl__if_file "$3" post
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
"Process" \
|
||||
"$1 ; $2 ; $3 from domain $gsl_find_domain" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
|
||||
gsl_post_rm_list=`ls -1 "$gsl_dir_domain_listings/" | grep "$3.list"`
|
||||
rm -f "$gsl_dir_domain_listings/$gsl_post_rm_list" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Sidebar" \
|
||||
"$2" \
|
||||
"$3 from domain $gsl_find_domain in list" \
|
||||
"$gsl_dir_domain_listings/$gsl_post_rm_list"
|
||||
gsl_checker_war=true
|
||||
|
||||
gsl__page_sidebar_create
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Stopping" \
|
||||
"Process" \
|
||||
"$1 ; $2 ; $3 from domain $gsl_find_domain" \
|
||||
"$gsl_dir_domain_tpl/last-posts-list.html"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "! Bad argument: add|-A/remove|-R"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Sidebar Return bad argument
|
||||
#======================================================================
|
||||
gsl__list_bad_arg() {
|
||||
case "$1" in
|
||||
nbr)
|
||||
echo "! $2 is not a number <= $gsl_list_max_posts ; see help"
|
||||
;;
|
||||
file)
|
||||
echo "! Set post [FILE]"
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
}
|
|
@ -0,0 +1,335 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__srv_manager
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
# w<< (ARGUMENT)
|
||||
# $1: process
|
||||
# $2: file / all
|
||||
#======================================================================
|
||||
srv__OPTIONS() {
|
||||
case "$2" in
|
||||
sync) sync__OPTIONS $1 ;;
|
||||
add) true ;;
|
||||
remove) true ;;
|
||||
*) gsl__invalid_option "$2" "add|remove|sync"
|
||||
esac
|
||||
|
||||
case "$3" in
|
||||
*".gsl")
|
||||
if__file "$3" post
|
||||
gsl_post="$3"
|
||||
post_only="$3"
|
||||
case "$1" in
|
||||
wip)
|
||||
gsl make "$3"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
all)
|
||||
case "$1" in
|
||||
www)
|
||||
echo "! You're about to put online all wip articles"
|
||||
read -rp "- Continue (YES|*)" www_confirm
|
||||
case "www_confirm" in
|
||||
YES) gsl_www="$3" ;;
|
||||
*) echo "# Abandon"; exit ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
wip)
|
||||
gsl make
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
"")
|
||||
gsl__invalid_option "$3" "all|file"
|
||||
;;
|
||||
esac
|
||||
|
||||
www_process=true
|
||||
|
||||
[[ "$gsl_post" ]] || log_info_all=" ALL"
|
||||
|
||||
log__process_begin "Server ($1 online)${log_info_all}"
|
||||
posts__loop "$1" "$2"
|
||||
|
||||
# For logs ; set post or unset if all
|
||||
[[ $log_info_all ]] && unset gsl_post
|
||||
[[ $post_only ]] && gsl_post="$post_only"
|
||||
|
||||
log__process_end "Server ($1 online)${log_info_all}"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# wip: remove online
|
||||
#======================================================================
|
||||
WIP__remove() {
|
||||
case "$1" in
|
||||
remove)
|
||||
if [[ -f "$gsl_srv_post_wip" ]];then
|
||||
rm -f "$gsl_srv_post_wip" && \
|
||||
gsl__logs_print -w -srv wip \
|
||||
"Article deleted ; no more online" \
|
||||
"$gsl_srv_post_wip"
|
||||
|
||||
find "$gsl_srv_wip" -type d -empty -delete && \
|
||||
gsl__logs_print -w -srv wip \
|
||||
"Cleaned empty directories" \
|
||||
"$gsl_srv_wip"
|
||||
|
||||
DB__set_status "wip-del"
|
||||
fi
|
||||
return
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# www: Valid online
|
||||
#======================================================================
|
||||
WWW__validate() {
|
||||
case "$1" in
|
||||
remove)
|
||||
if [[ -f "$gsl_srv_post_www" ]];then
|
||||
rm -f "$gsl_srv_post_www" && \
|
||||
gsl__logs_print -w -srv www \
|
||||
"Article deleted ; no more online" \
|
||||
"$gsl_srv_post_www"
|
||||
|
||||
find "$gsl_srv_www" -type d -empty -delete && \
|
||||
gsl__logs_print -w -srv www \
|
||||
"Cleaned empty directories" \
|
||||
"$gsl_srv_www"
|
||||
|
||||
DB__set_status "www-del"
|
||||
fi
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [[ $article_Status_chk ]];then
|
||||
gsl__logs_print -e -srv www \
|
||||
"Article not yet checked" \
|
||||
"$PWD/$gsl_post"
|
||||
return
|
||||
|
||||
elif (( $article_Status_chk != $article_Status_wip ));then
|
||||
gsl__logs_print -e -srv www \
|
||||
"Article not yet converted with make" \
|
||||
"$gsl_srv_post_wip"
|
||||
return
|
||||
|
||||
elif (( $article_Status_chk == $article_Status_www )) && \
|
||||
[[ -f "$gsl_srv_post_www" ]];then
|
||||
gsl__logs_print -w -srv www \
|
||||
"Article already online" \
|
||||
"$gsl_srv_post_www"
|
||||
return
|
||||
|
||||
else
|
||||
if (( $article_Status_chk == $article_Status_wip ));then
|
||||
[[ "$article_Slug" =~ "/" ]] \
|
||||
&& mkdir -p "$gsl_slug_dir_www"
|
||||
|
||||
rsync -a "$gsl_srv_post_wip" "$gsl_srv_post_www" && \
|
||||
gsl__logs_print -i -srv www \
|
||||
"Article validated online" \
|
||||
"$gsl_srv_post_www" && \
|
||||
DB__set_status "www"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get arguments from COMMAND (sync)
|
||||
# $2: process (wip|www|"")
|
||||
#======================================================================
|
||||
sync__OPTIONS() {
|
||||
gsl_srv_wip="$site_server/$site_ndd/wip"
|
||||
gsl_srv_www="$site_server/$site_ndd/www"
|
||||
|
||||
case "$1" in
|
||||
""|www|wip)
|
||||
! [[ "$1" ]] \
|
||||
&& srv_proc="wip+www" \
|
||||
|| srv_proc="$1"
|
||||
|
||||
log__process_begin "Sync $srv_proc"
|
||||
case "$1" in
|
||||
"")
|
||||
sync__srv "$srv_proc" "$gsl_srv_wip"
|
||||
sync__srv "$srv_proc" "$gsl_srv_www"
|
||||
;;
|
||||
www)
|
||||
sync__srv "$srv_proc" "$gsl_srv_www"
|
||||
;;
|
||||
wip)
|
||||
sync__srv "$srv_proc" "$gsl_srv_wip"
|
||||
;;
|
||||
esac
|
||||
log__process_end "Sync $srv_proc"
|
||||
;;
|
||||
|
||||
*)
|
||||
gsl__invalid_option "$2" "www|wip"
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Sync Files from Templates to webserver
|
||||
# $1: process (wip|www|wip+www)
|
||||
# $2: Folder
|
||||
#======================================================================
|
||||
sync__srv() {
|
||||
# Sync Files and Folders
|
||||
mkdir -p "$2"
|
||||
rsync -a --delete "$gsl_dir_domain_tpl" "$2"
|
||||
rsync -a --delete "$gsl_dir_domain_files" "$2"
|
||||
rsync -a --delete "$gsl_dir_domain_images" "$2"
|
||||
rsync -a --delete "$gsl_dir_domain_listings" "$2"
|
||||
|
||||
gsl__logs_print -i -srv $1 \
|
||||
"Sync: $gsl_dir_domain/" \
|
||||
"$2/"
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Set Post/Page file for www+wip from page type and slug
|
||||
# Find server post/page file and log
|
||||
#======================================================================
|
||||
srv__files() {
|
||||
gsl_srv_wip="$site_server/$site_ndd/wip"
|
||||
gsl_srv_www="$site_server/$site_ndd/www"
|
||||
|
||||
case "$1" in
|
||||
datas)
|
||||
unset srv_uri
|
||||
case "$article_Type" in
|
||||
post)
|
||||
gsl_srv_post_wip="$gsl_srv_wip/$article_Slug/index.html"
|
||||
gsl_srv_post_www="$gsl_srv_www/$article_Slug/index.html"
|
||||
gsl_slug_file="$article_Slug/index.html"
|
||||
gsl_slug_dir_wip=${gsl_srv_post_wip%\/*}
|
||||
gsl_slug_dir_www=${gsl_srv_post_www%\/*}
|
||||
|
||||
# Count sub directories
|
||||
sub_uri="${article_Slug//[^\/]}"
|
||||
srv_uri+=`printf '%0.s../' $(seq 0 ${#sub_uri})`
|
||||
;;
|
||||
|
||||
page)
|
||||
gsl_srv_post_wip="$gsl_srv_wip/$article_Slug.html"
|
||||
gsl_srv_post_www="$gsl_srv_www/$article_Slug.html"
|
||||
gsl_slug_file="$article_Slug.html"
|
||||
|
||||
srv_uri='./'
|
||||
;;
|
||||
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
# wip file ?
|
||||
if [[ -f "$gsl_srv_post_wip" ]];then
|
||||
[[ "$article_Status_wip" == "$article_Status_chk" ]] \
|
||||
&& wip_status="(current)" \
|
||||
|| wip_status="(old)"
|
||||
|
||||
gsl_srv_wip_file=true
|
||||
|
||||
else
|
||||
unset gsl_srv_wip_file
|
||||
fi
|
||||
|
||||
# www file ?
|
||||
if [[ -f "$gsl_srv_post_www" ]];then
|
||||
[[ "$article_Status_www" == "$article_Status_chk" ]] \
|
||||
&& www_status="(current)" \
|
||||
|| www_status="(old)"
|
||||
|
||||
gsl_srv_www_file=true
|
||||
|
||||
else
|
||||
unset gsl_srv_www_file
|
||||
fi
|
||||
;;
|
||||
|
||||
logs)
|
||||
# WIP file
|
||||
if [[ $gsl_srv_wip_file ]];then
|
||||
gsl__logs_print -i -srv -wip \
|
||||
"HTML $article_Type Found $wip_status" \
|
||||
"$gsl_srv_post_wip"
|
||||
|
||||
else
|
||||
gsl__logs_print -w -srv -wip \
|
||||
"HTML $article_Type not created yet" \
|
||||
"$gsl_srv_post_wip"
|
||||
fi
|
||||
|
||||
# WWW file
|
||||
if [[ $gsl_srv_www_file ]];then
|
||||
gsl__logs_print -i -srv -www \
|
||||
"HTML $article_Type Found $www_status" \
|
||||
"$gsl_srv_post_www"
|
||||
else
|
||||
gsl__logs_print -w -srv -www \
|
||||
"HTML $article_Type not created yet" \
|
||||
"$gsl_srv_post_www"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Remove WIP page
|
||||
# If error from check and exists
|
||||
#======================================================================
|
||||
wip__remove() {
|
||||
! [[ -f "$gsl_srv_post_wip" ]] && return
|
||||
|
||||
log_Type="in $article_Slug"
|
||||
|
||||
# Remove from old slug, if new article Type set
|
||||
[[ "$old_Type" ]] \
|
||||
&& article_Type="$old_Type" \
|
||||
&& article_Slug="$old_Slug" \
|
||||
&& log_Type="from old $old_Type"
|
||||
|
||||
rm -f "$gsl_srv_post_wip" && \
|
||||
gsl__logs_print -w -S -wip \
|
||||
"Article deleted ; no more preview" \
|
||||
"$gsl_srv_post_wip"
|
||||
|
||||
find "$gsl_srv_wip" -type d -empty -delete && \
|
||||
gsl__logs_print -w -S -wip \
|
||||
"Cleaned empty directories" \
|
||||
"$gsl_srv_wip"
|
||||
|
||||
gsl__logs_print -w -R -wip \
|
||||
"Found $1 $log_Type" \
|
||||
"$gsl_srv_post_wip"
|
||||
|
||||
if [[ "$old_Type" ]];then
|
||||
unset old_Type old_Slug log_Type
|
||||
|
||||
[[ -f "$gsl_file_db_post" ]] \
|
||||
&& source "$gsl_file_db_post"
|
||||
fi
|
||||
}
|
|
@ -1,118 +1,144 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__stats
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
gsl__get_stats() {
|
||||
gsl_stats_article_all=0 # All non error
|
||||
|
||||
# Status
|
||||
gsl_stats_articles_www=0 # All www
|
||||
gsl_stats_articles_pages_www=0 # All page www
|
||||
gsl_stats_articles_posts_www=0 # All page www
|
||||
|
||||
gsl_stats_articles_wip=0 # All wip
|
||||
gsl_stats_articles_pages_wip=0
|
||||
gsl_stats_articles_posts_wip=0
|
||||
|
||||
gsl_stats_articles_chk=0 # All wip
|
||||
gsl_stats_articles_pages_chk=0
|
||||
gsl_stats_articles_posts_chk=0
|
||||
|
||||
# Author
|
||||
gsl_auth_max=0
|
||||
while read -r "N" "AUTHOR"
|
||||
do
|
||||
gsl_auth[$N]="$AUTHOR"
|
||||
gsl_this_auth[$N]=0
|
||||
((gsl_auth_max++))
|
||||
done < <(cat -n "$gsl_this_conf_domain/$gsl_filename_auth")
|
||||
|
||||
# Counting
|
||||
while read -r "file_gsl_db"
|
||||
do
|
||||
((gsl_stats_article_all++))
|
||||
gsl_file_uri_db="$gsl_dir_db/$file_gsl_db"
|
||||
|
||||
# Author
|
||||
gsl_auth_name=`grep "Author:" $gsl_file_uri_db | awk -F: '{print $2}'`
|
||||
for a in `seq 1 $gsl_auth_max`
|
||||
do
|
||||
[[ ${gsl_auth[$a]} == "$gsl_auth_name" ]] \
|
||||
&& ((gsl_this_auth[$a]++))
|
||||
done
|
||||
|
||||
# Online
|
||||
if [[ `grep "Status:www" $gsl_file_uri_db` ]];then
|
||||
((gsl_stats_articles_www++))
|
||||
|
||||
[[ `grep "page:" $gsl_file_uri_db` ]] \
|
||||
&& ((gsl_stats_articles_pages_www++))
|
||||
|
||||
[[ `grep "post:" $gsl_file_uri_db` ]] \
|
||||
&& ((gsl_stats_articles_posts_www++))
|
||||
|
||||
# WIP
|
||||
elif [[ `grep "Status:wip" $gsl_file_uri_db` ]];then
|
||||
((gsl_stats_articles_wip++))
|
||||
|
||||
[[ `grep "page:" $gsl_file_uri_db` ]] \
|
||||
&& ((gsl_stats_articles_pages_wip++))
|
||||
|
||||
[[ `grep "post:" $gsl_file_uri_db` ]] \
|
||||
&& ((gsl_stats_articles_posts_wip++))
|
||||
|
||||
# CHK
|
||||
elif [[ `grep "Status:chk" $gsl_file_uri_db` ]];then
|
||||
((gsl_stats_articles_chk++))
|
||||
|
||||
[[ `grep "page:" $gsl_file_uri_db` ]] \
|
||||
&& ((gsl_stats_articles_pages_chk++))
|
||||
|
||||
[[ `grep "post:" $gsl_file_uri_db` ]] \
|
||||
&& ((gsl_stats_articles_posts_chk++))
|
||||
fi
|
||||
|
||||
done < <(ls -1 "$gsl_dir_db" | grep ".gsl.db")
|
||||
|
||||
# Creating statoolinfos file
|
||||
#gsl.articles=nombre d'articles
|
||||
#gsl.articles.pages=nombre d'articles type page
|
||||
#gsl.articles.posts=nombre d'articles type page
|
||||
#gsl.authors=nombre d'auteurs
|
||||
|
||||
#gsl.articles.words=
|
||||
#gsl.articles.quotes=
|
||||
#gsl.articles.paragraphs=
|
||||
|
||||
|
||||
printf '%s\n%s\n%s\n%s\n' \
|
||||
"gsl.articles=$gsl_stats_articles_www" \
|
||||
"gsl.articles.pages=$gsl_stats_articles_pages_www" \
|
||||
"gsl.articles.posts=$gsl_stats_articles_posts_www" \
|
||||
"gsl.authors=$gsl_auth_max" \
|
||||
> "$gsl_file_sti" && \
|
||||
echo "> Génération des stats (Statoolinfos): $gsl_file_sti"
|
||||
|
||||
# Show stats
|
||||
echo -e "# Total (no error): $gsl_stats_article_all"
|
||||
for a in `seq 1 $gsl_auth_max`
|
||||
do
|
||||
echo "- ${gsl_auth[$a]}: ${gsl_this_auth[a]}"
|
||||
done
|
||||
|
||||
echo
|
||||
printf '%s\n%s%s%s\n%s%s%s\n%s%s%s\n' \
|
||||
"CHK|WIP|WWW" \
|
||||
"All: $gsl_stats_articles_chk|" \
|
||||
"All: $gsl_stats_articles_wip|" \
|
||||
"All: $gsl_stats_articles_www" \
|
||||
"Pages: $gsl_stats_articles_pages_chk|" \
|
||||
"Pages: $gsl_stats_articles_pages_wip|" \
|
||||
"Pages: $gsl_stats_articles_pages_www" \
|
||||
"Posts: $gsl_stats_articles_posts_chk|" \
|
||||
"Posts: $gsl_stats_articles_posts_wip|" \
|
||||
"Posts: $gsl_stats_articles_posts_wip" \
|
||||
| column -t -s'|'
|
||||
#======================================================================
|
||||
# Init Stats | Called from Checkers()
|
||||
#======================================================================
|
||||
stats__init() {
|
||||
gsl_stat_po=0;gsl_stat_pc=0 # paragraphs
|
||||
gsl_stat_bq=0
|
||||
gsl_stat_abbrs=0
|
||||
gsl_stat_links=0
|
||||
gsl_stat_links_online=0
|
||||
gsl_stat_flinks=0
|
||||
gsl_stat_images=0
|
||||
gsl_stat_fcodes=0
|
||||
gsl_stat_fbruts=0
|
||||
gsl_stat_strongs=0
|
||||
gsl_stat_bolds=0
|
||||
gsl_stat_italics=0
|
||||
gsl_stat_icodes=0
|
||||
gsl_stat_strikes=0
|
||||
gsl_stat_titles=0
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Called from stats ; Counting datas from db
|
||||
#======================================================================
|
||||
stats__datas() {
|
||||
gsl_file_sti="$site_server/$domain_name/www/gsl-sti.properties"
|
||||
|
||||
# Basic
|
||||
stat_authors_max=`cat "$gsl_file_domain_authors" | wc -l`
|
||||
|
||||
# Init WWW stats
|
||||
stat_articles_www=0
|
||||
stat_articles_pages_www=0
|
||||
stat_articles_posts_www=0
|
||||
stat_articles_tags_www=0
|
||||
stat_articles_words_www=0
|
||||
stat_articles_quotes_www=0
|
||||
stat_articles_paragraphs_www=0
|
||||
stat_articles_links_www=0
|
||||
stat_articles_links_online_www=0
|
||||
stat_articles_lists_www=0
|
||||
stat_articles_lists_items_www=0
|
||||
stats_articles_max_images_www=0
|
||||
|
||||
# Counting Stats
|
||||
while IFS=: read -r "filename" "status"
|
||||
do
|
||||
source "$filename"
|
||||
! (( $article_Status_www> 0 )) && continue
|
||||
|
||||
((stat_articles_www++))
|
||||
|
||||
case "$article_Type" in
|
||||
post) ((stat_articles_posts_www++)) ;;
|
||||
page) ((stat_articles_pages_www++)) ;;
|
||||
esac
|
||||
|
||||
stat_articles_tags_www=$(( stat_articles_tags_www + stat_Tags ))
|
||||
stat_articles_words_www=$((stat_articles_words_www + stat_Words ))
|
||||
stat_articles_quotes_www=$((stat_articles_quotes_www + stat_Quotes ))
|
||||
stat_articles_paragraphs_www=$((stat_articles_paragraphs_www + stat_Paragraphs ))
|
||||
stat_articles_links_www=$(( stat_articles_links_www + stat_Links ))
|
||||
stat_articles_links_online_www=$(( stat_articles_links_online_www + stat_Links_Online ))
|
||||
stat_articles_lists_www=$(( stat_articles_lists_www + stat_Lists ))
|
||||
stat_articles_lists_items_www=$(( stat_articles_lists_items_www + stat_Lists_Items ))
|
||||
stats_articles_max_images_www=$(( stats_articles_max_images_www + stat_max_Images ))
|
||||
|
||||
unset ${!article_@}
|
||||
done < <(grep -H "article_Status_www" "$gsl_dir_db_domain/"*.db)
|
||||
|
||||
cat <<EOSTATS > "$gsl_file_sti"
|
||||
gsl.articles = $stat_articles_www
|
||||
gsl.articles.pages = $stat_articles_pages_www
|
||||
gsl.articles.posts = $stat_articles_posts_www
|
||||
gsl.authors = $stat_authors_max
|
||||
gsl.articles.tags = $stat_articles_tags_www
|
||||
gsl.articles.words = $stat_articles_words_www
|
||||
gsl.articles.quotes = $stat_articles_quotes_www
|
||||
gsl.articles.paragraphs = $stat_articles_paragraphs_www
|
||||
gsl.articles.links = $stat_articles_links_www
|
||||
gsl.articles.links.online = $stat_articles_links_online_www
|
||||
gsl.articles.lists = $stat_articles_lists_www
|
||||
gsl.articles.lists.items = $stat_articles_lists_items_www
|
||||
gsl_articles.images = $stats_articles_max_images_www
|
||||
EOSTATS
|
||||
|
||||
echo "# Statoolinfos: $gsl_file_sti"
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Stat: Count words and misc | Done with check command
|
||||
# $1: gsl_tmp_èpost
|
||||
#======================================================================
|
||||
Stat__words() {
|
||||
# Global Words
|
||||
gsl_stat_words=`cat "$1" | wc -w`
|
||||
gsl_total_images=`grep "_image:" $1 | wc -l`
|
||||
gsl_total_fcodes=`grep "_code:" $1 | wc -l`
|
||||
gsl_total_fbruts=`grep "_brut:" $1 | wc -l`
|
||||
|
||||
# Lists
|
||||
(( $gsl_stat_lists > 0 )) \
|
||||
&& gsl_list_items=`grep "^=\|^+" "$1" | wc -l` \
|
||||
|| gsl_list_items=0
|
||||
|
||||
# Quotes
|
||||
(( $gsl_stat_bq > 0 )) \
|
||||
&& gsl_bq_items=`grep "^_year\|^_cite\|_lang\|_book\|_link" "$1" | wc -w` \
|
||||
|| gsl_bq_items=0
|
||||
|
||||
echo "bq items> $gsl_bq_items"
|
||||
gsl_stat_words=\
|
||||
$(( gsl_stat_words \
|
||||
- 2*gsl_stat_p \
|
||||
- 2*gsl_stat_bq \
|
||||
- 2*gsl_stat_lists \
|
||||
- gsl_list_items \
|
||||
- gsl_bq_items \
|
||||
- gsl_stat_titles \
|
||||
- gsl_total_fbrut \
|
||||
- gsl_total_fcode \
|
||||
- gsl_total_images \
|
||||
))
|
||||
|
||||
gsl_log_stats=`
|
||||
printf '%s %s %s\n' \
|
||||
"W=$gsl_stat_words ; T=$gsl_stat_titles ; P=$gsl_stat_p ;" \
|
||||
"I=$gsl_total_images ; Q=$gsl_stat_bq ;" \
|
||||
"L=$gsl_stat_lists ($gsl_list_items)"`
|
||||
|
||||
gsl__logs_print -i -st -c \
|
||||
"$gsl_log_stats" \
|
||||
"${PWD}/$gsl_post"
|
||||
}
|
||||
|
|
|
@ -1,280 +0,0 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__tools
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
#=======================================================================
|
||||
# Check Needed Folders, and create needed files
|
||||
#=======================================================================
|
||||
# Folders
|
||||
gsl__create_ff() {
|
||||
for gsl_folder in "$gsl_dir_db" \
|
||||
"$gsl_dir_logs"
|
||||
do
|
||||
if ! [[ -d "$gsl_folder" ]];then
|
||||
echo ": Creating $gsl_folder and give permissions to $USER"
|
||||
sudo mkdir -p "$gsl_folder" && \
|
||||
sudo chown -R $USER:$USER "$gsl_folder"
|
||||
fi
|
||||
done
|
||||
|
||||
# Files
|
||||
for gsl_file in "$gsl_file_logs" \
|
||||
"$gsl_file_db_domains"
|
||||
do
|
||||
! [[ -f "$gsl_file" ]] && touch "$gsl_file"
|
||||
done
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check if PWD is configure for DOMAIN
|
||||
#=======================================================================
|
||||
gsl__find_domain() {
|
||||
gsl_nbr_domains=`
|
||||
find . -maxdepth 1 -not -type d -type f \
|
||||
-iname "gsl.*.*" 2>/dev/null \
|
||||
| wc -l`
|
||||
|
||||
(( $gsl_nbr_domains > 1 )) \
|
||||
&& echo "! Too much domains registred here: Set only One per folder" \
|
||||
&& exit $gsl_nbr_domains
|
||||
(( $gsl_nbr_domains == 0 )) \
|
||||
&& echo "! No registred domain here: change or set folder. See help new" \
|
||||
&& exit
|
||||
|
||||
gsl_find_domain=`
|
||||
find . -maxdepth 1 -not -type d -type f \
|
||||
-iname "gsl.*.*" 2>/dev/null`
|
||||
|
||||
gsl_find_domain=`
|
||||
awk -F"." '{print $(NF-1)"."$NF}' \
|
||||
<<< $gsl_find_domain`
|
||||
|
||||
gsl_find_domain=${gsl_find_domain,,}
|
||||
gsl__check_domain "$gsl_find_domain"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check and set domain from DB
|
||||
#=======================================================================
|
||||
gsl__check_domain() {
|
||||
gsl_this_conf_domain=`grep "$1" "$gsl_file_db_domains"`
|
||||
|
||||
! [[ "$gsl_this_conf_domain" ]] \
|
||||
&& echo "! Domain Not found: $1" \
|
||||
&& exit
|
||||
|
||||
gsl_dir_domain_tpl="$gsl_this_conf_domain/templates"
|
||||
gsl_dir_domain_files="$gsl_this_conf_domain/files"
|
||||
gsl_dir_domain_images="$gsl_this_conf_domain/images"
|
||||
gsl_dir_domain_listings="$gsl_this_conf_domain/X-tra"
|
||||
|
||||
for gsl_new_dir in `set -o posix ; set \
|
||||
| grep "gsl_dir_domain" \
|
||||
| awk -F= '{print $2}'`
|
||||
do
|
||||
if ! [[ -d "$gsl_new_dir" ]];then
|
||||
mkdir -p "$gsl_new_dir" 2>/dev/null && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Folder" \
|
||||
"Init..." \
|
||||
"Created" \
|
||||
"$gsl_new_dir"
|
||||
fi
|
||||
done
|
||||
|
||||
gsl__if_file "$gsl_this_conf_domain/$gsl_find_domain.conf" source
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --------------
|
||||
# Tools for Post
|
||||
# --------------
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#=======================================================================
|
||||
# Get Size & cksum Hash from File... $1 hash/size $2: File
|
||||
#=======================================================================
|
||||
gsl__get_sum() {
|
||||
gsl_post_sum=`cksum "$1"`
|
||||
gsl_post_hash=`awk '{print $1}' <<< "$gsl_post_sum"`
|
||||
gsl_post_size=`awk '{print $2}' <<< "$gsl_post_sum"`
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get line nbr from TERM in FIle... $1: TERM | $2: File
|
||||
#=======================================================================
|
||||
gsl__get_line() {
|
||||
awk -v s="$1" \
|
||||
'match($0,s) {print NR}' \
|
||||
"$2"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get everything after the marker... $1: marker | $2: File
|
||||
#=======================================================================
|
||||
gsl__get_header() {
|
||||
awk -F"$1" -v marker="$1" -v l="$gsl_post_begin" \
|
||||
'NR < l && $0 ~ marker {print $2}' \
|
||||
"$2" 2>/dev/null
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get line nbr from CONTENT Post... $1: TERM | $2: File
|
||||
#=======================================================================
|
||||
gsl__get_content_line() {
|
||||
grep -n "$1" "$2" | awk -F: '{print $1}' || return
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get CONTENT Post with markers... $1: Open Marker | $2: Close Marker
|
||||
#=======================================================================
|
||||
gsl__get_content_with_markers() {
|
||||
gsl__get_content_finder \
|
||||
-o "$1" \
|
||||
-b "$gsl_post_header_field_1" \
|
||||
-c "$2" \
|
||||
-f "$gsl_post" \
|
||||
| tail -1 \
|
||||
|| return
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get CONTENT with marks | ! find from ONE line content
|
||||
#=======================================================================
|
||||
gsl__get_content_finder() {
|
||||
# Get [OPTs]
|
||||
while (( "$#" ))
|
||||
do
|
||||
case "$1" in
|
||||
-o) mk_o="$2" ;; # Open marker
|
||||
-c) mk_c="$2" ;; # Close Marker
|
||||
-b) mk_b="$2" ;; # Between markers
|
||||
-f) file="$2" ;; # In whole file
|
||||
-v) ivar="$2" ;; # In variable
|
||||
-n) line="n" ;; # Give found line number
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
! [[ "$file" ]] && ! [[ "$ivar" ]] && return 1
|
||||
! [[ "$mk_o" ]] && ! [[ "$mk_c" ]] && return 1
|
||||
! [[ "$mk_b" ]] && mk_b='.*'
|
||||
|
||||
if [[ "$file" ]];then
|
||||
grep -oP$line "(?<=$mk_o)$mk_b?(?=$mk_c)" "$file" && return
|
||||
elif [[ "$ivar" ]];then
|
||||
grep -oP$line "(?<=$mk_o)$mk_b?(?=$mk_c)" <<< "$ivar" && return
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get NEEDED HEADERS | $1 VAR CONTENT $2 LOG Proc $3 LOG Act
|
||||
#=======================================================================
|
||||
gsl__check_needed_headers() {
|
||||
! [[ "$1" ]] \
|
||||
&& gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Content" \
|
||||
"$2" \
|
||||
"Missing: $3" \
|
||||
"${PWD}/$gsl_post" \
|
||||
&& gsl_checker_err=true
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get fields from variable... $1: field | $2: variable
|
||||
#=======================================================================
|
||||
gsl__get_header_field() {
|
||||
awk -F" : " -v f="$1" \
|
||||
'NFS=f {print $NFS}' \
|
||||
<<< "$2"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get HEADER Fields + line nbr $1:marker
|
||||
#=======================================================================
|
||||
gsl__get_header_fields() {
|
||||
gsl_post_hf_1=`gsl__get_header_field 1 "$gsl_header_content_line"`
|
||||
gsl_post_hf_2=`gsl__get_header_field 2 "$gsl_header_content_line"`
|
||||
gsl_post_hf_3=`gsl__get_header_field 3 "$gsl_header_content_line"`
|
||||
gsl_post_hf_l=`gsl__get_line "$1$gsl_post_hf_1" "$gsl_post"`
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check NEEDED Fields from HEADER
|
||||
#=======================================================================
|
||||
gsl__check_header_fields() {
|
||||
if ! [[ "$gsl_post_hf_1" ]] || \
|
||||
! [[ "$gsl_post_hf_2" ]];then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"Line:$gsl_post_hf_l > $3" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check OPTIONAL Field 3 from HEADER
|
||||
#=======================================================================
|
||||
gsl__check_header_field3() {
|
||||
if ! [[ "$gsl_post_hf_3" ]];then
|
||||
case "$3" in
|
||||
"$gsl_marker_image")
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"Line:$gsl_post_hf_l > No ALT TEXT !" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
;;
|
||||
*)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"Line:$gsl_post_hf_l > No Alt Text" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# A very simple debugger that show some values
|
||||
#======================================================================
|
||||
gsl__debug() {
|
||||
printf '\n%s\n%s\n%s\n%s\n' \
|
||||
"D> 1. '$1'" \
|
||||
"D> 2. '$2'" \
|
||||
"D> 3. '$3'" \
|
||||
"D> 4. '$4'"
|
||||
sleep .5
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Basic: create a page/post named $3 from command line with date
|
||||
#======================================================================
|
||||
gsl__create_article() {
|
||||
touch "$PWD/$3.gsl"
|
||||
cat << EONEWP >> "$PWD/$3.gsl"
|
||||
type: $1
|
||||
title:
|
||||
slug:
|
||||
info:
|
||||
author:
|
||||
tags:
|
||||
date: $2
|
||||
|
||||
#1
|
||||
EONEWP
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__version
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib (XMPP: im@echolib.re)
|
||||
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Version checker of GSL with less or more details
|
||||
#======================================================================
|
||||
version__OPTIONS() {
|
||||
case "$1" in
|
||||
-v)
|
||||
awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/$app_name"
|
||||
exit
|
||||
;;
|
||||
|
||||
-vv)
|
||||
v_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/$app_name"`
|
||||
echo -n "# $app_name Current: $v_cur | "
|
||||
if__command curl
|
||||
v_onl=`curl -s "$repo" | awk 'NR==2 {print $3}'`
|
||||
echo -ne "Online: $v_onl\n"
|
||||
exit
|
||||
;;
|
||||
|
||||
--version)
|
||||
awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/$app_name"
|
||||
if__file "$gsl_dir_lib/new-version.md" read
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
}
|
Loading…
Reference in New Issue