hugosoucycc

[ARCHIVED] Another old source code of <hugo.soucy.cc>.
Log | Files | Refs | Submodules

commit d538f1c6eefe5fb7617149162642c2d60d6bf5ce
parent b0c77ca50f5f5b67ac4ef44e582320171718b46a
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Sun, 16 Oct 2016 19:01:01 -0400

Add a reset mode.

To force the complete build of the web site.

Diffstat:
Mfunctions/create-html-pages | 12+++++++-----
Mfunctions/create-html-sections | 2++
Mpanstash | 35++++++++++++++++++-----------------
3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/functions/create-html-pages b/functions/create-html-pages @@ -1,8 +1,5 @@ #!/bin/bash -# -#. functions/move-html-to-publichtml.sh - # Create all the HTML pages with pandoc create_html_pages () { echo "- Create all the HTML pages with pandoc" @@ -11,10 +8,15 @@ create_html_pages () { # Create the homepage pandoc --template="$TPL_PANDOC_PATH/index.html" \ - -o "$CONTENT_PATH/index.html" "$CONTENT_PATH/index.md" + -o "$CONTENT_PATH/index.html" "$CONTENT_PATH/index.md" + + case "$1" in + true) find_noindex_markdown=$(find "$CONTENT_PATH/" -mindepth 2 -type f -name \*.md) ;; + false) find_noindex_markdown=$(find "$CONTENT_PATH/" -mindepth 2 -type f -name \*.md -mtime -1) ;; + esac # Then create others - for markdown in $(find "$CONTENT_PATH/" -mindepth 2 -type f -name \*.md -mtime -1); do + for markdown in $find_noindex_markdown; do # Parent folder name without path page_section=$(basename "$(dirname "$markdown")") diff --git a/functions/create-html-sections b/functions/create-html-sections @@ -53,6 +53,7 @@ create_html_sections () { -o "$tmp_folder/tmp.html" \ --parse-raw + # This is for the feed pandoc -t html $(find "$tmp_folder/" -type f -name \*.entry.xhtml | sort -nr) \ -o "$tmp_folder/tmp.feed.xhtml" \ --parse-raw @@ -63,6 +64,7 @@ create_html_sections () { -A "$tmp_folder/tmp.html" \ -o "$indexsubdir/index.html" + # This is for the feed pandoc -t html "$tmp_folder/tmp.feed.xhtml" -s \ --template="$TPL_PANDOC_PATH/feed.txt" \ -o "$PUBLICHTML/feed.$(basename "$indexsubdir").atom.xml" \ diff --git a/panstash b/panstash @@ -44,24 +44,25 @@ if [[ -n "$1" ]] && [[ " ${archetypes[*]} " == *" $1 "* ]] && [[ -n "$2" ]]; the mo $ARCHETYPES_PATH/$1.md > $CONTENT_PATH/$1/$2 echo "- The file '$CONTENT_PATH/$1/$2' hab been created." -else - # Check if Pandoc is installed. - if hash pandoc 2>/dev/null; then - # Ok Pandoc is here. - # Execute main functions - build_pandoc_templates - create_html_pages - create_html_sections - get_static_files - clean_content_folder +elif hash pandoc 2>/dev/null; then + # Ok Pandoc is here. + # Execute main functions + + [[ "$1" == "--reset" ]] || \ + ([[ "$1" == "dev" ]] && [[ "$2" == "--reset" ]]) && \ + reset=true || reset=false - echo "- Your New Website Is Ready Here : $PUBLICHTML_PATH/ . Thanks Pandoc!!" + build_pandoc_templates + create_html_pages "$reset" + create_html_sections + get_static_files + clean_content_folder - exit 0 - else - echo "- Sorry But You must Install *Pandoc* For Using *Panstash*." - echo "- Please Visit <http://pandoc.org/installing.html>." + echo "- Your New Website Is Ready Here : $PUBLICHTML_PATH/ . Thanks Pandoc!!" + exit 0 +else + echo "- Sorry But You must Install *Pandoc* For Using *Panstash*." + echo "- Please Visit <http://pandoc.org/installing.html>." - exit 1 - fi + exit 1 fi