Commit 742529eb authored by Phil Hofmann's avatar Phil Hofmann

Merge branch 'improve-new_post' into 'master'

Improve the `new-post` helper

See merge request !134
parents 764d3654 30756bcf
Pipeline #5642 passed with stage
in 2 minutes and 2 seconds
#!/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