Version 0.2.10
This commit is contained in:
parent
1237337a9d
commit
6874ed7ade
|
@ -6,6 +6,15 @@ STL: Statique Littérateur
|
|||
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
||||
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
||||
|
||||
## [0.2.10]
|
||||
### read
|
||||
- Better read option + autocompletion
|
||||
|
||||
### db
|
||||
- added to autocompletion
|
||||
- new option: sidebar. to check all article's sort from sidebar
|
||||
|
||||
|
||||
## [0.2.9]
|
||||
- fix a bug in log when using remove wip,www (ARTICLE)
|
||||
- other little corrections
|
||||
|
|
2
control
2
control
|
@ -1,5 +1,5 @@
|
|||
Package: estl
|
||||
Version: 0.2.9
|
||||
Version: 0.2.10
|
||||
Section: custom
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#------------
|
||||
# funny stats
|
||||
#------------
|
||||
# lines: 61
|
||||
# lines: 59
|
||||
# functions: 0
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
|
@ -30,10 +30,8 @@ stl_dir_log="/var/log/stl"
|
|||
# Register main scripts files
|
||||
#======================================================================
|
||||
stl_file_help_args="$stl_dir_help/help"
|
||||
|
||||
stl_file_log="$stl_dir_log/stl.log"
|
||||
stl_file_last_log="$stl_dir_log/last_stl.log"
|
||||
|
||||
stl_file_pwd_conf='.stl.conf'
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,15 @@ STL: Statique Littérateur
|
|||
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
||||
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
||||
|
||||
## [0.2.10]
|
||||
### read
|
||||
- Better read option + autocompletion
|
||||
|
||||
### db
|
||||
- added to autocompletion
|
||||
- new option: sidebar. to check all article's sort from sidebar
|
||||
|
||||
|
||||
## [0.2.9]
|
||||
- fix a bug in log when using remove wip,www (ARTICLE)
|
||||
- other little corrections
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Version: 0.2.9
|
||||
# Version: 0.2.10
|
||||
# Name: Statique Littérateur
|
||||
# Type: Executable
|
||||
# Description: Static website generator
|
||||
|
@ -13,8 +13,8 @@
|
|||
# funny stats
|
||||
#------------
|
||||
# scripts files: 14
|
||||
# app lines: 4654
|
||||
# app functions: 105
|
||||
# app lines: 4712
|
||||
# app functions: 106
|
||||
# lines: 146
|
||||
# functions: 4
|
||||
#-----------------------------------------------------------------------
|
||||
|
@ -45,8 +45,8 @@ if__file() {
|
|||
&& exit
|
||||
|
||||
case "$2" in
|
||||
source) source "$1" ;;
|
||||
read) cat "$1";exit ;;
|
||||
source) source "$1" ;;
|
||||
read) cat "$sl" "$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,8 @@ if__file "$stl_dir_scripts/wip__article" source
|
|||
# Check Options in each dedicated files scripts
|
||||
#======================================================================
|
||||
case "$1" in
|
||||
help|-h|--help) if__file "$stl_file_help_args" read ;;
|
||||
readme) if__file "$stl_dir_help/README.md" read ;;
|
||||
help|-h|--help) if__file "$stl_file_help_args" read;exit ;;
|
||||
readme) if__file "$stl_dir_help/README.md" read;exit ;;
|
||||
license) printf '%s %s\n' \
|
||||
"# GNU AFFERO GENERAL PUBLIC LICENSE" \
|
||||
"Version 3, 19 November 2007";exit ;;
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#------------
|
||||
# funny stats
|
||||
#------------
|
||||
# lines: 265
|
||||
# functions: 10
|
||||
# lines: 293
|
||||
# functions: 11
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
#**********************************************************************
|
||||
|
@ -40,12 +40,14 @@ domain
|
|||
help
|
||||
license
|
||||
log
|
||||
read
|
||||
version
|
||||
EOL
|
||||
|
||||
else
|
||||
cat <<EOL
|
||||
check
|
||||
db
|
||||
domain
|
||||
edit
|
||||
help
|
||||
|
@ -62,17 +64,38 @@ EOL
|
|||
fi
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Specifics for db
|
||||
#----------------------------------------------------------------------
|
||||
_stl_arg_db() {
|
||||
[[ $nodomain ]] && return 0
|
||||
|
||||
cat << EOL
|
||||
sidebar
|
||||
$(_stl_articles)
|
||||
EOL
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Specifics for edit and read
|
||||
#----------------------------------------------------------------------
|
||||
_stl_arg_editread() {
|
||||
[[ $nodomain ]] && return 0
|
||||
if [[ "${COMP_WORDS[COMP_CWORD-1]}" == "read" ]];then
|
||||
cat << EOL
|
||||
license
|
||||
EOL
|
||||
fi
|
||||
|
||||
if [[ $nodomain ]];then
|
||||
return 0
|
||||
|
||||
else
|
||||
cat << EOL
|
||||
conf
|
||||
sidebar
|
||||
$(_stl_articles)
|
||||
EOL
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
@ -194,6 +217,11 @@ _stl_completions() {
|
|||
COMPREPLY=( $(compgen -W "$(_stl_arg_editread)" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
|
||||
db)
|
||||
COMPREPLY=( $(compgen -W "$(_stl_arg_db)" -- ${cur}) )
|
||||
return 0
|
||||
;;
|
||||
|
||||
sidebar)
|
||||
COMPREPLY=( $(compgen -W "$(_stl_arg_sidebar)" -- ${cur}) )
|
||||
|
|
|
@ -6,6 +6,15 @@ STL: Statique Littérateur
|
|||
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
|
||||
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
|
||||
|
||||
## [0.2.10]
|
||||
### read
|
||||
- Better read option + autocompletion
|
||||
|
||||
### db
|
||||
- added to autocompletion
|
||||
- new option: sidebar. to check all article's sort from sidebar
|
||||
|
||||
|
||||
## [0.2.9]
|
||||
- fix a bug in log when using remove wip,www (ARTICLE)
|
||||
- other little corrections
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#------------
|
||||
# funny stats
|
||||
#------------
|
||||
# lines: 252
|
||||
# lines: 258
|
||||
# functions: 8
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
|
@ -72,9 +72,9 @@ find "$dir_target" -type d -empty -delete
|
|||
|
||||
# Remove www hash to DB
|
||||
db__srv_status_hash "$srv" Unset
|
||||
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Remove this file
|
||||
# $1: file
|
||||
|
@ -88,6 +88,7 @@ if [[ -f "$1" ]];then
|
|||
fi
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Argument read
|
||||
# $1: read
|
||||
|
@ -97,15 +98,19 @@ read__OPTIONS() {
|
|||
! [[ "$2" ]] \
|
||||
&& noarg "Cannot be empty"
|
||||
|
||||
sl="-n"
|
||||
case "$2" in
|
||||
*".stl") article__hash "$2" ;;
|
||||
conf) domain__get;uri_article="$stl_file_pwd_conf" ;;
|
||||
sidebar) domain__get;uri_article="$domain_file_sidebar_load" ;;
|
||||
license) uri_article="$stl_dir_help/LICENSE" ;;
|
||||
license) uri_article="$stl_dir_help/LICENSE";unset sl ;;
|
||||
*) noarg "$2" ;;
|
||||
esac
|
||||
|
||||
if__file "$uri_article" read
|
||||
if [[ $uri_article == "$stl_dir_help/LICENSE" ]];then
|
||||
echo && stl license
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -165,9 +170,9 @@ awk -v end="$article_begin" \
|
|||
'NR >= end {print}' \
|
||||
"$1" \
|
||||
> "$article_tmp_post"
|
||||
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get article line for article_tmp_post. Count from begin - 1
|
||||
#======================================================================
|
||||
|
@ -175,6 +180,7 @@ article__line() {
|
|||
ln=$(( ln + article_begin - 1 ))
|
||||
}
|
||||
|
||||
|
||||
#======================================================================
|
||||
# Get article hash + article_db ID from uri
|
||||
# $1: file *.stl from argument
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#------------
|
||||
# funny stats
|
||||
#------------
|
||||
# lines: 315
|
||||
# lines: 339
|
||||
# functions: 7
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
|
@ -36,6 +36,11 @@ db__OPTIONS() {
|
|||
''|list)
|
||||
db__list
|
||||
;;
|
||||
|
||||
sidebar)
|
||||
db_sidebar=true
|
||||
db__list
|
||||
;;
|
||||
|
||||
*)
|
||||
noarg "$2"
|
||||
|
@ -183,16 +188,27 @@ db__list() {
|
|||
domain__get
|
||||
db_tmp_list=`mktemp`
|
||||
[[ "$stl_install" == "server" ]] \
|
||||
&& echo "NBR|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR|WWW" \
|
||||
&& echo "0|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR|WWW" \
|
||||
>> "$db_tmp_list" \
|
||||
|| echo "NBR|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR" \
|
||||
|| echo "0|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR" \
|
||||
>> "$db_tmp_list"
|
||||
|
||||
while read -r "db_file"
|
||||
do
|
||||
((db_nbr++))
|
||||
|
||||
source "$db_file"
|
||||
|
||||
if [[ $db_sidebar ]];then
|
||||
if ! [[ $sidebar_position ]];then
|
||||
continue
|
||||
|
||||
else
|
||||
db_nbr=$sidebar_position
|
||||
fi
|
||||
|
||||
else
|
||||
((db_nbr++))
|
||||
fi
|
||||
|
||||
[[ $article_chk_hash != $article_wip_hash ]] \
|
||||
&& wip_status="${CY}$article_wip_hash${NC}" \
|
||||
|| wip_status="$article_wip_hash"
|
||||
|
@ -221,11 +237,19 @@ do
|
|||
|
||||
done < <(ls -1 "$domain_db_articles/"*.db 2>/dev/null)
|
||||
|
||||
(( `cat "$db_tmp_list" | wc -l` > 1 )) \
|
||||
&& cat "$db_tmp_list" | column -t -s'|' -o ' '
|
||||
|
||||
rm -f "$db_rmp_list"
|
||||
if ! (( `cat "$db_tmp_list" | wc -l` > 1 ));then
|
||||
exit
|
||||
|
||||
else
|
||||
if [[ $db_sidebar ]];then
|
||||
cat "$db_tmp_list" | column -t -s'|' -o' ' | sort -k1
|
||||
|
||||
else
|
||||
cat "$db_tmp_list" | column -t -s'|' -o' '
|
||||
fi
|
||||
|
||||
rm -f "$db_rmp_list"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ if__writeable "$PWD"
|
|||
case "$set_prot" in
|
||||
Y|y) domain_protocol="https://" ;;
|
||||
N|n) domain_protocol="http://" ;;
|
||||
*) echo "# Maybe later...";exit ;;
|
||||
*) echo "# Maybe later...";exit ;;
|
||||
esac
|
||||
domain_ask+="$domain_name"
|
||||
fi
|
||||
|
@ -157,7 +157,7 @@ case "$domain_name" in
|
|||
|
||||
read -rp "$domain_ask (Y|*) ? " domain_confirm
|
||||
case "$domain_confirm" in
|
||||
Y|y) true ;;
|
||||
Y|y) true ;;
|
||||
*) echo "# Maybe later...";exit ;;
|
||||
esac
|
||||
;;
|
||||
|
|
|
@ -131,7 +131,7 @@ sidebar__manage "$2" "$position" "$sidebar_HTML_item"
|
|||
#======================================================================
|
||||
sidebar__manage() {
|
||||
case "$1" in
|
||||
latest|-l) sort_arg='-k2' ;;
|
||||
latest|-l) sort_arg='-k2' ;;
|
||||
oldest|-o) sort_arg='-k2r' ;;
|
||||
esac
|
||||
|
||||
|
@ -314,6 +314,6 @@ do
|
|||
|
||||
done <"$domain_dir_sidebar/stl.sidebar"
|
||||
|
||||
# Create HTML sidebar
|
||||
# Create HTML sidebar if an article is added
|
||||
[[ $sidebar_add ]] && sidebar__create_HTML
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#------------
|
||||
# funny stats
|
||||
#------------
|
||||
# lines: 225
|
||||
# lines: 227
|
||||
# functions: 6
|
||||
#-----------------------------------------------------------------------
|
||||
|
||||
|
@ -193,11 +193,13 @@ fi
|
|||
echo
|
||||
stl log clean all
|
||||
|
||||
# Create a backup of the config in db
|
||||
rsync -a "$PWD/$stl_file_pwd_conf" \
|
||||
"$stl_dir_db/$domain_name/$stl_file_pwd_conf.bkp"
|
||||
|
||||
# Re check all checked article to wirte DB
|
||||
echo -e "\n# Database:"
|
||||
|
||||
# Last process with exit
|
||||
update__database
|
||||
update__database # Last process with exit
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue