From c7b1e1f147784284596df8f81896f2deead8eb61 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 3 Jul 2021 18:50:10 +0300 Subject: chore: add emoji substitute script --- compile_emoji_sedstring.sh | 7 +++++++ convert.sh | 11 +++++++++-- deploy.sh | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100755 compile_emoji_sedstring.sh diff --git a/compile_emoji_sedstring.sh b/compile_emoji_sedstring.sh new file mode 100755 index 0000000..86e1291 --- /dev/null +++ b/compile_emoji_sedstring.sh @@ -0,0 +1,7 @@ +#!/bin/sh +cd public/emoji; +for EMOJI in *; +do + BASENAME=${EMOJI%.*} + echo "s|:${BASENAME}:||g; " +done diff --git a/convert.sh b/convert.sh index fdf78e5..edb8724 100755 --- a/convert.sh +++ b/convert.sh @@ -1,5 +1,12 @@ #!/bin/sh echo Writing to ${1%.*}.html + +if [ -z "${2}" ]; then + SEDSTRING=$(./compile_emoji_sedstring.sh) +else + SEDSTRING=$2 +fi + cat "$1" \ - | sed 's/.md)/.html)/g' \ - | pandoc -s --from=gfm --to=html -c /style.css -B header.html -H icon.html -M pagetitle="Eugene's Space" --shift-heading-level-by=1 > ${1%.*}.html + | sed "s/.md)/.html)/g; $SEDSTRING" \ + | pandoc -s --from=gfm+emoji --to=html -c /style.css -B header.html -H icon.html -M pagetitle="Eugene's Space" --shift-heading-level-by=1 > ${1%.*}.html diff --git a/deploy.sh b/deploy.sh index 704bcf8..de6af59 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,4 +1,5 @@ #!/bin/sh -find . -type f -name '*.md' -exec ./convert.sh {} \; +EMOJI_SEDSTRING=$(./compile_emoji_sedstring.sh) +find . -type f -name '*.md' -exec ./convert.sh {} "$EMOJI_SEDSTRING" \; rsync -zarv --exclude=".git" --exclude="*.md" . root@eug-vs.xyz:/var/www/website -- cgit v1.2.3