Checkers, new tag meta, fix processes...

This commit is contained in:
Cyrille L 2022-02-16 14:11:41 +01:00
parent d552f298fd
commit 393b32485c
11 changed files with 604 additions and 216 deletions

100
README.md
View File

@ -1,4 +1,5 @@
# GSL: Statique Littérateur # GSL: Statique Littérateur
===
GSL is a multiple blogs/websites generator based on their domain, GSL is a multiple blogs/websites generator based on their domain,
written in bash, for minimal dependancies. The websites are nearly all written in bash, for minimal dependancies. The websites are nearly all
@ -6,12 +7,14 @@ static, except for some includes that nginx can easily get, in your
webserver. webserver.
# Dependancies # Dependancies
===
- bash - bash
- coreutils - coreutils
- curl (to check Posts links response) - curl (to check Posts links response)
# GSL: Installation # GSL: Installation
===
To avoid sudo, you should give permissions to USER To avoid sudo, you should give permissions to USER
@ -42,6 +45,8 @@ To avoid sudo, you should give permissions to USER
# How to configure a DOMAIN folder, and create a Post # How to configure a DOMAIN folder, and create a Post
===
## Set a DOMAIN ## Set a DOMAIN
- add a DOMAIN name (if not alrady done) - add a DOMAIN name (if not alrady done)
``` ```
@ -74,6 +79,101 @@ files and folders. You could install lightweight darkhttpd webserver on
your PC to preview the website your PC to preview the website
# Create a Templates # Create a Templates
===
You will have to create some CSS in your /DOMAIN/templates/ You will have to create some CSS in your /DOMAIN/templates/
- HOME: ~/.config/gsl/domains/DOMAIN/templates/ - HOME: ~/.config/gsl/domains/DOMAIN/templates/
- GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/ - GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/
# How to Write a Post
===
Post has 2 sections : Vefore 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.
- After #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 with $ gsl author add)
date: YYYY-MM-DD
tags: TAG1,OTHER TAG2,TAG3 (comma separated)
```
## 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
image: NBR : FILENAME : ALT-TEXT
```
## CONTENT Post:
In Content Post, markers (i.e. [_,_],*_,_*...) 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 )
(
This is a paragraph
)
# Register in Header. link: My Great link : URL : ALT-TEXT
[_My Great Link_]
# Write in ITALIC
/_this em text_/
# Write in STRONG
**_this strong content_**
# BOLD
*_this bold content_*
# Register in Header. file: My Great file : FILENAME : ALT-TEXT
<_My Great file_>
# Inline-code (¤ = alt-gr + $ on FR keyboard)
¤_push()_¤
# Lists
=> list 1
==> sublist 1
===> sub-sublist 1
=> list 2
# Simple Blockquote
---
(
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
)
---
# Register in Header. image: 1 : FILENAME : ALT-TEXT
_image_ : 1
# Block-Code File: Register in Header. code: 1 : FILENAME
_code_ : 1
```

View File

@ -57,7 +57,9 @@ gsl_admin_sep_post='==============='
# Date format # Date format
gsl_test_date='^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]+$' gsl_test_date='^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]+$'
# Logs #-----------------------------------------------------------------------
# Set LOG help Activity for NEEDED HEADERS
#-----------------------------------------------------------------------
gsl_log_act_title='POST TITLE' gsl_log_act_title='POST TITLE'
gsl_log_act_author='REGISTRED NAME' gsl_log_act_author='REGISTRED NAME'
gsl_log_act_date='YYYY-MM-DD' gsl_log_act_date='YYYY-MM-DD'
@ -71,7 +73,16 @@ gsl_log_act_link='NAME : URL : ALT TEXT'
gsl_log_act_file='NAME : FILENAME : ALT TEXT' gsl_log_act_file='NAME : FILENAME : ALT TEXT'
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Set CONTENT POTST markers # Set LOG for CONTENT Process
#-----------------------------------------------------------------------
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_mo_p='('
gsl_mo_link='\[_' gsl_mo_link='\[_'
@ -104,6 +115,9 @@ gsl_mark_blockquote_link='_link :'
gsl_mark_blockquote_book='_book :' gsl_mark_blockquote_book='_book :'
gsl_mark_blockquote_lang='_lang :' gsl_mark_blockquote_lang='_lang :'
#-----------------------------------------------------------------------
# Set for Stats
#-----------------------------------------------------------------------
gsl_o_markers=( gsl_o_markers=(
$gsl_mo_link $gsl_mo_link
$gsl_mo_em $gsl_mo_em
@ -123,12 +137,12 @@ $gsl_mc_file
) )
gsl_i_markers=( gsl_i_markers=(
Link "Content link"
Italic "Content italic"
Strong "Content strong"
Bold "Content bold"
Code "Content code"
File "Content file"
) )
gsl_u_markers=( gsl_u_markers=(
@ -143,16 +157,17 @@ gsl_u_markers=(
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Set HEADERS markers # Set HEADERS markers
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
gsl_marker_ID=';; ID: ' gsl_marker_ID='ID: '
gsl_marker_title=';; title: ' gsl_marker_title='title: '
gsl_marker_slug=';; slug: ' gsl_marker_slug='slug: '
gsl_marker_info=';; info: ' gsl_marker_info='info: '
gsl_marker_author=';; author: ' gsl_marker_author='author: '
gsl_marker_date=';; date: ' gsl_marker_date='date: '
gsl_marker_tags='tags: '
#Optional (include brut text) #Optional (include brut text)
gsl_marker_code=';; code: ' gsl_marker_code='code: '
gsl_marker_image=';; image: ' gsl_marker_image='image: '
gsl_marker_abbr=';; abbr: ' gsl_marker_abbr='abbr: '
gsl_marker_link=';; link: ' gsl_marker_link='link: '
gsl_marker_file=';; file: ' gsl_marker_file='file: '

View File

@ -23,10 +23,9 @@ gsl__create_ff
#======================================================================= #=======================================================================
case "$1" in case "$1" in
author|-A) author|-A)
gsl__find_domain && exit 1 gsl__find_domain
gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1 gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1
echo "# Domain: $gsl_find_domain"
case "$2" in case "$2" in
"") "")
gsl__authors_list gsl__authors_list
@ -86,7 +85,10 @@ case "$1" in
"New Website" \ "New Website" \
"$gsl_dir_scripts/gsl__new_website" "$gsl_dir_scripts/gsl__new_website"
gsl author add [[ -f "$gsl_file_db_domains" ]] && \
[[ -d "$gsl_dir_user_posts" ]] \
&& cd "$gsl_dir_user_posts" \
&& gsl author add
;; ;;
log|-L) log|-L)
@ -121,12 +123,12 @@ case "$1" in
;; ;;
check|-C) check|-C)
gsl__find_domain || exit 1 gsl__find_domain # || exit 1
gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1 gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1
gsl__authors_list check || exit 1 gsl__authors_list check || exit 1
gsl__check_source "$gsl_dir_scripts/gsl__post_manager" || exit 1 gsl__check_source "$gsl_dir_scripts/gsl__post_manager" || exit 1
gsl__check_source "$gsl_dir_scripts/gsl__post_checkers" || exit 1 gsl__check_source "$gsl_dir_scripts/gsl__post_checkers" || exit 1
gsl__check_nbr_posts || exit 1 gsl__check_nbr_posts
gsl__check_source "$gsl_dir_scripts/gsl__db_manager" || exit 1 gsl__check_source "$gsl_dir_scripts/gsl__db_manager" || exit 1
case "$2" in case "$2" in
@ -182,6 +184,10 @@ case "$1" in
gsl__check_file "$gsl_dir_helps/gsl_help_install" || exit 1 gsl__check_file "$gsl_dir_helps/gsl_help_install" || exit 1
cat "$gsl_dir_helps/gsl_help_install" cat "$gsl_dir_helps/gsl_help_install"
;; ;;
write|-w)
gsl__check_file "$gsl_dir_helps/gsl_help_write_post" || exit 1
cat "$gsl_dir_helps/gsl_help_write_post"
;;
esac esac
;; ;;
esac esac

View File

@ -1,4 +1,5 @@
# GSL: Statique Littérateur # GSL: Statique Littérateur
===
GSL is a multiple blogs/websites generator based on their domain, GSL is a multiple blogs/websites generator based on their domain,
written in bash, for minimal dependancies. The websites are nearly all written in bash, for minimal dependancies. The websites are nearly all
@ -6,12 +7,14 @@ static, except for some includes that nginx can easily get, in your
webserver. webserver.
# Dependancies # Dependancies
===
- bash - bash
- coreutils - coreutils
- curl (to check Posts links response) - curl (to check Posts links response)
# GSL: Installation # GSL: Installation
===
To avoid sudo, you should give permissions to USER To avoid sudo, you should give permissions to USER
@ -42,6 +45,8 @@ To avoid sudo, you should give permissions to USER
# How to configure a DOMAIN folder, and create a Post # How to configure a DOMAIN folder, and create a Post
===
## Set a DOMAIN ## Set a DOMAIN
- add a DOMAIN name (if not alrady done) - add a DOMAIN name (if not alrady done)
``` ```
@ -74,6 +79,101 @@ files and folders. You could install lightweight darkhttpd webserver on
your PC to preview the website your PC to preview the website
# Create a Templates # Create a Templates
===
You will have to create some CSS in your /DOMAIN/templates/ You will have to create some CSS in your /DOMAIN/templates/
- HOME: ~/.config/gsl/domains/DOMAIN/templates/ - HOME: ~/.config/gsl/domains/DOMAIN/templates/
- GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/ - GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/
# How to Write a Post
===
Post has 2 sections : Vefore 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.
- After #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 with $ gsl author add)
date: YYYY-MM-DD
tags: TAG1,OTHER TAG2,TAG3 (comma separated)
```
## 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
image: NBR : FILENAME : ALT-TEXT
```
## CONTENT Post:
In Content Post, markers (i.e. [_,_],*_,_*...) 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 )
(
This is a paragraph
)
# Register in Header. link: My Great link : URL : ALT-TEXT
[_My Great Link_]
# Write in ITALIC
/_this em text_/
# Write in STRONG
**_this strong content_**
# BOLD
*_this bold content_*
# Register in Header. file: My Great file : FILENAME : ALT-TEXT
<_My Great file_>
# Inline-code (¤ = alt-gr + $ on FR keyboard)
¤_push()_¤
# Lists
=> list 1
==> sublist 1
===> sub-sublist 1
=> list 2
# Simple Blockquote
---
(
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
)
---
# Register in Header. image: 1 : FILENAME : ALT-TEXT
_image_ : 1
# Block-Code File: Register in Header. code: 1 : FILENAME
_code_ : 1
```

View File

@ -4,6 +4,7 @@ $ gsl [ARG]
readme : Show README.md instructions readme : Show README.md instructions
help | -h [OPT] : This Help. Add FULL [ARG] for specifics help | -h [OPT] : This Help. Add FULL [ARG] for specifics
install : Show process installation install : Show process installation
write | -w : How to write a Post
new | -N : Add and configure a new DOMAIN new | -N : Add and configure a new DOMAIN

View File

@ -0,0 +1,93 @@
# How to Write a Post
Post has 2 sections : Vefore 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.
- After #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 with $ gsl author add)
date: YYYY-MM-DD
tags: TAG1,OTHER TAG2,TAG3 (comma separated)
```
## 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
image: NBR : FILENAME : ALT-TEXT
```
## CONTENT Post:
In Content Post, markers (i.e. [_,_],*_,_*...) 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 )
(
This is a paragraph
)
# Register in Header. link: My Great link : URL : ALT-TEXT
[_My Great Link_]
# Write in ITALIC
/_this em text_/
# Write in STRONG
**_this strong content_**
# BOLD
*_this bold content_*
# Register in Header. file: My Great file : FILENAME : ALT-TEXT
<_My Great file_>
# Inline-code (¤ = alt-gr + $ on FR keyboard)
¤_push()_¤
# Lists
=> list 1
==> sublist 1
===> sub-sublist 1
=> list 2
# Simple Blockquote
---
(
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
)
---
# Register in Header. image: 1 : FILENAME : ALT-TEXT
_image_ : 1
# Block-Code File: Register in Header. code: 1 : FILENAME
_code_ : 1
```

View File

@ -11,8 +11,12 @@ gsl__authors_check() {
gsl_save_dir_ndd=`grep "$gsl_find_domain" "$gsl_file_db_domains"` gsl_save_dir_ndd=`grep "$gsl_find_domain" "$gsl_file_db_domains"`
gsl_file_auth_ndd="$gsl_save_dir_ndd/$gsl_filename_auth" gsl_file_auth_ndd="$gsl_save_dir_ndd/$gsl_filename_auth"
[[ -f "$gsl_file_auth_ndd" ]] \ if [[ -f "$gsl_file_auth_ndd" ]];then
&& return [[ -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" touch "$gsl_file_auth_ndd"
} }
@ -21,19 +25,18 @@ touch "$gsl_file_auth_ndd"
# List Authors from DOMAIN # List Authors from DOMAIN
#======================================================================= #=======================================================================
gsl__authors_list() { gsl__authors_list() {
gsl__authors_check
! [[ -z `grep '[^[:space:]]' "$gsl_file_auth_ndd"` ]] \
&& gsl_authors=true \
&& return
echo "! No Registred authors yet..."
case "$1" in case "$1" in
check) check)
[[ $gsl_authors ]] && return gsl__authors_check || return
return return
;; ;;
add)
gsl__authors_check || return
;;
remove)
gsl__authors_check || return
;;
esac esac
echo -e "\n# Authors Registred:" echo -e "\n# Authors Registred:"
@ -47,8 +50,7 @@ done < <(cat -n "$gsl_file_auth_ndd")
# Add Author(s) for DOMAIN to authors.db in Profile User # Add Author(s) for DOMAIN to authors.db in Profile User
#======================================================================= #=======================================================================
gsl__authors_add() { gsl__authors_add() {
gsl__authors_check gsl__authors_list add
gsl__authors_list
printf '\n%s\n%s\n%s\n \n' \ printf '\n%s\n%s\n%s\n \n' \
"# You can add one or more Authors" \ "# You can add one or more Authors" \
@ -77,8 +79,7 @@ gsl__authors_list
# Remove Author(s) for DOMAIN from authors.db in Profile User # Remove Author(s) for DOMAIN from authors.db in Profile User
#======================================================================= #=======================================================================
gsl__authors_remove() { gsl__authors_remove() {
gsl__authors_check gsl__authors_list remove || exit 1
gsl__authors_list
printf '\n%s\n%s\n%s\n \n' \ printf '\n%s\n%s\n%s\n \n' \
"# You can REMOVE one or more Authors" \ "# You can REMOVE one or more Authors" \

View File

@ -23,34 +23,35 @@ printf '\n%s\n%s\n%s\n' \
#======================================================================= #=======================================================================
# Webserver URI # Webserver URI
#======================================================================= #=======================================================================
echo -e "\n# Webserver: /var/www ! NO ending / (Or maybe elsewhere...)" echo -e "\n# Webserver: /var/www (Or maybe elsewhere...)"
read -erp \ read -erp \
": Webserver URI ? " \ ": Webserver URI ? " \
gsl_set_server gsl_set_server
gsl__check_settings $gsl_set_server \ [[ ${gsl_set_server: -1} == "/" ]] \
&& [[ "$gsl_process_stop" ]] \ && gsl_set_server=${gsl_set_server::-1}
&& return
gsl__check_settings $gsl_set_server || return
#======================================================================= #=======================================================================
# Domain URL # Domain URL
#======================================================================= #=======================================================================
printf '\n%s %s\n' \ printf '\n%s\n %s\n' \
"# URL: www.example.com !NO ending /" \ "# URL: www.example.com" \
"(https:// will be added if missing or force with http://)" "(https:// will be added if missing or force with http://)"
read -rp \ read -rp \
": Website URL ? " \ ": Website URL ? " \
gsl_set_url gsl_set_url
gsl__check_settings $gsl_set_url \ [[ ${gsl_set_url: -1} == "/" ]] \
&& [[ "$gsl_process_stop" ]] \ && gsl_set_url=${gsl_set_url::-1}
&& return
gsl__check_settings $gsl_set_url || return
gsl_https='https://' gsl_https='https://'
case "$gsl_set_url" in case "$gsl_set_url" in
"https://"*) "https://"*)
gsl_set_ndd=${gsl_set_url/$gsl_https/} gsl_set_ndd=${gsl_set_url/$gsl_https/}
echo "D> Case: $gsl_set_ndd"
;; ;;
"http://"*) "http://"*)
gsl_http="http://" gsl_http="http://"
@ -67,13 +68,32 @@ esac
gsl_set_ndd=`awk -F"." '{print $(NF-1)"."$NF}' <<< $gsl_set_ndd` gsl_set_ndd=`awk -F"." '{print $(NF-1)"."$NF}' <<< $gsl_set_ndd`
gsl_set_file_ndd="$gsl_set_ndd.conf" gsl_set_file_ndd="$gsl_set_ndd.conf"
[[ -d "$gsl_dir_user_domains/$gsl_set_ndd" ]] \
&& gsl_profile="HOME: $gsl_dir_user_domains/$gsl_set_ndd" \
&& gsl_set_user_conf="Y"
[[ -d "$gsl_dir_global_domains/$gsl_set_ndd" ]] \
&& gsl_profile="System: $gsl_dir_global_domains/$gsl_set_ndd" \
&& gsl_set_user_conf="N"
if [[ "$gsl_profile" ]];then
echo "! A Profile exists in your $gsl_profile"
read -rp ": Continue (Y|*)" gsl_continue
case "$gsl_continue" in
Y|y) true ;;
*) gsl__check_settings $blank || return
esac
fi
#======================================================================= #=======================================================================
# Personal use or global use ? # Personal use or global use ?
#======================================================================= #=======================================================================
echo -e "\n# Save Domain in Home or Global" if ! [[ "$gsl_set_user_conf" ]];then
read -rp \ echo -e "\n# Save Domain in Home or Global"
": Home Use (y/n) ? " \ read -rp \
gsl_set_user_conf ": Home Use (y/n) ? " \
gsl_set_user_conf
fi
case "$gsl_set_user_conf" in case "$gsl_set_user_conf" in
y|Y) y|Y)
gsl_save_dir_ndd="$gsl_dir_user_domains/$gsl_set_ndd" gsl_save_dir_ndd="$gsl_dir_user_domains/$gsl_set_ndd"
@ -96,9 +116,7 @@ read -rp \
": Website Title ? " \ ": Website Title ? " \
gsl_set_title gsl_set_title
gsl__check_settings $gsl_set_title \ gsl__check_settings $gsl_set_title || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# Website Description # Website Description
@ -107,9 +125,8 @@ echo -e "\n# Description: writings about this website"
read -rp \ read -rp \
": Website Description ? " \ ": Website Description ? " \
gsl_set_about gsl_set_about
gsl__check_settings $gsl_set_about\
&& [[ "$gsl_process_stop" ]] \ gsl__check_settings $gsl_set_about || return
&& return
#======================================================================= #=======================================================================
# Contact Mail # Contact Mail
@ -119,21 +136,17 @@ read -rp \
": Contact Mail ? " \ ": Contact Mail ? " \
gsl_set_mail gsl_set_mail
gsl__check_settings $gsl_set_mail \ gsl__check_settings $gsl_set_mail || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# Website Keywords # Website Keywords
#======================================================================= #=======================================================================
echo -e "\n# Keywords: geek,logiciels libre,friends (comma separated)" echo -e "\n# GENERIC pages Keywords: geek stuff,free (comma separated)"
read -rp \ read -rp \
": Website Keywords ? " \ ": Website Keywords for all Pages ? " \
gsl_set_keys gsl_set_keys
gsl__check_settings $gsl_set_keys \ gsl__check_settings $gsl_set_keys || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# Language # Language
@ -143,9 +156,7 @@ read -rp \
": Website Lang ? " \ ": Website Lang ? " \
gsl_set_lang gsl_set_lang
gsl__check_settings $gsl_set_lang \ gsl__check_settings $gsl_set_lang || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# Copyright # Copyright
@ -155,57 +166,58 @@ read -rp \
": Website Copyright ? " \ ": Website Copyright ? " \
gsl_set_cr gsl_set_cr
gsl__check_settings $gsl_set_cr \ gsl__check_settings $gsl_set_cr || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# Website Logo # Website Logo
#======================================================================= #=======================================================================
printf '\n%s %s\n' \ printf '\n%s\n %s\n' \
"# logo: my-logo.png" \ "# logo: my-logo.png" \
"(Put it in $gsl_save_dir_ndd/templates/)" "(Put it in $gsl_save_dir_ndd/templates/)"
read -rp \ read -rp \
": Website logo file NAME ? " \ ": Website logo file NAME ? " \
gsl_set_logo gsl_set_logo
gsl__check_settings $gsl_set_logo \ gsl__check_settings $gsl_set_logo || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# CSS Acronym # CSS Acronym
#======================================================================= #=======================================================================
printf '\n%s %s\n' \ printf '\n%s\n %s\n' \
"# CSS (short) Acronym: myweb !No need to end with _" \ "# CSS (short) Acronym: myweb !No need to end with _" \
"(Will create specific classes like myweb_paragraph)" "(Will create specific classes like myweb_paragraph)"
read -rp \ read -rp \
": CSS Acronym ? " \ ": CSS Acronym ? " \
gsl_set_css gsl_set_css
gsl__check_settings $gsl_set_css \ gsl__check_settings $gsl_set_css || return
&& [[ "$gsl_process_stop" ]] \
&& return
#======================================================================= #=======================================================================
# Author Reference # Author Reference
#======================================================================= #=======================================================================
printf '\n%s %s\n' \ printf '\n%s\n %s\n' \
"# Author URL Profile: https://..." \ "# Author/Compagny URL Profile: https://..." \
"(Used for meta rel='me')" "(Used for meta rel='me')"
read -rp \ read -rp \
": Author URL Profile ? " \ ": Author URL Profile ? " \
gsl_set_auth_url gsl_set_auth_url
gsl__check_settings $gsl_set_auth_url \ gsl__check_settings $gsl_set_auth_url || return
&& [[ "$gsl_process_stop" ]] \
&& return #=======================================================================
# Folder for Posts
#=======================================================================
printf '\n%s\n %s\n %s\n' \
"# You can set here a folder for your writings' Posts"
"or manually do it later or add another one later"
"Autocompletion /NEWFOLDER (name of choice)"
read -erp ": Where will you add your files' Post ? " gsl_dir_user_posts
#======================================================================= #=======================================================================
# Show Resume # Show Resume
#======================================================================= #=======================================================================
clear 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' \ 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' \
"# New Website configurations..." \ "# New Website configurations..." \
": Webserver|$gsl_set_server" \ ": Webserver|$gsl_set_server" \
": URL|$gsl_set_url" \ ": URL|$gsl_set_url" \
@ -219,6 +231,7 @@ 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' \
": Logo File|$gsl_set_logo" \ ": Logo File|$gsl_set_logo" \
": CSS Acro|$gsl_set_css" \ ": CSS Acro|$gsl_set_css" \
": Author URL|$gsl_set_auth_url" \ ": Author URL|$gsl_set_auth_url" \
": User folder writings' Posts|$gsl_dir_user_posts"
| column -t -s'|' | column -t -s'|'
#======================================================================= #=======================================================================
@ -269,19 +282,36 @@ fi
&& read -rp "$gsl_ask ?" gsl_set_confirm && read -rp "$gsl_ask ?" gsl_set_confirm
case "$gsl_set_confirm" in case "$gsl_set_confirm" in
y|Y) y|Y)
! [[ -d "$gsl_save_dir_ndd/templates" ]] \ if ! [[ -d "$gsl_save_dir_ndd" ]];then
&& mkdir -p "$gsl_save_dir_ndd/templates" \ mkdir -p "$gsl_save_dir_ndd" && \
&& gsl__logs_print \ gsl__logs_print \
"$gsl_log_i" \ "$gsl_log_i" \
"Create" \ "Create" \
"Folder" \ "Folder" \
"Configuration from $gsl_set_ndd" \ "Configuration from $gsl_set_ndd" \
"$gsl_save_dir_ndd/templates" "$gsl_save_dir_ndd/"
;;
*) mkdir -p "$gsl_dir_user_posts" && \
gsl__new_website && return gsl__logs_print \
;; "$gsl_log_i" \
"Create" \
"Folder" \
"User Posts from $gsl_set_ndd" \
"$gsl_dir_user_posts/"
touch "$gsl_dir_user_posts/gsl.$gsl_set_ndd" && \
gsl__logs_print \
"$gsl_log_i" \
"Create" \
"File" \
"gsl.$gsl_set_ndd" \
"$gsl_dir_user_posts/"
fi
;;
*)
gsl__new_website && return
;;
esac esac
#======================================================================= #=======================================================================
@ -317,11 +347,7 @@ fi
# Check if no Response from $@ # Check if no Response from $@
#======================================================================= #=======================================================================
gsl__check_settings() { gsl__check_settings() {
case "$@" in [[ "$@" ]] && return
"") echo "! Abandon... Maybe next time"
gsl_process_stop=true return
echo "! Abandon... Maybe next time"
return
;;
esac
} }

View File

@ -11,10 +11,10 @@ gsl__post_all_checkers() {
clear clear
unset gsl_check_done unset gsl_check_done
echo -ne "\r\033[2K: Searching for #1..."
gsl__post_check_h1 || return
echo -n ": Searching for NEEDED HEADERS..." echo -n ": Searching for NEEDED HEADERS..."
gsl__post_check_needed_headers gsl__post_check_needed_headers
echo -ne "\r\033[2K: Searching for #1..."
gsl__post_check_h1
echo -ne "\r\033[2K: Searching for PARAGRAPHS" echo -ne "\r\033[2K: Searching for PARAGRAPHS"
gsl__post_check_paragraphs gsl__post_check_paragraphs
echo -ne "\r\033[2K: Searching for Content MARKERS..." echo -ne "\r\033[2K: Searching for Content MARKERS..."
@ -29,6 +29,8 @@ echo -ne "\r\033[2K: Searching for FILES..."
gsl__post_check_files gsl__post_check_files
echo -ne "\r\033[2K: Searching for IMAGES..." echo -ne "\r\033[2K: Searching for IMAGES..."
gsl__post_check_images gsl__post_check_images
echo -ne "\r\033[2K: Searching for BLOCK-CODES..."
gsl__post_check_bcodes
echo -ne "\r\033[2K" echo -ne "\r\033[2K"
@ -49,61 +51,48 @@ gsl__post_check_needed_headers() {
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Title # Title
gsl_header_title=`gsl__get_header "$gsl_marker_title" "$gsl_post"` gsl_header_title=`gsl__get_header "$gsl_marker_title" "$gsl_post"`
! [[ "$gsl_header_title" ]] \ gsl__check_needed_headers \
&& gsl__logs_print \ "$gsl_header_title" \
"$gsl_log_e" \ "$gsl_marker_title" \
"Title" \ "POST TITLE"
"Post" \
"Missing" \
"${PWD}/$gsl_post" \
&& gsl_checker_err=true
# Slug # Slug
gsl_header_slug=`gsl__get_header "$gsl_marker_slug" "$gsl_post"` gsl_header_slug=`gsl__get_header "$gsl_marker_slug" "$gsl_post"`
! [[ "$gsl_header_slug" ]] \ gsl__check_needed_headers \
&& gsl__logs_print \ "$gsl_header_slug" \
"$gsl_log_e" \ "$gsl_marker_slug" \
"Slug" \ "POST-TITLE" \
"Post" \
"Missing" \
"${PWD}/$gsl_post" \
&& gsl_checker_err=true \
&& gsl_slug_err=true && gsl_slug_err=true
# Author # Author
gsl_header_author=`gsl__get_header "$gsl_marker_author" "$gsl_post"` gsl_header_author=`gsl__get_header "$gsl_marker_author" "$gsl_post"`
! [[ "$gsl_header_author" ]] \ gsl__check_needed_headers \
&& gsl__logs_print \ "$gsl_header_author" \
"$gsl_log_e" \ "$gsl_marker_author" \
"Author" \ "REGISTRED NAME" \
"Post" \
"Missing" \
"${PWD}/$gsl_post" \
&& gsl_checker_err=true \
&& gsl_author_err=true && gsl_author_err=true
# Date # Date
gsl_header_date=`gsl__get_header "$gsl_marker_date" "$gsl_post"` gsl_header_date=`gsl__get_header "$gsl_marker_date" "$gsl_post"`
! [[ "$gsl_header_date" ]] \ gsl__check_needed_headers \
&& gsl__logs_print \ "$gsl_header_date" \
"$gsl_log_e" \ "$gsl_marker_date" \
"Date" \ "YYYY-MM-DD" \
"Post" \
"Missing" \
"${PWD}/$gsl_post" \
&& gsl_checker_err=true \
&& gsl_date_err=true && gsl_date_err=true
# Description # Description
gsl_header_info=`gsl__get_header "$gsl_marker_info" "$gsl_post"` gsl_header_info=`gsl__get_header "$gsl_marker_info" "$gsl_post"`
! [[ "$gsl_header_info" ]] \ gsl__check_needed_headers \
&& gsl__logs_print \ "$gsl_header_info" \
"$gsl_log_e" \ "$gsl_marker_info" \
"Infos" \ "DESCRIPTION"
"Post" \
"Missing" \ # Tags
"${PWD}/$gsl_post" \ gsl_header_tags=`gsl__get_header "$gsl_marker_tags" "$gsl_post"`
&& gsl_checker_err=true gsl__check_needed_headers \
"$gsl_header_tags" \
"$gsl_marker_tags" \
"TAG1,OTHER TAG2,TAG3"
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
# Check for VALID Content HEADERS # Check for VALID Content HEADERS
@ -114,8 +103,8 @@ if ! [[ "$gsl_author_err" ]] && \
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Author" \
"Post" \ "Post" \
"Header $gsl_marker_author" \
"$gsl_header_author not registred for domain $gsl_find_domain" \ "$gsl_header_author not registred for domain $gsl_find_domain" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
@ -127,8 +116,8 @@ if ! [[ "$gsl_date_err" ]] && \
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Date" \
"Post" \ "Post" \
"Header $gsl_marker_date" \
"$gsl_header_date not YYYY-MM-DD" \ "$gsl_header_date not YYYY-MM-DD" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
@ -141,12 +130,12 @@ if ! [[ "$gsl_slug_err" ]];then
if ! [[ "$gsl_header_slug" == "$gsl_header_slug_test" ]];then if ! [[ "$gsl_header_slug" == "$gsl_header_slug_test" ]];then
gsl_new_header_slug="$gsl_marker_slug$gsl_header_slug_test" gsl_new_header_slug="$gsl_marker_slug$gsl_header_slug_test"
sed -i \ sed -i \
"s|$gsl_marker_slug$gsl_header_slug|$gsl_new_header_slug" \ "s|$gsl_marker_slug$gsl_header_slug|$gsl_new_header_slug|" \
"$gsl_post" && \ "$gsl_post" && \
gsl__logs_print \ gsl__logs_print \
"$gsl_log_w" \ "$gsl_log_w" \
"Slug" \
"Post" \ "Post" \
"Header $gsl_marker_slug" \
"Changed: $gsl_header_slug_test" \ "Changed: $gsl_header_slug_test" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
@ -168,9 +157,9 @@ grep -n "#1" $gsl_post \
if ! [[ "$gsl_post_begin" ]];then if ! [[ "$gsl_post_begin" ]];then
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Begin" \
"Post" \ "Post" \
"Missing content: #1 TITLE" \ "Content begin" \
"Missing: #1 TITLE" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
fi fi
@ -197,8 +186,8 @@ awk -v line="$gsl_post_begin" \
if (( "$gsl_post_p_open_nbr" == 0 ));then if (( "$gsl_post_p_open_nbr" == 0 ));then
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Paragraph" \
"Post" \ "Post" \
"Content paragraphs" \
"Missing content: ( and ) at begining lines" \ "Missing content: ( and ) at begining lines" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
@ -210,8 +199,8 @@ if (( "$gsl_post_p_open_nbr" == "$gsl_post_p_close_nbr" ));then
else else
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Paragraph" \
"Post" \ "Post" \
"Content paragraphs" \
"Mismatch: (=$gsl_post_p_open_nbr ; )=$gsl_post_p_close_nbr" \ "Mismatch: (=$gsl_post_p_open_nbr ; )=$gsl_post_p_close_nbr" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
@ -311,7 +300,7 @@ if [[ "$gsl_post_blockquotes_nbr_r" -eq 0 ]];then
gsl__logs_print \ gsl__logs_print \
"$gsl_log_i" \ "$gsl_log_i" \
"Post" \ "Post" \
"Blockquotes" \ "Content citations" \
"NBR=$gsl_post_stat_bq > $gsl_mark_blockquote (2x)" \ "NBR=$gsl_post_stat_bq > $gsl_mark_blockquote (2x)" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
fi fi
@ -327,7 +316,7 @@ do
# Get & Check HEADER CONTENT # Get & Check HEADER CONTENT
gsl__get_header_fields "$gsl_marker_abbr" gsl__get_header_fields "$gsl_marker_abbr"
gsl__check_header_fields "Post" "ABBR" "$gsl_log_act_abbr" \ gsl__check_header_fields "Post" "Header $gsl_marker_abbr" "$gsl_log_act_abbr" \
|| continue || continue
# Check POST CONTENT # Check POST CONTENT
@ -341,8 +330,8 @@ do
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Post" \ "Post" \
"ABBR" \ "$gsl_log_c_abbr" \
"Missing Content: $gsl_post_header_field_1" \ "Missing: $gsl_post_header_field_1" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
@ -351,7 +340,7 @@ done < <(gsl__get_header "$gsl_marker_abbr" "$gsl_post")
gsl__logs_print \ gsl__logs_print \
"$gsl_log_i" \ "$gsl_log_i" \
"Post" \ "Post" \
"ABBR" \ "Header $gsl_marker_abbr" \
"NBR=$gsl_post_stat_abbr" \ "NBR=$gsl_post_stat_abbr" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
} }
@ -365,11 +354,11 @@ while read -r "gsl_header_content_line"
do do
# Get & Check Header CONTENT # Get & Check Header CONTENT
gsl__get_header_fields "$gsl_marker_link" gsl__get_header_fields "$gsl_marker_link"
gsl__check_header_fields "Post" "Link" "$gsl_log_act_link" \ gsl__check_header_fields "Post" "Header $gsl_marker_link" "$gsl_log_act_link" \
|| continue || continue
# Not ALT TEXT ? # Not ALT TEXT ?
gsl__check_header_field3 "Post" "Link" gsl__check_header_field3 "Post" "Header $gsl_marker_link"
# Find if ref is in CONTENT # Find if ref is in CONTENT
[[ `gsl__get_content_with_markers "$gsl_mo_link" "$gsl_mc_link"` ]] \ [[ `gsl__get_content_with_markers "$gsl_mo_link" "$gsl_mc_link"` ]] \
@ -384,7 +373,7 @@ do
|| gsl__logs_print \ || gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Post" \ "Post" \
"Link" \ "Header $gsl_marker_link" \
"URL offline: $gsl_post_header_field_2" \ "URL offline: $gsl_post_header_field_2" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
@ -392,8 +381,8 @@ do
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Post" \ "Post" \
"Link" \ "$gsl_log_c_link" \
"Missing Content: [_${gsl_post_header_field_1}_]" \ "Missing: [_${gsl_post_header_field_1}_]" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
@ -410,36 +399,79 @@ do
# Get & Check Header CONTENT # Get & Check Header CONTENT
gsl__get_header_fields "$gsl_marker_file" gsl__get_header_fields "$gsl_marker_file"
gsl__check_header_fields "Post" "File" "$gsl_log_act_file" \ gsl__check_header_fields "Post" "Header $gsl_marker_file" "$gsl_log_act_file" \
|| continue || continue
# Not ALT TEXT ? # Not ALT TEXT ?
gsl__check_header_field3 "Post" "File" gsl__check_header_field3 "Post" "Header $gsl_marker_file"
if ! [[ -f "$gsl_dir_domain_files/$gsl_post_header_field_2" ]];then
gsl__logs_print \
"$gsl_log_e" \
"Post" \
"Header $gsl_marker_file" \
"Not found: $gsl_post_header_field_2" \
"$gsl_dir_domain_files/$gsl_post_header_field_2"
gsl_checker_err=true
fi
# Find if ref is in CONTENT # Find if ref is in CONTENT
[[ `gsl__get_content_with_markers "$gsl_mo_file" "$gsl_mc_file"` ]] \ [[ `gsl__get_content_with_markers "$gsl_mo_file" "$gsl_mc_file"` ]] \
&& gsl_post_stat_file=$(( $gsl_post_stat_file + 1 )) \ && gsl_post_stat_file=$(( $gsl_post_stat_file + 1 )) \
&& continue && continue
[[ -f "$gsl_dir_domain_files/$gsl_post_header_field_2" ]] \ # Missing CONTENT
&& continue \ gsl__logs_print \
|| gsl__logs_print \ "$gsl_log_e" \
"$gsl_log_e" \ "Post" \
"Post" \ "$gsl_log_c_file" \
"File" \ "Missing: <_${gsl_post_header_field_1}_>" \
"Not found: $gsl_post_header_field_2" \ "${PWD}/$gsl_post"
"$gsl_dir_domain_files/$gsl_post_header_field_2" gsl_checker_err=true
done < <(gsl__get_header "$gsl_marker_file" "$gsl_post")
}
#=======================================================================
# Check Post for CODES HEADER + Content
#=======================================================================
gsl__post_check_bcodes() {
gsl_post_stat_bcode=0
while read -r "gsl_header_content_line"
do
# Get & Check Header CONTENT
gsl__get_header_fields "$gsl_marker_code"
gsl__check_header_fields "Post" "Header $gsl_marker_code" "$gsl_log_act_code" \
|| continue
if ! [[ -f "$gsl_dir_domain_files/$gsl_post_header_field_2" ]];then
gsl__logs_print \
"$gsl_log_e" \
"Post" \
"Header $gsl_marker_code" \
"Not found: $gsl_post_header_field_2" \
"$gsl_dir_domain_files/$gsl_post_header_field_2"
gsl_checker_err=true
fi
# Find if ref is in CONTENT
[[ `gsl__get_content_line \
"$gsl_mark_code : $gsl_post_header_field_1" \
"$gsl_post"` ]] \
&& gsl_post_stat_bcode=$(( $gsl_post_stat_bocde + 1 )) \
&& continue
# Missing CONTENT # Missing CONTENT
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Post" \ "Post" \
"File" \ "$gsl_log_c_code" \
"Missing Content: <_${gsl_post_header_field_1}_>" \ "Missing: $gsl_mark_code : ${gsl_post_header_field_1}" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true
done < <(gsl__get_header "$gsl_marker_file" "$gsl_post") done < <(gsl__get_header "$gsl_marker_code" "$gsl_post")
} }
#======================================================================= #=======================================================================
@ -452,11 +484,21 @@ do
# Get & Check Header CONTENT # Get & Check Header CONTENT
gsl__get_header_fields "$gsl_marker_image" gsl__get_header_fields "$gsl_marker_image"
gsl__check_header_fields "Post" "Image" "$gsl_log_act_image" \ gsl__check_header_fields "Post" "Header $gsl_marker_image" "$gsl_log_act_image" \
|| continue || continue
# Not ALT TEXT ? # Not ALT TEXT ?
gsl__check_header_field3 "Post" "Image" gsl__check_header_field3 "Post" "Header $gsl_marker_image"
if ! [[ -f "$gsl_dir_domain_files/$gsl_post_header_field_2" ]];then
gsl__logs_print \
"$gsl_log_e" \
"Post" \
"Header $gsl_marker_image" \
"Not found: $gsl_post_header_field_2" \
"$gsl_dir_domain_files/$gsl_post_header_field_2"
gsl_checker_err=true
fi
# Find if ref is in CONTENT # Find if ref is in CONTENT
[[ `gsl__get_content_line \ [[ `gsl__get_content_line \
@ -465,21 +507,12 @@ do
&& gsl_post_stat_image=$(( $gsl_post_stat_image + 1 )) \ && gsl_post_stat_image=$(( $gsl_post_stat_image + 1 )) \
&& continue && continue
[[ -f "$gsl_dir_domain_files/$gsl_post_header_field_2" ]] \
&& continue \
|| gsl__logs_print \
"$gsl_log_e" \
"Post" \
"image" \
"Not found: $gsl_post_header_field_2" \
"$gsl_dir_domain_files/$gsl_post_header_field_2"
# Missing CONTENT # Missing CONTENT
gsl__logs_print \ gsl__logs_print \
"$gsl_log_e" \ "$gsl_log_e" \
"Post" \ "Post" \
"Image" \ "$gsl_log_c_image" \
"Missing Content: _image_ : ${gsl_post_header_field_1}" \ "Missing: $gsl_mark_image : ${gsl_post_header_field_1}" \
"${PWD}/$gsl_post" "${PWD}/$gsl_post"
gsl_checker_err=true gsl_checker_err=true

View File

@ -10,10 +10,9 @@
gsl__check_nbr_posts() { gsl__check_nbr_posts() {
gsl_nbr_posts=`ls -1 *.gsl 2>/dev/null | wc -l` gsl_nbr_posts=`ls -1 *.gsl 2>/dev/null | wc -l`
(( $gsl_nbr_posts >= 1 )) \ ! (( $gsl_nbr_posts >= 1 )) \
&& return && echo "! No Posts found with .gsl extension" \
&& exit 1
echo "! No Posts found with .gsl extension"
} }
#======================================================================= #=======================================================================
@ -117,9 +116,11 @@ awk -v s="$1" \
# Get everything after the marker... $1: marker | $2: File # Get everything after the marker... $1: marker | $2: File
#======================================================================= #=======================================================================
gsl__get_header() { gsl__get_header() {
awk -F"$1" -v marker="$1" \ awk -F"$1" -v marker="$1" -v l="$gsl_post_begin" \
'{if ($0 ~ marker) print $2}' \ 'NR < l && $0 ~ marker {print $2}' \
"$2" 2>/dev/null "$2" 2>/dev/null
# '{if ($0 ~ marker) print $2}' \
} }
#======================================================================= #=======================================================================
@ -182,6 +183,21 @@ elif [[ "$ivar" ]];then
fi fi
} }
#=======================================================================
# Check & get NEEDED HEADERS | $1 VAR CONTENT $2 LOG Proc $3 LOG Act
#=======================================================================
gsl__check_needed_headers() {
! [[ "$1" ]] \
&& gsl__logs_print \
"$gsl_log_e" \
"Post" \
"Header $2" \
"Missing: POST TITLE" \
"${PWD}/$gsl_post" \
&& gsl_checker_err=true
}
#======================================================================= #=======================================================================
# Get Fields and line nbr from header from marker # Get Fields and line nbr from header from marker
#======================================================================= #=======================================================================

View File

@ -60,26 +60,23 @@ find . -maxdepth 1 -not -type d -type f \
-iname "gsl.*.*" 2>/dev/null \ -iname "gsl.*.*" 2>/dev/null \
| wc -l` | wc -l`
if (( $gsl_nbr_domains > 1 ));then (( $gsl_nbr_domains > 1 )) \
echo "! Too much domains registred here: Set only One per folder" && echo "! Too much domains registred here: Set only One per folder" \
return && exit $gsl_nbr_domains
elif (( $gsl_nbr_domains == 0 ));then (( $gsl_nbr_domains == 0 )) \
echo "! No registred domain here: change or set folder. See help new" && echo "! No registred domain here: change or set folder. See help new" \
return && exit 1
fi
gsl_find_domain=` gsl_find_domain=`
find . -maxdepth 1 -not -type d -type f \ find . -maxdepth 1 -not -type d -type f \
-iname "gsl.*.*" 2>/dev/null` -iname "gsl.*.*" 2>/dev/null`
if [[ "$gsl_find_domain" ]];then gsl_find_domain=`
gsl_find_domain=` awk -F"." '{print $(NF-1)"."$NF}' \
awk -F"." '{print $(NF-1)"."$NF}' \ <<< $gsl_find_domain`
<<< $gsl_find_domain`
gsl_find_domain=${gsl_find_domain,,} gsl_find_domain=${gsl_find_domain,,}
gsl__check_domain "$gsl_find_domain" || return gsl__check_domain "$gsl_find_domain"
fi
} }
#======================================================================= #=======================================================================
@ -90,7 +87,7 @@ gsl_this_conf_domain=`grep "$1" "$gsl_file_db_domains"`
! [[ "$gsl_this_conf_domain" ]] \ ! [[ "$gsl_this_conf_domain" ]] \
&& echo "! Domain Not found: $1" \ && echo "! Domain Not found: $1" \
&& return && exit 1
gsl_dir_domain_tpl="$gsl_this_conf_domain/templates" gsl_dir_domain_tpl="$gsl_this_conf_domain/templates"
gsl_dir_domain_files="$gsl_this_conf_domain/files" gsl_dir_domain_files="$gsl_this_conf_domain/files"