summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-07-03 18:50:10 +0300
committereug-vs <eug-vs@keemail.me>2021-07-03 18:50:10 +0300
commitc7b1e1f147784284596df8f81896f2deead8eb61 (patch)
tree4f08c392a19203f4f0cd22c4dc586f73efa4ce99
parente0c6ef2e6bc55fb9019fd090c544f22e46cf90ad (diff)
downloadeug-vs-xyz-c7b1e1f147784284596df8f81896f2deead8eb61.tar.gz
chore: add emoji substitute script
-rwxr-xr-xcompile_emoji_sedstring.sh7
-rwxr-xr-xconvert.sh11
-rwxr-xr-xdeploy.sh3
3 files changed, 18 insertions, 3 deletions
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}:|<img src=\"/public/emoji/${EMOJI}\" height=\"24px\" style=\"margin-bottom: -4px\">|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