diff --git a/README.md b/README.md index 95837af..d732ff7 100644 --- a/README.md +++ b/README.md @@ -386,8 +386,8 @@ _book: Esperanza 64 ### Créer des listes -L'arborescence est "infinie". Chaque contenu de la liste -*doit être sur la même ligne* +L'arborescence est "infinie". +- Chaque contenu de la liste *doit être sur la même ligne* Dans l'article... - utilisez ```=``` pour définir l'arborescence d'une liste simple @@ -428,6 +428,26 @@ Retour "forcé" à la ligne ``` +# Comment gérer la sidebar +La gestion de la sidebar est manuelle. Un article doit être convertit +avec make avant de pouvoir l'ajouter à la position ddsirée. Le nombre +d'articles maximum dans la sidebar est configurable dans /etc/gsl/gsl.conf + +Quelques exemples d'utilisations + +``` +# Liste les articles de la sidebar dans l'ordre +gsl sidebar + +# Ajoute monarticle en position 1 +gsl -S add 1 monarticle + +# Enlève monarticle2 de la sidebar +gsl -S remove monarticle2 + +# monarticle5 est en position 3. Le replacer par monarticle4 +gsl -S -A 3 monarticle4 +``` # HELP COMMAND ``` @@ -465,12 +485,7 @@ $ gsl [ARG] make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE] to HTML file in server -F : Force Make again - - post-list [OPT] [FILE] : Add post again from [FILE] to Last-Posts List - (When converting new post, it will be added) - Pin : Set Post from [FILE] to first in Last-Posts List - Add : Add Post from [FILE] to last in Last-Posts List - + www [OPT1] [OPT2] : Add/Remove Post from www server [OPT1]: add : Add all/[FILE] to www server @@ -479,6 +494,16 @@ $ gsl [ARG] all : Select all post with wip statuses [FILE] : Select specific post (if wip status) + + sidebar | -S [ARG] [FILE]: Show Posts in list + [ARG]: + add | -A : Must set a Position number before [FILE] + Max posts in list is set in gsl.conf + remove | -R : No Position to set, just [FILE]. + Replace post position if post not exists in list + add/remove will build last-posts-list.html + create | -C : rebuild last-posts-list.html + version | -v : Show local versionn -vv : Shown local and repo Versions ``` diff --git a/control b/control index 08ab10a..08c0aef 100644 --- a/control +++ b/control @@ -1,5 +1,5 @@ Package: egsl -Version: 0.0.23 +Version: 0.0.3 Section: custom Priority: optional Architecture: all diff --git a/usr/local/bin/gsl b/usr/local/bin/gsl index 05f9e46..d6419d6 100755 --- a/usr/local/bin/gsl +++ b/usr/local/bin/gsl @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 0.0.23 +# Version: 0.0.3 # file: gsl # Folder: /usr/local/bin # By echolib @@ -369,91 +369,9 @@ case "$1" in "$PWD" ;; - post-list) - case "$2" in - add) - gsl_post_list="Add" - ;; - pin) - gsl_post_list="Pin" - ;; - *) - echo "! Bad Argument: $2" - exit - ;; - esac - - ! [[ "$3" ]] \ - && echo "! Missing argument: post [FILE]" \ - && exit - - gsl__if_file "$3" post - - gsl__check_nbr_posts - gsl__logs_print \ - "$gsl_log_i" \ - "Starting" \ - "Process" \ - "$1 ; $gsl_post_list $3 from domain $gsl_find_domain" \ - "$gsl_dir_domain_tpl/last-posts-list.html" - - gsl__loop_posts post-list - - gsl__logs_print \ - "$gsl_log_i" \ - "Stopping" \ - "Process" \ - "$1 ; $gsl_post_list $3 from domain $gsl_find_domain" \ - "$gsl_dir_domain_tpl/last-posts-list.html" - ;; - - list|-l) - case "$2" in - add|-A) gsl_listing_process="add" ;; - remove|-R) gsl_listing_process="remove" ;; - ""*) echo "! Bad argument: $2 ? OPT=add|-A/remove|-R";exit ;; - esac - - case "$3" in - 0*) - echo "! Are you serious ?" - exit - ;; - $(( $3 <= $gsl_list_max_posts))) - echo "> $3 is OK" - ;; - *) - echo "! Mysterious number" - exit - ;; - esac - - ! [[ "$4" ]] \ - && echo "! Set post [FILE]" \ - && exit - - gsl__if_file "$4" post - - gsl__logs_print \ - "$gsl_log_i" \ - "Starting" \ - "Process" \ - "$1 ; $2 ; $3 from domain $gsl_find_domain" \ - "$gsl_dir_domain_tpl/last-posts-list.html" - - gsl__loop_posts listing - - gsl__logs_print \ - "$gsl_log_i" \ - "Stopping" \ - "Process" \ - "$1 ; $2 ; $3 from domain $gsl_find_domain" \ - "$gsl_dir_domain_tpl/last-posts-list.html" - ;; - www) ! [[ "$2" ]] \ - && echo "! Missing argument: OPT=add/remove" \ + && echo "! Missing argument: add/remove" \ && exit if__command rsync @@ -488,7 +406,7 @@ case "$1" in ;; esac ;; - =) + *) gsl__if_file "$3" post ;; esac @@ -502,6 +420,7 @@ case "$1" in gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www" gsl__srv_sync "$gsl_srv_www" + gsl__loop_posts www "$2" gsl__logs_print \ @@ -512,6 +431,11 @@ case "$1" in "$gsl_site_server" ;; + sidebar|-S) + gsl__if_file "$gsl_dir_scripts/gsl__sidebar" source + gsl__sidebar $1 $2 $3 $4 + ;; + *) gsl help exit diff --git a/var/lib/gsl/README.md b/var/lib/gsl/README.md index 95837af..d732ff7 100644 --- a/var/lib/gsl/README.md +++ b/var/lib/gsl/README.md @@ -386,8 +386,8 @@ _book: Esperanza 64 ### Créer des listes -L'arborescence est "infinie". Chaque contenu de la liste -*doit être sur la même ligne* +L'arborescence est "infinie". +- Chaque contenu de la liste *doit être sur la même ligne* Dans l'article... - utilisez ```=``` pour définir l'arborescence d'une liste simple @@ -428,6 +428,26 @@ Retour "forcé" à la ligne ``` +# Comment gérer la sidebar +La gestion de la sidebar est manuelle. Un article doit être convertit +avec make avant de pouvoir l'ajouter à la position ddsirée. Le nombre +d'articles maximum dans la sidebar est configurable dans /etc/gsl/gsl.conf + +Quelques exemples d'utilisations + +``` +# Liste les articles de la sidebar dans l'ordre +gsl sidebar + +# Ajoute monarticle en position 1 +gsl -S add 1 monarticle + +# Enlève monarticle2 de la sidebar +gsl -S remove monarticle2 + +# monarticle5 est en position 3. Le replacer par monarticle4 +gsl -S -A 3 monarticle4 +``` # HELP COMMAND ``` @@ -465,12 +485,7 @@ $ gsl [ARG] make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE] to HTML file in server -F : Force Make again - - post-list [OPT] [FILE] : Add post again from [FILE] to Last-Posts List - (When converting new post, it will be added) - Pin : Set Post from [FILE] to first in Last-Posts List - Add : Add Post from [FILE] to last in Last-Posts List - + www [OPT1] [OPT2] : Add/Remove Post from www server [OPT1]: add : Add all/[FILE] to www server @@ -479,6 +494,16 @@ $ gsl [ARG] all : Select all post with wip statuses [FILE] : Select specific post (if wip status) + + sidebar | -S [ARG] [FILE]: Show Posts in list + [ARG]: + add | -A : Must set a Position number before [FILE] + Max posts in list is set in gsl.conf + remove | -R : No Position to set, just [FILE]. + Replace post position if post not exists in list + add/remove will build last-posts-list.html + create | -C : rebuild last-posts-list.html + version | -v : Show local versionn -vv : Shown local and repo Versions ``` diff --git a/var/lib/gsl/helps/gsl_help b/var/lib/gsl/helps/gsl_help index 5e81793..45d12eb 100644 --- a/var/lib/gsl/helps/gsl_help +++ b/var/lib/gsl/helps/gsl_help @@ -34,12 +34,7 @@ $ gsl [ARG] make | -M [OPT] [FILE] : Convert Posts from PWD folder or [FILE] to HTML file in server -F : Force Make again - - post-list [OPT] [FILE] : Add post again from [FILE] to Last-Posts List - (When converting new post, it will be added) - Pin : Set Post from [FILE] to first in Last-Posts List - Add : Add Post from [FILE] to last in Last-Posts List - + www [OPT1] [OPT2] : Add/Remove Post from www server [OPT1]: add : Add all/[FILE] to www server @@ -48,6 +43,16 @@ $ gsl [ARG] all : Select all post with wip statuses [FILE] : Select specific post (if wip status) + + sidebar | -S [ARG] [FILE]: Show Posts in list + [ARG]: + add | -A : Must set a Position number before [FILE] + Max posts in list is set in gsl.conf + remove | -R : No Position to set, just [FILE]. + Replace post position if post not exists in list + add/remove will build last-posts-list.html + create | -C : rebuild last-posts-list.html + version | -v : Show local versionn -vv : Shown local and repo Versions diff --git a/var/lib/gsl/scripts/gsl__page_creator b/var/lib/gsl/scripts/gsl__page_creator index 7e85e19..bf92ddb 100644 --- a/var/lib/gsl/scripts/gsl__page_creator +++ b/var/lib/gsl/scripts/gsl__page_creator @@ -56,14 +56,14 @@ case "$gsl_post_type" in gsl_srv_www_page="$gsl_srv_www/$gsl_header_slug/index.html" gsl__check_srv_files "$gsl_srv_wip_page" wip gsl__check_srv_files "$gsl_srv_www_page" www - #gsl_uri=".." + gsl_uri=".." ;; page) gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug.html" gsl_srv_www_page="$gsl_srv_www/$gsl_header_slug.html" gsl__check_srv_files "$gsl_srv_wip_page" wip gsl__check_srv_files "$gsl_srv_www_page" www - #gsl_uri="." + gsl_uri="." ;; esac @@ -81,6 +81,7 @@ if [[ -f "$1" ]];then "$2" \ "$gsl_post_type $gsl_post exists" \ "$1" + else gsl__logs_print \ "$gsl_log_w" \ @@ -92,145 +93,6 @@ else fi } -#====================================================================== -# latest Posts listing Manager -#====================================================================== -gsl__page_listing_create() { -# Check if Post is in list ; Status Made -gsl_checker_war=true -gsl_listing_file="$gsl_dir_domain_listings/$gsl_post.list" - -if [[ `ls -1 "$gsl_listing_file"* 2>/dev/null` ]];then - gsl__logs_print \ - "$gsl_log_w" \ - "Post" \ - "Latest" \ - "$gsl_post_list $gsl_post ; already added to Listing" \ - "$gsl_dir_domain_listings/" - return -fi - -case "$gsl_post_list" in - Pin) - gsl_listing_start_n=1 - [[ $gsl_post_pin ]] \ - && sed -i "s|gsl_post_pin.*|gsl_post_pin=$gsl_header_title|" \ - "$gsl_this_conf_domain/$gsl_find_domain.conf" \ - || echo "gsl_post_pin=$gsl_header_title" \ - >> "$gsl_this_conf_domain/$gsl_find_domain.conf" - ;; - Add) - # Check if a post is pinned - [[ $gsl_post_pin ]] \ - && gsl_listing_start_n=2 \ - || gsl_listing_start_n=1 - ;; -esac - -gsl__page_listing_roller -gsl__page_listing_create_file "$gsl_listing_file.$gsl_listing_start_n" - -cat `ls -1r "$gsl_dir_domain_listings/"*.list.*` \ - > "$gsl_dir_domain_tpl/last-posts-list.html" \ - && gsl__logs_print \ - "$gsl_log_w" \ - "Post" \ - "Latest" \ - "Create Listing (Merged .list.*)"\ - "$gsl_dir_domain_tpl/last-post-list.html" -} - -#====================================================================== -# Create HTML List from selected Post -#====================================================================== -gsl__page_listing_create_file() { -# Set HTML Base Link -case "$gsl_post_type" in - post) gsl_bpost_url="$gsl_header_slug/index.html" ;; - page) gsl_bpost_url="$gsl_header_slug.html" ;; -esac - -cat << EOPostSide > "$1" -