Improve the `new-post` helper

`new-post 'Livingdocs is on the shortlist for the "Best of Swiss Web
Awards"'` now becomes
`resources/posts/2019-03-01_livingdocs_is_on_the_shortlist_for_the_best_of_swiss_web_awards.md`.
parent 764d3654
#!/bin/sh
function new-post() {
NAME=$(echo "$*" | sed -e "s/ /_/g")
# Snake Case, Lower Case and remove non alphanumeric characters
# (except for `.`, `-`, and `_`)
NAME=$(echo "$*" | sed -e "s/ /_/g" | sed -e 's/\(.*\)/\L\1/' | sed "s/[^[:alpha:].-_]//g")
TARGET=resources/posts/$(date -I)_$NAME.md
TITLE="$*" sh ./.templates/post.md.sh > $TARGET
echo "Created $TARGET"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment