her.esy.fun/engine/org2gemini.sh

30 lines
929 B
Bash
Raw Permalink Normal View History

2020-11-08 20:38:58 +00:00
#!/usr/bin/env bash
cd "$(git rev-parse --show-toplevel)" || exit 1
src="$1"
dst="$2"
2020-11-09 10:37:32 +00:00
./engine/org2gemini_step1.sh "$src" | \
2020-11-22 09:31:04 +00:00
perl -pe 's#^email:\s+yann\@esposito.host\s*#$&=> /files/publickey.txt gpg\n#g;' | \
2021-05-02 09:17:38 +00:00
perl -pe 's# ?\[\[([^]]*)\]\[([^]]*)\]\]#\n\n=> $1 $2\n#g;' | \
2020-11-22 09:31:04 +00:00
perl -pe 's#=> file:([^ ]*)\.org#=> $1.gmi#g;' | \
2020-11-22 10:58:28 +00:00
perl -pe 's#=> file:([^ ]*)#=> $1#g;' | \
2020-11-22 09:31:04 +00:00
perl -pe 's#\[\[(file:)?([^]]*)\]\]#=> $2#g;' | \
2021-05-02 09:17:38 +00:00
perl -pe 's#^\* *\n\n##' | \
2021-05-02 09:28:27 +00:00
# remove lines with a single special char
perl -pe 's#^\s*[-\*\+\.]\s*$##' | \
2020-11-22 09:31:04 +00:00
perl -pe 's#^\**[ ]*:.*:$##' | \
2021-05-02 09:17:38 +00:00
perl -pe 's#^\s[- ]*$#\n#;' > "$dst"
2020-11-22 09:31:04 +00:00
{ echo ""
echo "=> /index.gmi Home"
echo "=> /gem-atom.xml Feed"
echo "=> /slides.gmi Slides"
echo "=> /about-me.gmi About"
echo ""
echo "=> https://gitea.esy.fun code"
echo "=> https://espial.esy.fun/u:yogsototh bookmarks"
echo "=> https://espial.esy.fun/u:yogsototh/notes notes"
} >> "$dst"