fix gmi/html permalink issue

This commit is contained in:
Gabriel Fontes
2022-07-02 18:53:17 -03:00
parent 8ba85bed3b
commit 6b996ddf86
2 changed files with 10 additions and 7 deletions
+8 -5
View File
@@ -37,15 +37,18 @@ stdenv.mkDerivation {
sed -n '/---/,/---/p' "$mdfile" > "$gmifile"
# Turn markdown linebreaks into actual breaks, as well as link lists, so md2gemini respects it
sed -r 's/(^\[.*\]\(.*\))(\s*\\+|\s\s+)$/\1\n/gm' "$mdfile" | \
sed -r 's/^-\s+(\[.*\]\(.*\))$/\1\n/gm' | \
md2gemini \
--frontmatter --links copy --plain --md-links >> "$gmifile"
sed -E 's/(^\[.*\]\(.*\))(\s*\\+|\s\s+)$/\1\n/gm' "$mdfile" | \
sed -E 's/^-\s+(\[.*\]\(.*\))$/\1\n/gm' | \
md2gemini --frontmatter --links copy --plain --md-links >> "$gmifile"
# Fix CRLF
dos2unix "$gmifile"
# Strip SVGs
sed -ri 's@\{% include icons/.*\.svg %\}@@g' "$gmifile"
sed -Ei 's/\{% include icons\/.*\.svg %\}//g' "$gmifile"
# Rewrite frontmatter containing .html permalinks into .gmi ones
sed -Ei 's/(^permalink:.*)\.html/\1\.gmi/g' "$gmifile"
# Rewrite relative .html links into .gmi
sed -Ei 's/(^=>\s+\..*)\.html/\1\.gmi/g' "$gmifile"
# Trim double newlines between links
perl -0777 -pe 's/(^=>.*$)\n\n=>/\1\n=>/mg' -i "$gmifile"
perl -0777 -pe 's/(^=>.*$)\n\n=>/\1\n=>/mg' -i "$gmifile"
+2 -2
View File
@@ -8,7 +8,7 @@ Hey! Welcome to my website and personal wiki.
## What's this?
If you're here for info about me, visit the [homepage](../index.md). If you're interested
in more polished writing, check the [blog](../blog.md) (if I ever get to write
in more polished writing, check the [blog](../blog.html) (if I ever get to write
something better, that is). If you're interested in my personal knowledge and
work-in-progress notes, you're in the right place!
@@ -24,7 +24,7 @@ This section of my website ("notes") is my "second brain", "digital garden",
You'll find random notes, class notes, links, work in progress guides, and more
here.
To start browsing, check the [notes homepage](../notes.md). You'll find everything
To start browsing, check the [notes homepage](../notes.html). You'll find everything
grouped by tags they belong to.
All notes have backlinking, so just click away!