hugosoucycc

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

commit 776c2e328cf9e1666b9945de6ffc465fce72e294
parent a8bc142aa12c5e9356f1f1803f191df1adc59fdc
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Mon,  5 Jun 2017 19:35:19 -0400

Modify main script.

Diffstat:
Mfakestache | 33+++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/fakestache b/fakestache @@ -1,11 +1,12 @@ -#!/bin/bash +#!/usr/bin/env bash # # FAKESTACHE SSG - Yep! An Other Static Website Generator! -# (Pandoc + Mustache + Bash) +# (Mustache + Bash) +# # Dependencies : -# * Pandoc - Make sure it's installed on your machine : `$ pandoc -v`. -# * Mustache - Is already includes in pantash : `lib/mo/`. +# * Markdown.pl - Is already includes in pantash : `./lib/markdown/`. +# * Mustache - Is already includes in pantash : `./lib/mo/`. # Include the main configuration files . config/site.cfg @@ -15,11 +16,10 @@ . lib/mo/mo # Include all the main functions -. functions/parse-yaml . functions/is-in-array +. functions/make-html-from-md . functions/get-archetypes -. functions/build-pandoc-templates -. functions/get-pandoc-templates +. functions/get-templates . functions/move-html-to-publichtml . functions/create-html-pages . functions/create-html-sections @@ -27,7 +27,6 @@ . functions/get-static-files . functions/clean-content-folder - # Reset all variables that might be set unset -v reset reset=false @@ -43,15 +42,16 @@ if is_in_array "$1" "${archetypes[@]}" == 1; then # Remove special chars, white spaces for the filename, replace # uppcase by lower, and replace non-ascii - archetype_filename=${archetype_title//[[:space:]]/-}.md + archetype_filename=${archetype_title//[[:space:]]/-} archetype_filename=${archetype_filename//[^[:alnum:]-.]/} archetype_filename=$(echo ${archetype_filename,,} | iconv -f utf-8 -t us-ascii//translit) mkdir -p "$CONTENT_PATH/$1/${NOW_DATE:0:4}/${NOW_DATE:5:2}/" - mo $ARCHETYPES_PATH/$1.md > "$CONTENT_PATH/$1/${NOW_DATE:0:4}/${NOW_DATE:5:2}/$archetype_filename" + mo $ARCHETYPES_PATH/$1.md > "$CONTENT_PATH/$1/${NOW_DATE:0:4}/${NOW_DATE:5:2}/$archetype_filename.md" + mo $ARCHETYPES_PATH/$1.meta > "$CONTENT_PATH/$1/${NOW_DATE:0:4}/${NOW_DATE:5:2}/$archetype_filename.meta" - echo "- The file '$CONTENT_PATH/$1/${NOW_DATE:0:4}/${NOW_DATE:5:2}/$archetype_filename' hab been created." + echo "- The files '$CONTENT_PATH/$1/${NOW_DATE:0:4}/${NOW_DATE:5:2}/{$archetype_filename.md, $archetype_filename.meta}' had been created." exit 0 else @@ -103,10 +103,11 @@ else esac fi -if hash pandoc 2>/dev/null && (( ${BASH_VERSION%%.*} >= 4 )); then - # Ok Pandoc is here. +if (( ${BASH_VERSION%%.*} >= 4 )); then + # Ok BASH is here. # Then execute main functions - build_pandoc_templates + + get_templates create_html_pages "$reset" create_html_sections create_feed @@ -117,8 +118,8 @@ if hash pandoc 2>/dev/null && (( ${BASH_VERSION%%.*} >= 4 )); then exit 0 else - echo "- Sorry But You must Install *Pandoc* and/or have Bash >= 4 To Using *FakeStache SSG*." - echo "- Please Visit <http://pandoc.org/installing.html>." + echo "- Sorry But You must have Bash >= 4 To Using *FakeStache SSG*." + echo "- Please Visit <https://www.gnu.org/software/bash/>." exit 1 fi