From 6b996ddf86f52bcdb3c35f0ccbcffc1cf5b90b22 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Sat, 2 Jul 2022 18:53:17 -0300 Subject: [PATCH] fix gmi/html permalink issue --- projects/website/nix/website.nix | 13 ++++++++----- projects/website/src/_notes/start-here.md | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/projects/website/nix/website.nix b/projects/website/nix/website.nix index e312e392..b7d30f59 100644 --- a/projects/website/nix/website.nix +++ b/projects/website/nix/website.nix @@ -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" diff --git a/projects/website/src/_notes/start-here.md b/projects/website/src/_notes/start-here.md index 44bbcc47..6b668229 100644 --- a/projects/website/src/_notes/start-here.md +++ b/projects/website/src/_notes/start-here.md @@ -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!