summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eug-vs@keemail.me>2021-07-03 19:46:33 +0300
committereug-vs <eug-vs@keemail.me>2021-07-03 19:46:45 +0300
commit317c9b42081aa033abd7b46f05f47428f2942ae7 (patch)
treec3fb6c8d0898c8b897341ae7e14f3ea34273cbca
parent22e5cfc2ed1e8a654257507e2f3078007ed4b318 (diff)
downloadeug-vs-xyz-317c9b42081aa033abd7b46f05f47428f2942ae7.tar.gz
feat: gather scripts into Makefile
-rw-r--r--Makefile28
-rwxr-xr-xcompile_emoji_sedstring.sh2
-rwxr-xr-xconvert.sh12
-rwxr-xr-xdeploy.sh5
4 files changed, 29 insertions, 18 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7a64cdc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,28 @@
+RSYNC_DESTINATION=root@eug-vs.xyz:/var/www/website
+
+MARKDOWN=gfm+emoji
+STYLESHEET=/style.css
+HEADER=header.html
+ICON=icon.html
+PAGETITLE="Eugene's Space"
+PANDOC_ARGS=-s --from=$(MARKDOWN) --to=html -c $(STYLESHEET) -B $(HEADER) -H $(ICON) -M pagetitle=$(PAGETITLE) --shift-heading-level-by=1
+
+LINK_SEDSTRING=s/.md)/.html)/g;
+EMOJI_SEDSTRING=$(shell ./compile_emoji_sedstring.sh)
+
+SOURCES=$(wildcard *.md blog/*.md)
+HTML=$(patsubst %.md, %.html, $(SOURCES))
+
+
+all: $(HTML)
+
+%.html: %.md
+ @echo $@
+ @cat $< | sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" | pandoc $(PANDOC_ARGS) > $@
+
+deploy: $(HTML)
+ rsync -zarv --exclude=".git" --exclude="*.md" . $(RSYNC_DESTINATION)
+
+clean:
+ rm -f $(HTML)
+
diff --git a/compile_emoji_sedstring.sh b/compile_emoji_sedstring.sh
index 86e1291..2a71715 100755
--- a/compile_emoji_sedstring.sh
+++ b/compile_emoji_sedstring.sh
@@ -3,5 +3,5 @@ cd public/emoji;
for EMOJI in *;
do
BASENAME=${EMOJI%.*}
- echo "s|:${BASENAME}:|<img src=\"/public/emoji/${EMOJI}\" height=\"24px\" style=\"margin-bottom: -4px\">|g; "
+ echo "s|:${BASENAME}:|<img src=\\\"/public/emoji/${EMOJI}\\\" height=\\\"24px\\\" style=\\\"margin-bottom: -4px\\\">|g; "
done
diff --git a/convert.sh b/convert.sh
deleted file mode 100755
index edb8724..0000000
--- a/convert.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/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; $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
deleted file mode 100755
index de6af59..0000000
--- a/deploy.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/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
-