updated, not finished...
This commit is contained in:
parent
ee739a738e
commit
e5e63b7ee4
204
README.md
204
README.md
|
@ -1,204 +0,0 @@
|
|||
# GSL: Statique Littérateur
|
||||
------------------------------------------------------------------------
|
||||
|
||||
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.
|
||||
|
||||
# Dependancies
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- bash
|
||||
- coreutils
|
||||
- curl (to check Posts links response)
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# How to configure a DOMAIN folder, and create a Post
|
||||
------------------------------------------------------------------------
|
||||
|
||||
## Set a DOMAIN
|
||||
- add a DOMAIN name (if not alrady done)
|
||||
```
|
||||
gsl new
|
||||
```
|
||||
|
||||
Follow instructions when adding DOMAIN or see them again with
|
||||
```
|
||||
gsl help new
|
||||
gsl help install
|
||||
```
|
||||
|
||||
## Set a DOMAIN folder
|
||||
if not already done:
|
||||
- GSl will ask you to create a folder for your DOMAIN posts when adding a new domain
|
||||
- Add/Create or go into your folder of choice
|
||||
- Save into that folder a blank file named gsl.DOMAIN (gsl.example.org)
|
||||
to tell GSL, this folder is for this DOMAIN website.
|
||||
|
||||
## Create a new Post
|
||||
- Write a post in a file, using some "metas" that GSL will catch.
|
||||
The engine is written from scratch and looks like a mix of markdown and
|
||||
ReStructuredText. It's very easy to learn and use.
|
||||
- Save your file with .gsl extension
|
||||
- Start checking it, using:
|
||||
|
||||
```
|
||||
gsl check
|
||||
```
|
||||
|
||||
If your Post has no error, you will have some ready to deploy html
|
||||
files and folders. You could install lightweight darkhttpd webserver on
|
||||
your PC to preview the website, or even, juste open index.html in your
|
||||
server folder.
|
||||
|
||||
# Create a Templates
|
||||
------------------------------------------------------------------------
|
||||
|
||||
You will have to create some CSS in your /DOMAIN/templates/
|
||||
- HOME: ~/.config/gsl/domains/DOMAIN/templates/
|
||||
- GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/
|
||||
|
||||
# How to Write a Post
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Post has 2 sections : Before and after "#1". "#1" is the FIRST
|
||||
Title of your post. Number (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)
|
||||
```
|
||||
|
||||
### 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
|
||||
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
|
||||
```
|
|
@ -48,10 +48,6 @@ gsl_log_e='Err'
|
|||
gsl_log_w='War'
|
||||
gsl_log_i='Inf'
|
||||
|
||||
|
||||
# Admin show
|
||||
gsl_admin_sep_post='==============='
|
||||
|
||||
# Date format
|
||||
gsl_test_date='^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]+$'
|
||||
|
||||
|
@ -63,21 +59,31 @@ gsl_log_act_author='REGISTRED NAME'
|
|||
gsl_log_act_date='YYYY-MM-DD'
|
||||
gsl_log_act_info='POST is ABOUT...'
|
||||
gsl_log_act_slug='POST-TITLE'
|
||||
gsl_log_act_code='NBR : FILENAME'
|
||||
gsl_log_act_code='NBR : FILENAME : Alt Text'
|
||||
gsl_log_act_image='NBR : NAME : 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'
|
||||
gsl_log_act_file='NAME : FILENAME : Alt Text'
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Set LOG for CONTENT Process
|
||||
# Set LOG for Process Type
|
||||
#-----------------------------------------------------------------------
|
||||
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"
|
||||
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
|
||||
|
@ -101,10 +107,7 @@ gsl_mc_file='_>'
|
|||
gsl_mark_image='_image_'
|
||||
gsl_mark_code='_code_'
|
||||
gsl_mark_title='#'
|
||||
gsl_mark_hr='==='
|
||||
gsl_mark_list1='=> '
|
||||
gsl_mark_list2='==> '
|
||||
gsl_mark_list3='===> '
|
||||
gsl_mark_list='='
|
||||
|
||||
gsl_mark_blockquote='---'
|
||||
gsl_mark_blockquote_cite='_cite :'
|
||||
|
|
|
@ -18,14 +18,23 @@ gsl__check_source "$gsl_dir_scripts/gsl__log_manager" || exit 1
|
|||
# Check/Create Files and Folders
|
||||
gsl__create_ff
|
||||
|
||||
gsl__find_domain
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1
|
||||
gsl__authors_list check || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__new_website" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__post_checkers" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__post_manager" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__db_manager" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__post_makers" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__page_creator" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__do_commons" || exit 1
|
||||
|
||||
#=======================================================================
|
||||
# Main
|
||||
#=======================================================================
|
||||
case "$1" in
|
||||
author|-A)
|
||||
gsl__find_domain
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || exit 1
|
||||
|
||||
gsl__authors_list check || exit 1
|
||||
case "$2" in
|
||||
"")
|
||||
gsl__authors_list
|
||||
|
@ -68,7 +77,6 @@ case "$1" in
|
|||
;;
|
||||
|
||||
new|-N)
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__new_website" || exit 1
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
|
@ -123,14 +131,7 @@ case "$1" in
|
|||
;;
|
||||
|
||||
check|-C)
|
||||
gsl__find_domain # || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__auth_manager" || 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_checkers" || exit 1
|
||||
gsl__check_nbr_posts
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__db_manager" || exit 1
|
||||
|
||||
case "$2" in
|
||||
-F)
|
||||
gsl_force_check=true
|
||||
|
@ -159,12 +160,7 @@ case "$1" in
|
|||
;;
|
||||
|
||||
make|-M)
|
||||
gsl__find_domain # || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__post_makers" || exit 1
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__post_manager" || exit 1
|
||||
gsl__check_nbr_posts
|
||||
gsl__check_source "$gsl_dir_scripts/gsl__db_manager" || exit 1
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Starting" \
|
||||
|
|
|
@ -16,8 +16,13 @@ can easily get, in your webserver.
|
|||
|
||||
# GSL: Installation
|
||||
------------------------------------------------------------------------
|
||||
In your System /
|
||||
```
|
||||
git clone URL .
|
||||
```
|
||||
|
||||
To avoid sudo, you should give permissions to USER
|
||||
GSL does NOT use any sudo. To avoid errors, you must give permissions
|
||||
to USER with chown -R to folders.
|
||||
|
||||
## --Prefix for DOMAIN configuration (set according to user choice):
|
||||
- HOME: ~/.config/gsl
|
||||
|
@ -50,6 +55,11 @@ To avoid sudo, you should give permissions to USER
|
|||
# How to configure a DOMAIN folder, and create a Post
|
||||
------------------------------------------------------------------------
|
||||
|
||||
When Adding a DOMAIN (example.com), GSL will ask you some questions.
|
||||
Datas will be used to create a DOMAIN.conf file. GSL will also ask you
|
||||
to set a folder where you will put your Posts, but you can create or add
|
||||
ones too.
|
||||
|
||||
## Set a DOMAIN
|
||||
- add a DOMAIN name (if not alrady done)
|
||||
```
|
||||
|
@ -62,17 +72,17 @@ gsl help new
|
|||
gsl help install
|
||||
```
|
||||
|
||||
## Set a DOMAIN folder
|
||||
if not already done:
|
||||
- GSl will ask you to create a folder for your DOMAIN posts when adding a new domain
|
||||
## Set a DOMAIN folder for Posts (if not already done by GSL or You)
|
||||
|
||||
- Add/Create or go into your folder of choice
|
||||
- Save into that folder a blank file named gsl.DOMAIN (gsl.example.org)
|
||||
to tell GSL, this folder is for this DOMAIN website.
|
||||
so that GSL, knows this folder is for this DOMAIN website.
|
||||
|
||||
## Create a new Post
|
||||
- Write a post in a file, using some "metas" that GSL will catch.
|
||||
The engine is written from scratch and looks like a mix of markdown and
|
||||
ReStructuredText. It's very easy to learn and use.
|
||||
|
||||
- Write a post in a file, using some "metas" that GSL will catch.
|
||||
- Save your file with .gsl extension
|
||||
- Start checking it, using:
|
||||
|
||||
|
@ -80,25 +90,36 @@ ReStructuredText. It's very easy to learn and use.
|
|||
gsl check
|
||||
```
|
||||
|
||||
If your Post has no error, you will have some ready to deploy html
|
||||
files and folders. You could install lightweight darkhttpd webserver on
|
||||
your PC to preview the website, or even, juste open index.html in your
|
||||
server folder.
|
||||
## Convert one or all Posts
|
||||
If your Post has no error, you will have to deploy html
|
||||
files and folders. You could install nginx, or lightweight darkhttpd
|
||||
webserver on your PC to preview the website. You can also just open
|
||||
index.html in your server folder, but you won't be able to see some extra
|
||||
includes page, like Posts listing.
|
||||
|
||||
To convert your Posts in HTML, use
|
||||
|
||||
```
|
||||
gsl make
|
||||
```
|
||||
|
||||
You can select a specific post, with autocompletion to check and make
|
||||
only that specified one.
|
||||
|
||||
# Create a Templates
|
||||
------------------------------------------------------------------------
|
||||
|
||||
You will have to create some CSS in your /DOMAIN/templates/
|
||||
You will have to create some CSS (styles.css) in your /DOMAIN/templates/
|
||||
- HOME: ~/.config/gsl/domains/DOMAIN/templates/
|
||||
- GLOBAL: /var/lib/gsl/domains/DOMAIN/templates/
|
||||
|
||||
# How to Write a Post
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Post has 2 sections : Before and after "#1". "#1" is the FIRST
|
||||
Title of your post. Number (1-6) are HTML titles (h1 to h6).
|
||||
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.
|
||||
- After #1 is the CONTENT of your Post
|
||||
- From #1 is the CONTENT of your Post
|
||||
|
||||
## NEEDED HEADERS (before #1)
|
||||
Register METAs for HTML Page content
|
||||
|
@ -107,7 +128,7 @@ 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)
|
||||
author: NAME (must be registred ($ gsl author add)
|
||||
date: YYYY-MM-DD
|
||||
tags: TAG1,OTHER TAG2,TAG3 (comma separated)
|
||||
```
|
||||
|
@ -133,14 +154,14 @@ Register METAs for CONTENT. " : " field separator
|
|||
|
||||
```
|
||||
abbr: SHORT : LONG
|
||||
file: NAME : FILENAME : ALT-TEXT
|
||||
link: NAME : URL : ALT-TEXT
|
||||
code: NBR : FILENAME
|
||||
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. [_,_],*_,_*...) must be on the SAME line.
|
||||
In Content Post, markers (i.e. __My Great file) must be on the SAME line.
|
||||
For ABBRs, just write SHORT in your content
|
||||
|
||||
```
|
||||
|
@ -150,30 +171,34 @@ 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_]
|
||||
# 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
|
||||
|
||||
# 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_/
|
||||
|
||||
# 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
|
||||
---
|
||||
(
|
||||
|
@ -196,9 +221,7 @@ 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
|
||||
# For advanced blockquotes, you can also add, if known:
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
```
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# How to Write a Post
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Post has 2 sections : Vefore and after #1. #1 is the FIRST Title of your
|
||||
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.
|
||||
- After #1 is the CONTENT of your Post
|
||||
- From #1 is the CONTENT of your Post
|
||||
|
||||
## NEEDED HEADERS (before #1)
|
||||
Register METAs for HTML Page content
|
||||
|
@ -12,7 +13,7 @@ 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)
|
||||
author: NAME (must be registred ($ gsl author add)
|
||||
date: YYYY-MM-DD
|
||||
tags: TAG1,OTHER TAG2,TAG3 (comma separated)
|
||||
```
|
||||
|
@ -38,14 +39,14 @@ Register METAs for CONTENT. " : " field separator
|
|||
|
||||
```
|
||||
abbr: SHORT : LONG
|
||||
file: NAME : FILENAME : ALT-TEXT
|
||||
link: NAME : URL : ALT-TEXT
|
||||
code: NBR : FILENAME
|
||||
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. [_,_],*_,_*...) must be on the SAME line.
|
||||
In Content Post, markers (i.e. __My Great file) must be on the SAME line.
|
||||
For ABBRs, just write SHORT in your content
|
||||
|
||||
```
|
||||
|
@ -55,8 +56,17 @@ 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_]
|
||||
# Register in Header. link: My Great link : URL : Alt text
|
||||
_My Great Link
|
||||
|
||||
# Register in Header. file: My Great file : FILENAME : ALT-TEXT
|
||||
__My Great file
|
||||
|
||||
# Register in Header. image: 1 : FILENAME : ALT-TEXT
|
||||
__image:1
|
||||
|
||||
# Block-Code File: Register in Header. code: 1 : FILENAME : Alt Text
|
||||
__code:1
|
||||
|
||||
# Write in ITALIC
|
||||
/_this em text_/
|
||||
|
@ -67,18 +77,9 @@ This is a paragraph
|
|||
# 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
|
||||
---
|
||||
(
|
||||
|
@ -101,9 +102,7 @@ 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
|
||||
# For advanced blockquotes, you can also add, if known:
|
||||
_year: 2021
|
||||
_book: Esperanza 64
|
||||
```
|
||||
|
|
|
@ -18,14 +18,19 @@ grep "$gsl_post" \
|
|||
# From checkers (bcodes,images,files): Write DB
|
||||
#=======================================================================
|
||||
gsl__db_line_file() {
|
||||
gsl__db_exists "$gsl_file_db_files" "$gsl_post_header_field_2"
|
||||
gsl_db_line_file="$gsl_post_header_field_2:$gsl_file_csum"
|
||||
gsl__db_exists "$gsl_file_db_files" "$gsl_post_hf_2"
|
||||
gsl_db_line_file="$gsl_post_hf_2:$gsl_file_csum"
|
||||
|
||||
if [[ "$gsl_db_file_hash" ]];then
|
||||
|
||||
sed -i "${gsl_db_file_line_nbr}s,.*,$gsl_db_line_file," \
|
||||
"$gsl_file_db_files"
|
||||
|
||||
else
|
||||
echo "$gsl_post_header_field_2:$gsl_file_csum" \
|
||||
|
||||
echo "$gsl_post_hf_2:$gsl_file_csum" \
|
||||
>> "$gsl_file_db_files"
|
||||
|
||||
fi
|
||||
}
|
||||
#=======================================================================
|
||||
|
@ -112,7 +117,7 @@ case "$gsl_process" in
|
|||
#-------------------------------------------------------------------
|
||||
gsl__db_exists "$gsl_file_db_posts"
|
||||
if [[ "$gsl_checker_err" ]] && [[ "$gsl_db_post_line_nbr" ]];then
|
||||
sed -i "${gsl_db_post_line_nbr}d" "$gsl_file_db_posts" \
|
||||
sed -i "${gsl_db_post_line_nbr}d" "$gsl_file_db_posts" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"DB" \
|
||||
|
@ -122,8 +127,6 @@ case "$gsl_process" in
|
|||
return
|
||||
fi
|
||||
|
||||
echo -e "\nD> Pass next DB"
|
||||
|
||||
gsl_db_post_line=`
|
||||
printf '%s%s%s%s%s%s%s\n' \
|
||||
"$gsl_post_type|" \
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
# file: gsl__do_commons
|
||||
# Folder: /var/lib/gsl/scripts
|
||||
# By echolib
|
||||
# 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"`
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# Check | Make in Loop from header datas $1: process $2:marker $3:file
|
||||
#======================================================================
|
||||
gsl__do_header() {
|
||||
unset ${!gsl_post_hf@}
|
||||
|
||||
# Stats
|
||||
gsl_stat_link=0
|
||||
gsl_stat_abbr=0
|
||||
gsl_stat_file=0
|
||||
gsl_stat_fcode=0
|
||||
|
||||
while read -r "gsl_header_content_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 ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
done < <(gsl__get_header "$2" "$3")
|
||||
}
|
|
@ -231,7 +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%s\n' \
|
|||
": Logo File|$gsl_set_logo" \
|
||||
": CSS Acro|$gsl_set_css" \
|
||||
": Author URL|$gsl_set_auth_url" \
|
||||
": User folder writings' Posts|$gsl_dir_user_posts"
|
||||
": User folder writings' Posts|$gsl_dir_user_posts" \
|
||||
| column -t -s'|'
|
||||
|
||||
#=======================================================================
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
#!/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
|
||||
# --------------------------------------------------
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Get Datas for Post/Page
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__page_prepare_datas() {
|
||||
echo "$gsl_this_conf_domain"
|
||||
|
||||
# Check for Files & Folders in server
|
||||
gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip"
|
||||
mkdir -p "$gsl_srv_wip"
|
||||
|
||||
# Sync Files and Folders
|
||||
for folder in `find $gsl_this_conf_domain/* -type d`
|
||||
do
|
||||
rsync -a "$folder" "$gsl_srv_wip"
|
||||
done
|
||||
|
||||
# Post or Page
|
||||
case "$gsl_post_type" in
|
||||
post)
|
||||
gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug/index.html"
|
||||
gsl__check_srv_files "$gsl_srv_wip_page"
|
||||
gsl_uri=".."
|
||||
;;
|
||||
page)
|
||||
gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug.html"
|
||||
gsl__check_srv_files "$gsl_srv_wip_page"
|
||||
gsl_uri="."
|
||||
;;
|
||||
esac
|
||||
|
||||
gsl_uri_site_logo="$gsl_uri/templates/$gsl_site_logo"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# MAIN
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__page_creator() {
|
||||
gsl__page_prepare_datas
|
||||
gsl__check_templates
|
||||
gsl__html_meta_head
|
||||
gsl__page_create
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Check if Post / Pages exists in server
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__check_srv_files() {
|
||||
if [[ -f "$1" ]];then
|
||||
echo "! $1"
|
||||
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">
|
||||
</aside
|
||||
</section>
|
||||
|
||||
`cat "$gsl_dir_domain_tpl/footer.html"`
|
||||
|
||||
</body>
|
||||
</html>
|
||||
EOPAGE
|
||||
|
||||
# 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() {
|
||||
echo "D> $gsl_dir_domain_tpl"
|
||||
# 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
|
||||
}
|
|
@ -13,30 +13,24 @@ gsl__all_checkers() {
|
|||
clear
|
||||
unset gsl_check_done
|
||||
|
||||
echo -ne ": Searching for #1..."
|
||||
gsl__post_check_h1 || return
|
||||
echo -ne "\r\033[2K: Searching for NEEDED HEADERS..."
|
||||
gsl__post_check_needed_headers
|
||||
echo -ne "\r\033[2K: Searching for Post TYPE..."
|
||||
gsl__post_check_type
|
||||
echo -ne "\r\033[2K: Searching for PARAGRAPHS"
|
||||
gsl__post_check_paragraphs
|
||||
echo -ne "\r\033[2K: Searching for Content MARKERS..."
|
||||
gsl__post_check_markers
|
||||
echo -ne "\r\033[2K: Searching for BLOCKQUOTEs..."
|
||||
gsl__post_check_blockquote
|
||||
echo -ne "\r\033[2K: Searching for ABBRs..."
|
||||
gsl__post_check_abbr
|
||||
echo -ne "\r\033[2K: Searching for LINKs..."
|
||||
gsl__post_check_links
|
||||
echo -ne "\r\033[2K: Searching for FILES..."
|
||||
gsl__post_check_files
|
||||
echo -ne "\r\033[2K: Searching for IMAGES..."
|
||||
gsl__post_check_images
|
||||
echo -ne "\r\033[2K: Searching for BLOCK-CODES..."
|
||||
gsl__post_check_bcodes
|
||||
echo -ne "\r\033[2K: Searching for some STATS..."
|
||||
gsl__post_check_stats
|
||||
gsl__check_h1 || return
|
||||
gsl__get_needed_headers
|
||||
gsl__check_type
|
||||
gsl__check_headers
|
||||
gsl__check_paragraphs
|
||||
gsl__check_blockquote
|
||||
|
||||
gsl__do_header check "$gsl_marker_link" "$gsl_post"
|
||||
gsl__do_header check "$gsl_marker_abbr" "$gsl_post"
|
||||
gsl__do_header check "$gsl_marker_file" "$gsl_post"
|
||||
gsl__do_header check "$gsl_marker_image" "$gsl_post"
|
||||
gsl__do_header check "$gsl_marker_code" "$gsl_post"
|
||||
|
||||
#echo -ne "\r\033[2K: Searching for Content MARKERS..."
|
||||
#gsl__post_check_markers
|
||||
|
||||
#echo -ne "\r\033[2K: Searching for some STATS..."
|
||||
#gsl__post_check_stats
|
||||
|
||||
echo -ne "\r\033[2K"
|
||||
|
||||
|
@ -46,26 +40,434 @@ gsl__db_line_post
|
|||
|
||||
#-----------------------------------------------------------------------
|
||||
# -------------------------------------------------
|
||||
# Modules checkers ; Get Datas and check for errors
|
||||
# Modules checkers
|
||||
# -------------------------------------------------
|
||||
#-----------------------------------------------------------------------
|
||||
#=======================================================================
|
||||
# Check Post for begining content
|
||||
#=======================================================================
|
||||
gsl__check_h1() {
|
||||
echo -ne ": Searching for #1..."
|
||||
|
||||
gsl_post_begin=`
|
||||
grep -n "#1" $gsl_post \
|
||||
| head -1 \
|
||||
| awk -F: '{print $1}'`
|
||||
|
||||
if ! [[ "$gsl_post_begin" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_h1" \
|
||||
"Missing: #1 TITLE" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check/Set Post Type
|
||||
#=======================================================================
|
||||
gsl__check_type() {
|
||||
echo -ne "\r\033[2K: Searching for Post TYPE..."
|
||||
|
||||
case "$gsl_post_type" in
|
||||
page|post)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Post" \
|
||||
"Set as" \
|
||||
"$gsl_post_type: $gsl_post" \
|
||||
"${PWD}/$gsl_post"
|
||||
;;
|
||||
*)
|
||||
sed -i "s|$gsl_marker_type.*|${gsl_marker_type}post|" \
|
||||
"$gsl_post" && \
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"Post" \
|
||||
"Set as" \
|
||||
"Default $gsl_post_type: $gsl_post" \
|
||||
"${PWD}/$gsl_post"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check for paragraphs ( and )
|
||||
#=======================================================================
|
||||
gsl__check_paragraphs() {
|
||||
echo -ne "\r\033[2K: Searching for Paragraphs..."
|
||||
|
||||
gsl_post_p_open=`
|
||||
awk -v line="$gsl_post_begin" \
|
||||
-v op="$gsl_mo_p" \
|
||||
'NR > line && $1 == op' \
|
||||
"$gsl_post" \
|
||||
| wc -l`
|
||||
|
||||
gsl_post_p_close=`
|
||||
awk -v line="$gsl_post_begin" \
|
||||
-v cp="$gsl_mc_p" \
|
||||
'NR > line && $1 == cp' \
|
||||
"$gsl_post" \
|
||||
| wc -l`
|
||||
|
||||
if (( "$gsl_post_p_open" == 0 ));then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_loc_c_p" \
|
||||
"Missing: ( and ) at begining lines" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
|
||||
fi
|
||||
|
||||
if (( "$gsl_post_p_open" == "$gsl_post_p_close" ));then
|
||||
|
||||
gsl_stat_p="$gsl_post_p_open"
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_p" \
|
||||
"Mismatch: (=$gsl_post_p_open ; )=$gsl_post_p_close" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check for blockquotes: ---
|
||||
#=======================================================================
|
||||
gsl__check_blockquote() {
|
||||
echo -ne "\r\033[2K: Searching for BLOCKQUOTEs..."
|
||||
|
||||
gsl_post_blockquotes_nbr=`
|
||||
awk -v line="$gsl_post_begin" \
|
||||
-v bq="$gsl_mark_blockquote" \
|
||||
'NR > line && $1 == bq' \
|
||||
"$gsl_post" \
|
||||
| wc -l`
|
||||
|
||||
gsl_post_blockquotes_nbr_r=$(( $gsl_post_blockquotes_nbr % 2 ))
|
||||
|
||||
if [[ "$gsl_post_blockquotes_nbr_r" -eq 0 ]];then
|
||||
|
||||
gsl_stat_bq=$(( $gsl_post_blockquotes_nbr / 2 ))
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_cite" \
|
||||
"Mismatch: --- not paired" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__do_header: Check Link
|
||||
#======================================================================
|
||||
gsl__check_link() {
|
||||
# Get & Check Header CONTENT
|
||||
gsl__check_header_fields \
|
||||
"Post" "$gsl_log_h_link" "$gsl_log_act_link" \
|
||||
|| return
|
||||
|
||||
echo -ne "\r\033[2K: Searching for Links... $gsl_post_hf_1"
|
||||
|
||||
# No ALT TEXT ?
|
||||
gsl__check_header_field3 "Post" "$gsl_log_h_link" "$gsl_marker_link"
|
||||
|
||||
gsl_count_links=`
|
||||
gsl__get_content_line "_$gsl_post_hf_1" "$gsl_post" | wc -l
|
||||
`
|
||||
if (( "$gsl_count_links" > 0 ));then
|
||||
|
||||
# Check URL
|
||||
gsl_url_online=`
|
||||
curl -o /dev/null --silent --head --write-out \
|
||||
'%{http_code}' \
|
||||
"$gsl_post_hf_2" 2>/dev/null`
|
||||
|
||||
if (( $gsl_url_online == 200 )) || \
|
||||
(( $gsl_url_online == 301 )) || \
|
||||
(( $gsl_url_online == 302 ));then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Post" \
|
||||
"$gsl_log_h_link" \
|
||||
"Online:$gsl_url_online ${gsl_post_hf_2:0:40}..." \
|
||||
"${PWD}/$gsl_post"
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_h_link" \
|
||||
"Offline:$gsl_url_online ${gsl_post_hf_2:0:40}..." \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
|
||||
fi
|
||||
|
||||
# Stats
|
||||
((gsl_stat_link++))
|
||||
gsl_stat_links=$(( gsl_stat_links + gsl_count_links ))
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Post" \
|
||||
"$gsl_log_c_link" \
|
||||
"Missing: _$gsl_post_hf_1" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__do_header: Check ABBR
|
||||
#======================================================================
|
||||
gsl__check_abbr() {
|
||||
gsl__check_header_fields \
|
||||
"Post" "$gsl_log_h_abbr" "$gsl_log_act_abbr" \
|
||||
|| return
|
||||
|
||||
echo -ne "\r\033[2K: Searching for ABBRs... $gsl_post_hf_1"
|
||||
|
||||
gsl_count_abbrs=`
|
||||
gsl__get_content_line "$gsl_post_hf_1" "$gsl_post" | wc -l`
|
||||
|
||||
if (( "$gsl_count_abbrs" > 0 ));then
|
||||
|
||||
((gsl_stat_abbr++))
|
||||
gsl_stat_abbrs=$(( gsl_stat_abbrs + gsl_count_abbrs ))
|
||||
|
||||
else
|
||||
|
||||
# Missing CONTENT
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_abbr" \
|
||||
"Missing: $gsl_post_header_field_1" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__do_header: Check Files
|
||||
#======================================================================
|
||||
gsl__check_file() {
|
||||
gsl__check_header_fields \
|
||||
"Post" "$gsl_log_h_file" "$gsl_log_act_file" \
|
||||
|| return
|
||||
|
||||
echo -ne "\r\033[2K: Searching for Content Files... $gsl_post_hf_1"
|
||||
|
||||
gsl__check_header_field3 "Post" "$gsl_log_h_file" "$gsl_marker_file"
|
||||
|
||||
# File exists in folder
|
||||
if ! [[ -f "$gsl_dir_domain_files/$gsl_post_hf_2" ]];then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Header $gsl_marker_file" \
|
||||
"Not found: $gsl_post_hf_2" \
|
||||
"$gsl_dir_domain_files/$gsl_post_hf_2"
|
||||
gsl_checker_err=true
|
||||
|
||||
else
|
||||
|
||||
# Register file to DB with hash
|
||||
gsl_file_csum=`
|
||||
cksum "$gsl_dir_domain_files/$gsl_post_hf_2" \
|
||||
| awk '{print $1}'`
|
||||
gsl_db_post_files+="$gsl_post_hf_2|"
|
||||
gsl__db_line_file
|
||||
|
||||
fi
|
||||
|
||||
# Exists in Content
|
||||
gsl_count_files=`
|
||||
gsl__get_content_line "__$gsl_post_hf_1" "$gsl_post" | wc -l`
|
||||
|
||||
if (( $gsl_count_files > 0 ));then
|
||||
|
||||
((gsl_stat_file++))
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_file" \
|
||||
"Missing: __$gsl_post_hf_1" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__do_header: Check Files
|
||||
#======================================================================
|
||||
gsl__check_image() {
|
||||
gsl__check_header_fields \
|
||||
"Post" "$gsl_log_h_image" "$gsl_log_act_image" \
|
||||
|| return
|
||||
|
||||
echo -ne "\r\033[2K: Searching for Images... $gsl_post_hf_1"
|
||||
|
||||
gsl__check_header_field3 "Post" "$gsl_log_h_image" "$gsl_marker_image" \
|
||||
|| return
|
||||
|
||||
# File exists in folder
|
||||
if ! [[ -f "$gsl_dir_domain_files/$gsl_post_hf_2" ]];then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_h_image" \
|
||||
"Not found: $gsl_post_hf_2" \
|
||||
"$gsl_dir_domain_files/$gsl_post_hf_2"
|
||||
gsl_checker_err=true
|
||||
|
||||
else
|
||||
|
||||
# Register file to DB with hash
|
||||
gsl_file_csum=`
|
||||
cksum "$gsl_dir_domain_files/$gsl_post_hf_2" \
|
||||
| awk '{print $1}'`
|
||||
gsl_db_post_files+="$gsl_post_hf_2|"
|
||||
gsl__db_line_file
|
||||
|
||||
fi
|
||||
|
||||
# Exists in Content
|
||||
gsl_count_files=`
|
||||
gsl__get_content_line "__image:$gsl_post_hf_1" "$gsl_post" | wc -l`
|
||||
|
||||
if (( $gsl_count_files > 0 ));then
|
||||
|
||||
((gsl_stat_file++))
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_image" \
|
||||
"Missing: __image:$gsl_post_hf_1" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__do_header: Check Files
|
||||
#======================================================================
|
||||
gsl__check_fcode() {
|
||||
gsl__check_header_fields \
|
||||
"Post" "$gsl_log_h_code" "$gsl_log_act_code" \
|
||||
|| return
|
||||
|
||||
echo -ne "\r\033[2K: Searching for File Codes... $gsl_post_hf_1"
|
||||
|
||||
gsl__check_header_field3 "Post" "$gsl_log_h_code" "$gsl_marker_code" \
|
||||
|
||||
# File exists in folder
|
||||
if ! [[ -f "$gsl_dir_domain_files/$gsl_post_hf_2" ]];then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_h_code" \
|
||||
"Not found: $gsl_post_hf_2" \
|
||||
"$gsl_dir_domain_files/$gsl_post_hf_2"
|
||||
gsl_checker_err=true
|
||||
|
||||
else
|
||||
|
||||
# Register file to DB with hash
|
||||
gsl_file_csum=`
|
||||
cksum "$gsl_dir_domain_files/$gsl_post_hf_2" \
|
||||
| awk '{print $1}'`
|
||||
gsl_db_post_files+="$gsl_post_hf_2|"
|
||||
gsl__db_line_file
|
||||
|
||||
fi
|
||||
|
||||
# Exists in Content
|
||||
gsl_count_fcodes=`
|
||||
gsl__get_content_line "__code:$gsl_post_hf_1" "$gsl_post" | wc -l`
|
||||
|
||||
if (( $gsl_count_fcodes > 0 ));then
|
||||
|
||||
((gsl_stat_fcode+))
|
||||
|
||||
else
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_code" \
|
||||
"Missing: __code:$gsl_post_hf_1" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Check Post for MISSING & VALID Content HEADERS
|
||||
#=======================================================================
|
||||
gsl__post_check_needed_headers() {
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__check_headers() {
|
||||
echo -ne "\r\033[2K: Searching HEADERS..."
|
||||
#--------------------------------
|
||||
# Check if Missing NEEDED HEADERS
|
||||
#-----------------------------------------------------------------------
|
||||
#--------------------------------
|
||||
# Title
|
||||
gsl_header_title=`gsl__get_header "$gsl_marker_title" "$gsl_post"`
|
||||
echo -ne "\r\033[2K: Searching HEADERS... $gsl_header_title"
|
||||
gsl__check_needed_headers \
|
||||
"$gsl_header_title" \
|
||||
"$gsl_marker_title" \
|
||||
"POST TITLE"
|
||||
|
||||
# Slug
|
||||
gsl_header_slug=`gsl__get_header "$gsl_marker_slug" "$gsl_post"`
|
||||
echo -ne "\r\033[2K: Searching HEADERS... $gsl_header_slug"
|
||||
gsl__check_needed_headers \
|
||||
"$gsl_header_slug" \
|
||||
"$gsl_marker_slug" \
|
||||
|
@ -73,7 +475,7 @@ gsl__check_needed_headers \
|
|||
&& gsl_slug_err=true
|
||||
|
||||
# Author
|
||||
gsl_header_author=`gsl__get_header "$gsl_marker_author" "$gsl_post"`
|
||||
echo -ne "\r\033[2K: Searching HEADERS... $gsl_header_author"
|
||||
gsl__check_needed_headers \
|
||||
"$gsl_header_author" \
|
||||
"$gsl_marker_author" \
|
||||
|
@ -81,7 +483,7 @@ gsl__check_needed_headers \
|
|||
&& gsl_author_err=true
|
||||
|
||||
# Date
|
||||
gsl_header_date=`gsl__get_header "$gsl_marker_date" "$gsl_post"`
|
||||
echo -ne "\r\033[2K: Searching HEADERS... $gsl_header_date"
|
||||
gsl__check_needed_headers \
|
||||
"$gsl_header_date" \
|
||||
"$gsl_marker_date" \
|
||||
|
@ -89,22 +491,22 @@ gsl__check_needed_headers \
|
|||
&& gsl_date_err=true
|
||||
|
||||
# Description
|
||||
gsl_header_info=`gsl__get_header "$gsl_marker_info" "$gsl_post"`
|
||||
echo -ne "\r\033[2K: Searching HEADERS... ${gsl_header_info:0:40}..."
|
||||
gsl__check_needed_headers \
|
||||
"$gsl_header_info" \
|
||||
"$gsl_marker_info" \
|
||||
"DESCRIPTION"
|
||||
|
||||
# Tags
|
||||
gsl_header_tags=`gsl__get_header "$gsl_marker_tags" "$gsl_post"`
|
||||
echo -ne "\r\033[2K: Searching HEADERS... ${gsl_header_tags:0:40}..."
|
||||
gsl__check_needed_headers \
|
||||
"$gsl_header_tags" \
|
||||
"$gsl_marker_tags" \
|
||||
"TAG1,OTHER TAG2,TAG3"
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#--------------------------------
|
||||
# Check for VALID Content HEADERS
|
||||
#-----------------------------------------------------------------------
|
||||
#--------------------------------
|
||||
# Author registred
|
||||
if ! [[ "$gsl_author_err" ]] && \
|
||||
! [[ `grep "$gsl_header_author" "$gsl_file_auth_ndd"` ]];then
|
||||
|
@ -116,6 +518,7 @@ if ! [[ "$gsl_author_err" ]] && \
|
|||
"$gsl_header_author not registred for domain $gsl_find_domain" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
|
||||
# Date Format YYYY-MM-DD
|
||||
|
@ -129,6 +532,7 @@ if ! [[ "$gsl_date_err" ]] && \
|
|||
"$gsl_header_date not YYYY-MM-DD" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
fi
|
||||
|
||||
# Slug format title-post
|
||||
|
@ -136,6 +540,7 @@ if ! [[ "$gsl_slug_err" ]];then
|
|||
gsl_header_slug_test=${gsl_header_slug// /-}
|
||||
|
||||
if ! [[ "$gsl_header_slug" == "$gsl_header_slug_test" ]];then
|
||||
|
||||
gsl_new_header_slug="$gsl_marker_slug$gsl_header_slug_test"
|
||||
sed -i \
|
||||
"s|$gsl_marker_slug$gsl_header_slug|$gsl_new_header_slug|" \
|
||||
|
@ -149,93 +554,9 @@ if ! [[ "$gsl_slug_err" ]];then
|
|||
|
||||
gsl_header_slug=$gsl_header_slug_test
|
||||
gsl_checker_war=true
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check Post for begining content
|
||||
#=======================================================================
|
||||
gsl__post_check_h1() {
|
||||
gsl_post_begin=`
|
||||
grep -n "#1" $gsl_post \
|
||||
| head -1 \
|
||||
| awk -F: '{print $1}'`
|
||||
|
||||
if ! [[ "$gsl_post_begin" ]];then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Content begin" \
|
||||
"Missing: #1 TITLE" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check/Set for Post ID
|
||||
#=======================================================================
|
||||
gsl__post_check_type() {
|
||||
if [[ `awk -v m="$gsl_marker_type" -v l="$gsl_post_begin" \
|
||||
'NR < l && $0 ~ m' \
|
||||
"$gsl_post"` ]];then
|
||||
|
||||
gsl_post_type=`gsl__get_header "$gsl_marker_type" "$gsl_post"`
|
||||
# No ID found
|
||||
case "$gsl_post_type" in
|
||||
page|post) true ;;
|
||||
*)
|
||||
sed -i "s|$gsl_marker_type.*|${gsl_marker_type}post|" \
|
||||
"$gsl_post"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
sed -i "1i${gsl_marker_type}post" \
|
||||
"$gsl_post"
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check for paragraphs ( and )
|
||||
#=======================================================================
|
||||
gsl__post_check_paragraphs() {
|
||||
gsl_post_p_open_nbr=`
|
||||
awk -v line="$gsl_post_begin" \
|
||||
-v op="$gsl_mo_p" \
|
||||
'NR > line && $1 == op' \
|
||||
"$gsl_post" \
|
||||
| wc -l`
|
||||
|
||||
gsl_post_p_close_nbr=`
|
||||
awk -v line="$gsl_post_begin" \
|
||||
-v cp="$gsl_mc_p" \
|
||||
'NR > line && $1 == cp' \
|
||||
"$gsl_post" \
|
||||
| wc -l`
|
||||
|
||||
if (( "$gsl_post_p_open_nbr" == 0 ));then
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Content paragraphs" \
|
||||
"Missing content: ( and ) at begining lines" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
fi
|
||||
|
||||
if (( "$gsl_post_p_open_nbr" == "$gsl_post_p_close_nbr" ));then
|
||||
gsl_post_stat_p="$gsl_post_p_open_nbr"
|
||||
else
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Content paragraphs" \
|
||||
"Mismatch: (=$gsl_post_p_open_nbr ; )=$gsl_post_p_close_nbr" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -315,275 +636,15 @@ do
|
|||
done
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check for blockquotes: ---
|
||||
#=======================================================================
|
||||
gsl__post_check_blockquote() {
|
||||
gsl_post_blockquotes_nbr=`
|
||||
awk -v line="$gsl_post_begin" \
|
||||
-v bq="$gsl_mark_blockquote" \
|
||||
'NR > line && $1 == bq' \
|
||||
"$gsl_post" \
|
||||
| wc -l`
|
||||
|
||||
gsl_post_blockquotes_nbr_r=$(( $gsl_post_blockquotes_nbr % 2 ))
|
||||
|
||||
if [[ "$gsl_post_blockquotes_nbr_r" -eq 0 ]];then
|
||||
gsl_post_stat_bq=$(( $gsl_post_blockquotes_nbr / 2 ))
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Post" \
|
||||
"Content citations" \
|
||||
"NBR=$gsl_post_stat_bq > $gsl_mark_blockquote (2x)" \
|
||||
"${PWD}/$gsl_post"
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check Post for ABBR HEADER + Content
|
||||
#=======================================================================
|
||||
gsl__post_check_abbr() {
|
||||
gsl_post_stat_abbr=0
|
||||
while read -r "gsl_header_content_line"
|
||||
do
|
||||
|
||||
# Get & Check HEADER CONTENT
|
||||
gsl__get_header_fields "$gsl_marker_abbr"
|
||||
gsl__check_header_fields "Post" "Header $gsl_marker_abbr" "$gsl_log_act_abbr" \
|
||||
|| continue
|
||||
|
||||
# Check POST CONTENT
|
||||
[[ `gsl__get_content_line \
|
||||
"$gsl_post_header_field_1" \
|
||||
"$gsl_post"` ]] \
|
||||
&& gsl_post_stat_abbr=$(( gsl_post_stat_abbr + 1 )) \
|
||||
&& continue
|
||||
|
||||
# Missing CONTENT
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_abbr" \
|
||||
"Missing: $gsl_post_header_field_1" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
done < <(gsl__get_header "$gsl_marker_abbr" "$gsl_post")
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_i" \
|
||||
"Post" \
|
||||
"Header $gsl_marker_abbr" \
|
||||
"NBR=$gsl_post_stat_abbr" \
|
||||
"${PWD}/$gsl_post"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check Post for LINKs HEADER + Content
|
||||
#=======================================================================
|
||||
gsl__post_check_links() {
|
||||
gsl_post_stat_link=0
|
||||
while read -r "gsl_header_content_line"
|
||||
do
|
||||
# Get & Check Header CONTENT
|
||||
gsl__get_header_fields "$gsl_marker_link"
|
||||
gsl__check_header_fields "Post" "Header $gsl_marker_link" "$gsl_log_act_link" \
|
||||
|| continue
|
||||
|
||||
# Not ALT TEXT ?
|
||||
gsl__check_header_field3 "Post" "Header $gsl_marker_link"
|
||||
|
||||
# Find if ref is in CONTENT
|
||||
[[ `gsl__get_content_with_markers "$gsl_mo_link" "$gsl_mc_link"` ]] \
|
||||
&& gsl_post_stat_link=$(( $gsl_post_stat_link + 1 )) \
|
||||
&& continue
|
||||
|
||||
# Check URL
|
||||
(( `curl -o /dev/null --silent --head --write-out \
|
||||
'%{http_code}' \
|
||||
"$gsl_post_header_field_2"` == 200 )) \
|
||||
&& continue \
|
||||
|| gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Header $gsl_marker_link" \
|
||||
"URL offline: $gsl_post_header_field_2" \
|
||||
"${PWD}/$gsl_post"
|
||||
|
||||
# Missing CONTENT
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_link" \
|
||||
"Missing: [_${gsl_post_header_field_1}_]" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
done < <(gsl__get_header "$gsl_marker_link" "$gsl_post")
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check Post for FILES HEADER + Content
|
||||
#=======================================================================
|
||||
gsl__post_check_files() {
|
||||
gsl_post_stat_file=0
|
||||
while read -r "gsl_header_content_line"
|
||||
do
|
||||
|
||||
# Get & Check Header CONTENT
|
||||
gsl__get_header_fields "$gsl_marker_file"
|
||||
gsl__check_header_fields "Post" "Header $gsl_marker_file" "$gsl_log_act_file" \
|
||||
|| continue
|
||||
|
||||
# Not ALT TEXT ?
|
||||
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
|
||||
else
|
||||
# Register file to DB with hash
|
||||
gsl_file_csum=`
|
||||
cksum "$gsl_dir_domain_files/$gsl_post_header_field_2" \
|
||||
| awk '{print $1}'`
|
||||
gsl_db_post_files+="$gsl_post_header_field_2|"
|
||||
gsl__db_line_file
|
||||
fi
|
||||
|
||||
# Find if ref is in CONTENT
|
||||
[[ `gsl__get_content_with_markers "$gsl_mo_file" "$gsl_mc_file"` ]] \
|
||||
&& gsl_post_stat_file=$(( $gsl_post_stat_file + 1 )) \
|
||||
&& continue
|
||||
|
||||
# Missing CONTENT
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_file" \
|
||||
"Missing: <_${gsl_post_header_field_1}_>" \
|
||||
"${PWD}/$gsl_post"
|
||||
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
|
||||
else
|
||||
# Register file to DB with hash
|
||||
gsl_file_csum=`
|
||||
cksum "$gsl_dir_domain_files/$gsl_post_header_field_2" \
|
||||
| awk '{print $1}'`
|
||||
gsl_db_post_files+="$gsl_post_header_field_2|"
|
||||
gsl__db_line_file
|
||||
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
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_code" \
|
||||
"Missing: $gsl_mark_code : ${gsl_post_header_field_1}" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
done < <(gsl__get_header "$gsl_marker_code" "$gsl_post")
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check Post for IMAGES HEADER + Content
|
||||
#=======================================================================
|
||||
gsl__post_check_images() {
|
||||
gsl_post_stat_image=0
|
||||
while read -r "gsl_header_content_line"
|
||||
do
|
||||
|
||||
# Get & Check Header CONTENT
|
||||
gsl__get_header_fields "$gsl_marker_image"
|
||||
gsl__check_header_fields "Post" "Header $gsl_marker_image" "$gsl_log_act_image" \
|
||||
|| continue
|
||||
|
||||
# Not ALT TEXT ?
|
||||
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
|
||||
else
|
||||
# Register file to DB with hash
|
||||
gsl_file_csum=`
|
||||
cksum "$gsl_dir_domain_files/$gsl_post_header_field_2" \
|
||||
| awk '{print $1}'`
|
||||
gsl_db_post_files+="$gsl_post_header_field_2|"
|
||||
|
||||
gsl__db_exists "$gsl_file_db_files" "$gsl_post_header_field_2"
|
||||
gsl__db_line_file
|
||||
fi
|
||||
|
||||
# Find if ref is in CONTENT
|
||||
[[ `gsl__get_content_line \
|
||||
"$gsl_mark_image : $gsl_post_header_field_1" \
|
||||
"$gsl_post"` ]] \
|
||||
&& gsl_post_stat_image=$(( $gsl_post_stat_image + 1 )) \
|
||||
&& continue
|
||||
|
||||
# Missing CONTENT
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"$gsl_log_c_image" \
|
||||
"Missing: $gsl_mark_image : ${gsl_post_header_field_1}" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
|
||||
done < <(gsl__get_header "$gsl_marker_image" "$gsl_post")
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check for more STATS
|
||||
#=======================================================================
|
||||
gsl__post_check_stats() {
|
||||
gsl_post_stat_w=`
|
||||
gsl_stat_words=`
|
||||
awk -v l="$gsl_post_begin" \
|
||||
'NR >= l' \
|
||||
"$gsl_post" \
|
||||
| wc -w`
|
||||
|
||||
gsl_post_stat_w=$(( $gsl_post_stat_w - 2*$gsl_post_stat_p ))
|
||||
gsl_stat_words=$(( $gsl_stat_words - 2*$gsl_stat_p ))
|
||||
}
|
||||
|
|
|
@ -17,21 +17,39 @@ gsl__all_makers() {
|
|||
clear
|
||||
unset gsl_check_done
|
||||
gsl__prepare_makers
|
||||
|
||||
echo -ne ": Searching and converting Titles..."
|
||||
gsl__make_strongs
|
||||
gsl__make_bolds
|
||||
gsl__do_header make "$gsl_marker_link" "$gsl_tmp_post"
|
||||
gsl__do_header make "$gsl_marker_abbr" "$gsl_tmp_post"
|
||||
gsl__make_titles
|
||||
echo -ne "\r\033[2K: Searching Titles and adding DIVs..."
|
||||
|
||||
gsl_ct=0 && gsl__make_titles_div_open
|
||||
gsl_ct=0 && gsl__make_titles_div_close
|
||||
|
||||
#echo -ne "\r\033[2K: Searching and converting lists..."
|
||||
#gsl__make_lists
|
||||
echo -ne "\r\033[2K: Searching and converting Paragraphs..."
|
||||
gsl__make_paragraphs
|
||||
echo -ne "\r\033[2K: Searching and converting Block-Codes..."
|
||||
gsl__check_bcodes
|
||||
echo -ne "\r\033[2K: Searching and converting Citations"
|
||||
gsl__check_cites
|
||||
|
||||
#clear
|
||||
cat -n "$gsl_uri_tmp_post"
|
||||
#echo -ne "\r\033[2K: Searching and converting Inline-Codes..."
|
||||
#gsl__make_inline_codes
|
||||
#echo -ne "\r\033[2K: Searching and converting Block-Codes..."
|
||||
#gsl__check_bcodes
|
||||
|
||||
gsl__check_cites
|
||||
gsl__make_a11y
|
||||
echo -ne "\r\033[2K"
|
||||
|
||||
# No more Needed tmp file post
|
||||
rm -f "$gsl_tmp_post"
|
||||
|
||||
# Create HTML Page using gsl_a11y_post
|
||||
clear
|
||||
cat "$gsl_a11y_post"
|
||||
gsl__page_creator
|
||||
|
||||
# No more Needed a11y post
|
||||
rm -f "$gsl_a11y_post"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
|
@ -54,32 +72,173 @@ awk -v s="$1" \
|
|||
#=======================================================================
|
||||
gsl__prepare_makers() {
|
||||
# Getting NEEDED infos
|
||||
gsl_post_type=`
|
||||
awk -F"$gsl_marker_type" '{print $2}' "$gsl_post"`
|
||||
|
||||
gsl_post_begin=`
|
||||
grep -n "#1" $gsl_post \
|
||||
| head -1 \
|
||||
| awk -F: '{print $1}'`
|
||||
|
||||
# Source config website (DATAS)
|
||||
source "$gsl_this_conf_domain/$gsl_find_domain.conf"
|
||||
|
||||
# Get Needed Headers DATAS
|
||||
gsl__get_needed_headers
|
||||
|
||||
# Get extra Headers DATAS
|
||||
gsl_header_images=`gsl__get_header "$gsl_marker_image" "$gsl_post"`
|
||||
|
||||
# Create TMP file from CONTENT
|
||||
gsl_dir_tmp="/tmp/gsl"
|
||||
gsl_file_tmp_post_content="post_content"
|
||||
gsl_uri_tmp_post="$gsl_dir_tmp/$gsl_file_tmp_post_content"
|
||||
|
||||
mkdir -p "$gsl_dir_tmp"
|
||||
|
||||
echo "" > "$gsl_uri_tmp_post"
|
||||
gsl_tmp_post=`mktemp`
|
||||
awk -v l="$gsl_post_begin" \
|
||||
'NR >= l' \
|
||||
"$gsl_post" \
|
||||
> "$gsl_uri_tmp_post"
|
||||
> "$gsl_tmp_post"
|
||||
|
||||
# Code readability a11y
|
||||
gsl_a11y_post=`mktemp`
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# ---------------------------------
|
||||
# Check if Convert is needed and do
|
||||
# Converters
|
||||
# ---------------------------------
|
||||
#=======================================================================
|
||||
#======================================================================
|
||||
# From gsl__do_header: Make Link
|
||||
#======================================================================
|
||||
gsl__make_link() {
|
||||
echo -ne "\r\033[2K: Converting Links... $gsl_post_hf_1"
|
||||
|
||||
gsl_post_hf_1="${gsl_post_hf_1}"
|
||||
gsl_post_hf_1_t="${gsl_post_hf_1}+"
|
||||
|
||||
[[ "$sl_post_hf_3" ]] \
|
||||
&& gsl_html_link_title=" title=\"$sl_post_hf_3\""
|
||||
|
||||
# target blank
|
||||
gsl_html_link_t=`
|
||||
printf '%s%s%s%s' \
|
||||
"<a href=\"$gsl_post_hf_2\"$gsl_html_link_title " \
|
||||
"targt=\"blank\">" \
|
||||
"$gsl_post_hf_1" \
|
||||
"</a>"`
|
||||
sed -i "s|_${gsl_post_hf_1_t}|$gsl_html_link_t|g" "$gsl_tmp_post"
|
||||
|
||||
# No Target
|
||||
gsl_html_link=`
|
||||
printf '%s%s%s' \
|
||||
"<a href=\"$gsl_post_hf_2\"$gsl_html_link_title>" \
|
||||
"$gsl_post_hf_1" \
|
||||
"</a>"`
|
||||
sed -i "s|_${gsl_post_hf_1}|$gsl_html_link|g" "$gsl_tmp_post"
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__do_header: Make ABBRS
|
||||
#======================================================================
|
||||
gsl__make_abbr() {
|
||||
echo -ne "\r\033[2K: Converting ABBRs... $gsl_post_hf_1"
|
||||
|
||||
gsl_html_long="<abbr title=\"$gsl_post_hf_2\">$gsl_post_hf_1</abbr>"
|
||||
sed -i "s|$gsl_post_hf_1|$gsl_html_long|" "$gsl_tmp_post"
|
||||
}
|
||||
|
||||
gsl_make_sb_show() {
|
||||
echo -ne "\r\033[2K: Converting... Line:$gsl_line_nbr $gsl_html_word"
|
||||
sed -i "s|$gsl_word_replace|$gsl_html_word|" "$gsl_tmp_post"
|
||||
unset ${!gsl_word@} ${!gsl_html@}
|
||||
}
|
||||
#======================================================================
|
||||
# From gsl__all_header: Make Strongs
|
||||
#======================================================================
|
||||
gsl__make_strongs() {
|
||||
while read -r "gsl_line_nbr" "gsl_word"
|
||||
do
|
||||
case "$gsl_word" in
|
||||
# STRONG
|
||||
"**"*"**"*|*"**"*"**"*)
|
||||
gsl_word=${gsl_word#*'**'}
|
||||
gsl_word=${gsl_word%'**'*}
|
||||
gsl_word_replace='\*\*'"$gsl_word"'\*\*'
|
||||
gsl_html_word="<strong>$gsl_word</strong>"
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
"**"*"**")
|
||||
gsl_html_word="<strong>${gsl_word//'**'/}</strong>"
|
||||
gsl_word_replace='\*\*'"$gsl_word"'\*\*'
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
"**"*)
|
||||
gsl_word=${gsl_word#'**'*}
|
||||
gsl_html_word="<strong>$gsl_word"
|
||||
gsl_word_replace='\*\*'"$gsl_word"
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
*"**")
|
||||
gsl_word=${gsl_word%'**'*}
|
||||
gsl_html_word="${gsl_word//'**'/}</strong>"
|
||||
gsl_word_replace="$gsl_word"'\*\*'
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done < <(awk '{for(i=1;i<=NF;i++) {print NR, $i}}' "$gsl_tmp_post")
|
||||
}
|
||||
|
||||
#======================================================================
|
||||
# From gsl__all_header: Make Bolds
|
||||
#======================================================================
|
||||
gsl__make_bolds() {
|
||||
while read -r "gsl_line_nbr" "gsl_word"
|
||||
do
|
||||
case "$gsl_word" in
|
||||
# STRONG
|
||||
"*"*"*"*|*"*"*"*"*)
|
||||
gsl_word=${gsl_word#*'*'}
|
||||
gsl_word=${gsl_word%'*'*}
|
||||
gsl_word_replace='\*'"$gsl_word"'\*'
|
||||
gsl_html_word="<b>$gsl_word</b>"
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
"*"*"*")
|
||||
gsl_html_word="<b>${gsl_word//'*'/}</b>"
|
||||
gsl_word_replace='\*'"$gsl_word"'\*'
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
"*"*)
|
||||
gsl_word=${gsl_word#'*'*}
|
||||
gsl_html_word="<b>$gsl_word"
|
||||
gsl_word_replace='\*'"$gsl_word"
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
*"*")
|
||||
gsl_word=${gsl_word%'*'*}
|
||||
gsl_html_word="${gsl_word//'*'/}</b>"
|
||||
gsl_word_replace="$gsl_word"'\*'
|
||||
gsl_make_sb_show
|
||||
;;
|
||||
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done < <(awk '{for(i=1;i<=NF;i++) {print NR, $i}}' "$gsl_tmp_post")
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#=======================================================================
|
||||
# Find BLOCK-CODES
|
||||
|
@ -88,7 +247,7 @@ gsl__check_bcodes() {
|
|||
gsl_lines_nbr=(`
|
||||
gsl__get_mark_content_line \
|
||||
"$gsl_mark_code" \
|
||||
"$gsl_uri_tmp_post"`)
|
||||
"$gsl_tmp_post"`)
|
||||
|
||||
! [[ "$gsl_lines_nbr" ]] \
|
||||
&& return
|
||||
|
@ -103,12 +262,14 @@ done
|
|||
# Find BLOCKQUOTES
|
||||
#=======================================================================
|
||||
gsl__check_cites() {
|
||||
echo -ne "\r\033[2K: Searching and converting Citations..."
|
||||
|
||||
unset gsl_lines_nbr
|
||||
|
||||
gsl_lines_nbr=(`
|
||||
gsl__get_mark_content_line \
|
||||
"$gsl_mark_blockquote" \
|
||||
"$gsl_uri_tmp_post"`)
|
||||
"$gsl_tmp_post"`)
|
||||
gsl_lines_nbr=(${gsl_lines_nbr[0]} ${gsl_lines_nbr[1]})
|
||||
|
||||
! [[ "$gsl_lines_nbr" ]] \
|
||||
|
@ -138,23 +299,16 @@ gsl_lines_nbr=(${gsl_lines_nbr[0]} ${gsl_lines_nbr[1]})
|
|||
# Find and convert Titles #1-6
|
||||
#=======================================================================
|
||||
gsl__make_titles() {
|
||||
while read -r "gsl_content_line_nbr" "gsl_content_line"
|
||||
do
|
||||
echo -ne ": Searching and converting Titles..."
|
||||
for t in `seq 1 6`
|
||||
do
|
||||
case "$gsl_content_line" in
|
||||
"#$t"*)
|
||||
gsl_content_title=`
|
||||
awk -F"#$t " '{print $2}' \
|
||||
<<< "$gsl_content_line"`
|
||||
gsl_html_title="<h$t>$gsl_content_title</h$t>"
|
||||
sed -i "${gsl_content_line_nbr}s^.*^$gsl_html_title^" \
|
||||
"$gsl_uri_tmp_post"
|
||||
;;
|
||||
*) continue ;;
|
||||
esac
|
||||
while read -r "h" "content"
|
||||
do
|
||||
gsl_html_title="<h$t>$content</h$t>"
|
||||
sed -i "s^$h $content^$gsl_html_title^" \
|
||||
"$gsl_tmp_post"
|
||||
done < <(grep "#$t" "$gsl_tmp_post")
|
||||
done
|
||||
done < <(cat -n "$gsl_uri_tmp_post")
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
|
@ -163,9 +317,11 @@ done < <(cat -n "$gsl_uri_tmp_post")
|
|||
# Open DIVs after titles for css
|
||||
#=======================================================================
|
||||
gsl__make_titles_div_open() {
|
||||
echo -ne "\r\033[2K: Searching Titles and Open DIVs..."
|
||||
|
||||
gsl_ct=$(( gsl_ct + 1 ))
|
||||
gsl_content_title=`
|
||||
grep -n "<h" "$gsl_uri_tmp_post" \
|
||||
grep -n "<h" "$gsl_tmp_post" \
|
||||
| head -n $gsl_ct \
|
||||
| tail -n 1`
|
||||
|
||||
|
@ -183,7 +339,7 @@ awk -F"<h" '{print $2}' \
|
|||
|
||||
gsl_html_div="<div class=\"${gsl_site_css}_content-p$gsl_title_n\">"
|
||||
sed -i "$(( $gsl_content_line_nbr + 1 ))i$gsl_html_div" \
|
||||
"$gsl_uri_tmp_post"
|
||||
"$gsl_tmp_post"
|
||||
|
||||
gsl_content_same_title="$gsl_content_title"
|
||||
gsl__make_titles_div_open
|
||||
|
@ -193,16 +349,18 @@ gsl__make_titles_div_open
|
|||
# Close DIVs before titles for css
|
||||
#=======================================================================
|
||||
gsl__make_titles_div_close() {
|
||||
echo -ne "\r\033[2K: Searching Titles and Open DIVs..."
|
||||
|
||||
gsl_test_line="<div class=\"${gsl_site_css}_content"
|
||||
|
||||
gsl_ct=$(( gsl_ct + 1 ))
|
||||
gsl_content_title=`
|
||||
grep -n "$gsl_test_line" "$gsl_uri_tmp_post" \
|
||||
grep -n "$gsl_test_line" "$gsl_tmp_post" \
|
||||
| head -n $gsl_ct \
|
||||
| tail -n 1`
|
||||
|
||||
[[ "$gsl_content_title" == "$gsl_content_same_title" ]] \
|
||||
&& echo "</div>" >> "$gsl_uri_tmp_post" \
|
||||
&& echo "</div>" >> "$gsl_tmp_post" \
|
||||
&& return
|
||||
! [[ "$gsl_content_title" ]] && return
|
||||
|
||||
|
@ -214,14 +372,14 @@ while read -r "gsl_search_line_nbr" "gsl_search_line"
|
|||
do
|
||||
case "$gsl_search_line" in
|
||||
"<h"*)
|
||||
sed -i "${gsl_search_line_nbr}i</div>" "$gsl_uri_tmp_post"
|
||||
sed -i "${gsl_search_line_nbr}i</div>" "$gsl_tmp_post"
|
||||
break
|
||||
;;
|
||||
*) continue ;;
|
||||
esac
|
||||
done < <(awk -v l="$gsl_content_line_nbr" \
|
||||
'NR > l {print NR,$0}' \
|
||||
"$gsl_uri_tmp_post")
|
||||
"$gsl_tmp_post")
|
||||
|
||||
gsl_content_same_title="$gsl_content_title"
|
||||
gsl__make_titles_div_close
|
||||
|
@ -243,37 +401,36 @@ do
|
|||
case "$gsl_content_line" in
|
||||
")")
|
||||
sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_c," \
|
||||
"$gsl_uri_tmp_post"
|
||||
"$gsl_tmp_post"
|
||||
;;
|
||||
"("|"( 1")
|
||||
sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_o1," \
|
||||
"$gsl_uri_tmp_post"
|
||||
"$gsl_tmp_post"
|
||||
;;
|
||||
"( 2")
|
||||
sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_o2," \
|
||||
"$gsl_uri_tmp_post"
|
||||
"$gsl_tmp_post"
|
||||
;;
|
||||
"( 3")
|
||||
sed -i "${gsl_content_line_nbr}s,.*,$gsl_html_par_o3," \
|
||||
"$gsl_uri_tmp_post"
|
||||
"$gsl_tmp_post"
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done < <(cat -n "$gsl_uri_tmp_post")
|
||||
done < <(cat -n "$gsl_tmp_post")
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Replace gsl_mark_code
|
||||
#=======================================================================
|
||||
gsl__make_bcode() {
|
||||
|
||||
# Get mark line nbr
|
||||
gsl_line_nbr=`
|
||||
gsl__get_mark_content_line \
|
||||
"$gsl_mark_code" \
|
||||
"$gsl_uri_tmp_post" | head -1`
|
||||
"$gsl_tmp_post" | head -1`
|
||||
|
||||
#---------
|
||||
# Convert
|
||||
|
@ -299,14 +456,13 @@ printf '%s %s\n%b\n%s\n' \
|
|||
"</pre>" \
|
||||
> "$gsl_file_tmp_code"
|
||||
|
||||
sed -i "${gsl_line_nbr}r $gsl_file_tmp_code" "$gsl_uri_tmp_post"
|
||||
sed -i "${gsl_line_nbr}d" "$gsl_uri_tmp_post"
|
||||
sed -i "${gsl_line_nbr}r $gsl_file_tmp_code" "$gsl_tmp_post"
|
||||
sed -i "${gsl_line_nbr}d" "$gsl_tmp_post"
|
||||
rm -f "$gsl_file_tmp_code"
|
||||
rm -f "$gsl_file_bcode"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
#
|
||||
#=======================================================================
|
||||
# Replace and Convert this blockquote
|
||||
#=======================================================================
|
||||
|
@ -319,7 +475,7 @@ gsl_file_tmp_cite_html=`mktemp` # File to Put final HTML blockquote
|
|||
# Put whole blockquote in file
|
||||
awk -v o="$gsl_cite_line_start" -v c="$gsl_cite_line_stop" \
|
||||
'NR >= o && NR <= c' \
|
||||
"$gsl_uri_tmp_post" \
|
||||
"$gsl_tmp_post" \
|
||||
> "$gsl_file_tmp_cite"
|
||||
|
||||
# No more DATAS needed for next if any
|
||||
|
@ -378,13 +534,13 @@ gsl_file_tmp_cite=`mktemp` # File to put Converted HTML DATAS
|
|||
|| gsl__make_cite_simple
|
||||
|
||||
# Insert html blockquote file in Post
|
||||
sed -i "${gsl_cite_line_stop}r $gsl_file_tmp_cite_html" "$gsl_uri_tmp_post"
|
||||
sed -i "${gsl_cite_line_stop}r $gsl_file_tmp_cite_html" "$gsl_tmp_post"
|
||||
|
||||
# Remove useless lines
|
||||
gsl_cite_total_lines=$(( $gsl_cite_line_stop - gsl_cite_line_start ))
|
||||
for i in `seq 0 $gsl_cite_total_lines`
|
||||
do
|
||||
sed -i "${gsl_cite_line_start}d" "$gsl_uri_tmp_post"
|
||||
sed -i "${gsl_cite_line_start}d" "$gsl_tmp_post"
|
||||
done
|
||||
|
||||
rm -f "$gsl_file_tmp_cite_content" # No more blockquote CONTENT needed
|
||||
|
@ -423,5 +579,118 @@ $(cat "$gsl_file_tmp_cite_content")
|
|||
</blockquote>
|
||||
EOCITE
|
||||
}
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Convert HTML: Images
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__make_images() {
|
||||
! [[ "$gsl_header_images" ]] \
|
||||
&& return
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Convert HTML: Files
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__make_files() {
|
||||
! [[ "$gsl_header_files" ]] \
|
||||
&& return
|
||||
|
||||
while read -r "gsl_this_file"
|
||||
do
|
||||
gsl_filename=`
|
||||
awk -F" : " \
|
||||
-v s="$gsl_marker_file$gsl_this_file" \
|
||||
'match($0,s) {print $2}' \
|
||||
"$gsl_post"`
|
||||
|
||||
gsl_filealt=`
|
||||
awk -F" : " \
|
||||
-v s="$gsl_marker_file$gsl_this_file" \
|
||||
'match($0,s) {print $3}' \
|
||||
"$gsl_post"`
|
||||
|
||||
[[ "$gsl_filealt" ]] \
|
||||
&& gsl_HTML_file_title=" title=\"$gsl_filealt\""
|
||||
|
||||
# Set HTML Link
|
||||
case "$gsl_post_type" in
|
||||
post) gsl_HTML_file_url="./files/$gsl_filename" ;;
|
||||
page) gsl_HTML_file_url="../files/$gsl_filename" ;;
|
||||
esac
|
||||
|
||||
# Convert file to link
|
||||
gsl_mark_file="$gsl_mo_file$gsl_this_file$gsl_mc_file"
|
||||
gsl_HTML_file_link=`
|
||||
printf '%s%s%s%s%s%s' \
|
||||
"<a href=\"$gsl_HTML_file_url\"" \
|
||||
"$gsl_HTML_file_title" \
|
||||
" target=\"_blank\"" \
|
||||
" class=\"${gsl_site_css}_file-link\">" \
|
||||
"$gsl_this_file" \
|
||||
"</a>"`
|
||||
|
||||
sed -i "s|$gsl_mark_file|$gsl_HTML_file_link|g" \
|
||||
"$gsl_tmp_post"
|
||||
|
||||
done < <(gsl__get_content_finder \
|
||||
-o "$gsl_mo_file" \
|
||||
-c "$gsl_mc_file" \
|
||||
-f "$gsl_tmp_post")
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Convert Inline-code
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__make_inline_codes() {
|
||||
gsl_HTML_inline_code="<code class=\"${gsl_site_css}_inline-code\">"
|
||||
sed -i "s|$gsl_mo_code|$gsl_HTML_inline_code|g" \
|
||||
"$gsl_tmp_post"
|
||||
sed -i "s|$gsl_mc_code|</code>|g" \
|
||||
"$gsl_tmp_post"
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Reading Code ; making readability
|
||||
#-----------------------------------------------------------------------
|
||||
gsl__make_a11y() {
|
||||
echo -ne "\r\033[2K: Reading HTML Code for readability..."
|
||||
|
||||
gsl__make_a11y_add_space() {
|
||||
gsl_set_space=$(( gsl_set_space * 2 ))
|
||||
gsl_space=`printf "%${gsl_set_space}s" ""`
|
||||
awk -v b="$gsl_start_line" \
|
||||
-v c="$gsl_stop_line" \
|
||||
-v space="$gsl_space" \
|
||||
'NR > b && NR < c {print space $0}' \
|
||||
"$gsl_tmp_post" \
|
||||
>> "$gsl_a11y_post"
|
||||
}
|
||||
|
||||
gsl_last_title_line=`
|
||||
grep -n "<h" "$gsl_tmp_post" | tail -1 | awk -F: '{print $1}'`
|
||||
|
||||
while read -r "gsl_line_nbr" "gsl_line"
|
||||
do
|
||||
|
||||
if (( $gsl_line_nbr > $gsl_last_title_line ));then
|
||||
gsl_stop_line=`cat "$gsl_tmp_post" | wc -l`
|
||||
gsl__make_a11y_add_space
|
||||
break
|
||||
fi
|
||||
|
||||
case "$gsl_line" in
|
||||
"<h"*)
|
||||
if [[ $gsl_start_line ]];then
|
||||
gsl_stop_line=$gsl_line_nbr
|
||||
gsl__make_a11y_add_space
|
||||
unset gsl_start_line
|
||||
fi
|
||||
gsl_set_space=`expr substr "$gsl_line" 3 1`
|
||||
gsl_start_line=$gsl_line_nbr
|
||||
unset gsl_stop_line
|
||||
printf '%s\n' "$gsl_line" >> "$gsl_a11y_post"
|
||||
;;
|
||||
esac
|
||||
done < <(cat -n "$gsl_tmp_post")
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ do
|
|||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Size" \
|
||||
"Too small $gsl_post_size <= $gsl_post_min_size" \
|
||||
"$gsl_post - Too small $gsl_post_size <= $gsl_post_min_size" \
|
||||
"${PWD}/$gsl_post"
|
||||
continue
|
||||
fi
|
||||
|
@ -173,52 +173,6 @@ case "$gsl_process" in
|
|||
esac
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check NEEDED Fields from HEADER
|
||||
#=======================================================================
|
||||
gsl__check_header_fields() {
|
||||
if ! [[ "$gsl_post_header_field_1" ]] || \
|
||||
! [[ "$gsl_post_header_field_2" ]];then
|
||||
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"Line:$gsl_post_header_line_nbr > Content: $3" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Check OPTIONAL Field 3 from HEADER
|
||||
#=======================================================================
|
||||
gsl__check_header_field3() {
|
||||
if ! [[ "$gsl_post_header_field_3" ]];then
|
||||
case "$2" in
|
||||
Image)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_e" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"Line:$gsl_post_header_line_nbr > No ALT TEXT ?" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_err=true
|
||||
;;
|
||||
*)
|
||||
gsl__logs_print \
|
||||
"$gsl_log_w" \
|
||||
"$1" \
|
||||
"$2" \
|
||||
"Line:$gsl_post_header_line_nbr > No ALT TEXT ?" \
|
||||
"${PWD}/$gsl_post"
|
||||
gsl_checker_war=true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# --------------
|
||||
# Tools for Post
|
||||
|
@ -252,21 +206,12 @@ awk -F"$1" -v marker="$1" -v l="$gsl_post_begin" \
|
|||
"$2" 2>/dev/null
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get fields from variable... $1: field | $2: variable
|
||||
#=======================================================================
|
||||
gsl__get_header_field() {
|
||||
awk -F" : " -v f="$1" \
|
||||
'NFS=f {print $NFS}' \
|
||||
<<< "$2"
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
# Get line nbr from CONTENT Post... $1: TERM | $2: File
|
||||
#=======================================================================
|
||||
gsl__get_content_line() {
|
||||
awk -v line="$gsl_post_begin" -v s="$1" \
|
||||
'NR >= line && $0 ~ s {print NR}' \
|
||||
awk -v l="$gsl_post_begin" -v s="$1" \
|
||||
'NR >= l && $0 ~ s {print NR}' \
|
||||
"$2" || return
|
||||
}
|
||||
|
||||
|
@ -321,22 +266,72 @@ gsl__check_needed_headers() {
|
|||
"$gsl_log_e" \
|
||||
"Post" \
|
||||
"Header $2" \
|
||||
"Missing: POST TITLE" \
|
||||
"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 Fields and line nbr from header from marker
|
||||
# Get HEADER Fields + line nbr $1:marker
|
||||
#=======================================================================
|
||||
gsl__get_header_fields() {
|
||||
gsl_post_header_field_1=`
|
||||
gsl__get_header_field 1 "$gsl_header_content_line"`
|
||||
gsl_post_header_field_2=`
|
||||
gsl__get_header_field 2 "$gsl_header_content_line"`
|
||||
gsl_post_header_field_3=`
|
||||
gsl__get_header_field 3 "$gsl_header_content_line"`
|
||||
gsl_post_header_line_nbr=`
|
||||
gsl__get_line "$1$gsl_post_header_field_1" "$gsl_post"`
|
||||
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_header_field_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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue