hugosoucycc

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

commit ce06e8e2017e7acddedf5fc46103b0f8238ba79e
parent 11ee03712a8ab269698a42d4c0b986137ab38e7f
Author: Hugo Soucy <hugo.soucy@savoirfairelinux.com>
Date:   Mon, 24 Oct 2016 09:35:52 -0400

Create content from archetypes with string

Instead of the file name.

Diffstat:
Mpanstash | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/panstash b/panstash @@ -32,18 +32,19 @@ get_archetypes if [[ -n "$1" ]] && [[ " ${archetypes[*]} " == *" $1 "* ]] && [[ -n "$2" ]]; then # Should be more dynamic with regex. # Don't suppose of the file format. - - # Build the archetype's title from 2nd argument - # It'll work if the format is "this-is-my-new-conten.md" - dynamictitle=$(echo "$2" | tr '-' ' ' | sed -r 's/.md//g') - - archetype_title=${dynamictitle^} + archetype_title="$2" archetype_date=$NOW_DATE archetype_datetime=$NOW_DATETIME - mo $ARCHETYPES_PATH/$1.md > $CONTENT_PATH/$1/$2 + remove_whitespace=${archetype_title// /-} + remove_quote=${remove_whitespace//\'/-} + remove_capitalletter=${remove_quote,,} + + archetype_filename=${remove_capitalletter}.md + + mo $ARCHETYPES_PATH/$1.md > $CONTENT_PATH/$1/"$archetype_filename" - echo "- The file '$CONTENT_PATH/$1/$2' hab been created." + echo "- The file '$CONTENT_PATH/$1/$archetype_filename' hab been created." elif hash pandoc 2>/dev/null; then # Ok Pandoc is here. # Execute main functions