Add TYPE page/post ; In DB if no post error
This commit is contained in:
parent
470757fb89
commit
332f1feb17
16
README.md
16
README.md
|
@ -112,6 +112,22 @@ 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
|
||||
|
||||
|
|
|
@ -39,9 +39,6 @@ gsl_filename_auth="authors.db"
|
|||
#=======================================================================
|
||||
# GSL Internal Configuration
|
||||
#=======================================================================
|
||||
# Reserved 10 posts ID (Home, about...)
|
||||
gsl_post_min_ID=10
|
||||
|
||||
# minimum size to check a post
|
||||
gsl_post_min_size=800
|
||||
|
||||
|
@ -157,7 +154,8 @@ gsl_u_markers=(
|
|||
#-----------------------------------------------------------------------
|
||||
# Set HEADERS markers
|
||||
#-----------------------------------------------------------------------
|
||||
gsl_marker_ID='ID: '
|
||||
# type: page / post
|
||||
gsl_marker_type='type: '
|
||||
gsl_marker_title='title: '
|
||||
gsl_marker_slug='slug: '
|
||||
gsl_marker_info='info: '
|
||||
|
|
|
@ -9,4 +9,4 @@ _gsl_completions()
|
|||
return 0
|
||||
}
|
||||
|
||||
complete -F _gsl_completions gsl
|
||||
complete -F _gsl_completions 'gsl'
|
||||
|
|
|
@ -112,6 +112,22 @@ 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
|
||||
|
||||
|
|
|
@ -17,6 +17,22 @@ 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
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ case "$gsl_process" in
|
|||
Checked)
|
||||
gsl_db_line=`
|
||||
printf '%s%s%s%s%s\n' \
|
||||
"$gsl_post_ID 1|" \
|
||||
"$gsl_post_type|" \
|
||||
"$gsl_post|" \
|
||||
"$gsl_post_hash|" \
|
||||
"$gsl_post_size|" \
|
||||
|
|
|
@ -10,11 +10,14 @@
|
|||
gsl__post_all_checkers() {
|
||||
clear
|
||||
unset gsl_check_done
|
||||
|
||||
echo -ne "\r\033[2K: Searching for #1..."
|
||||
gsl_process="Checked"
|
||||
|
||||
echo -ne "Searching for #1..."
|
||||
gsl__post_check_h1 || return
|
||||
echo -n ": Searching for NEEDED HEADERS..."
|
||||
echo -n "\r\033[2K: : Searching for NEEDED HEADERS..."
|
||||
gsl__post_check_needed_headers
|
||||
echo -n "\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..."
|
||||
|
@ -39,7 +42,10 @@ echo -ne "\r\033[2K"
|
|||
&& gsl log -s -w
|
||||
|
||||
[[ "$gsl_checker_err" ]] \
|
||||
&& gsl log -s -e
|
||||
&& gsl log -s -e \
|
||||
&& return
|
||||
|
||||
gsl__db_line_post
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
|
@ -165,6 +171,29 @@ if ! [[ "$gsl_post_begin" ]];then
|
|||
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 )
|
||||
#=======================================================================
|
||||
|
|
|
@ -58,11 +58,8 @@ do
|
|||
"Post" \
|
||||
"$gsl_post" \
|
||||
"${PWD}"
|
||||
gsl__post_all_checkers
|
||||
|
||||
# No error: Check/Write to DB (posts.db)
|
||||
gsl_process="Checked"
|
||||
gsl__db_line_post
|
||||
gsl__post_all_checkers
|
||||
;;
|
||||
|
||||
make)
|
||||
|
|
|
@ -46,8 +46,7 @@ for gsl_file in "$gsl_file_logs" \
|
|||
"$gsl_file_db_stats" \
|
||||
"$gsl_file_db_domains"
|
||||
do
|
||||
gsl__check_file "$gsl_file" || \
|
||||
touch "$gsl_file"
|
||||
gsl__check_file "$gsl_file" && touch "$gsl_file"
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue