hugosoucycc

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

commit 4f1a97111b4799b4ef3b6bdfc181014b3236bfcd
parent 3925ccaf8b9f19e295444cca36aed963674d4e45
Author: Hugo Soucy <hugo@soucy.cc>
Date:   Sat, 18 Mar 2017 09:43:11 -0400

Change to way of create file name.

Diffstat:
Mfakestache | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fakestache b/fakestache @@ -42,11 +42,11 @@ if is_in_array "$1" "${archetypes[@]}" == 1; then archetype_datetime=$NOW_DATETIME archetype_template="$1" - # Remove special chars and white spaces for the filename - archetype_title_nospecials=${archetype_title//[\'!,:;?]/} - archetype_filename=${archetype_title_nospecials// /-}.md - # Use this instead : echo Hej på dig, du den dära | iconv -f utf-8 -t us-ascii//translit - # Source <http://stackoverflow.com/questions/1975057/bash-convert-non-ascii-characters-to-ascii> + # 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_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}/"