From 6f80a9801fedbe7355c4360bd204ba746ec3ec2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Sun, 29 May 2022 23:29:46 +0200 Subject: [PATCH] Some script for a crude convertion from Hugo to Pandoc I wrote this to make a print copy of my lenovo blog post. Change-Id: Id39bfda3d95532a4049b58d9008b695f340513ed --- 3rdparty/mmu_man/scripts/hugo_to_pandoc.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 3rdparty/mmu_man/scripts/hugo_to_pandoc.sh diff --git a/3rdparty/mmu_man/scripts/hugo_to_pandoc.sh b/3rdparty/mmu_man/scripts/hugo_to_pandoc.sh new file mode 100755 index 0000000000..eb2df57137 --- /dev/null +++ b/3rdparty/mmu_man/scripts/hugo_to_pandoc.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# This script tries to convert a hugo markdown source into a markdown that pandoc can read, to convert to ODT for example. + +# First filter turns inline links into footnotes with italic link text and monospace URL. +# Second filter turns img tags into regular markdown images +# Third filter converts enough of the Hugo header into pandoc's own header format. + +sed -r 's/\[([^\[]*)\]\(([^()]*)\)/*\1*^[`\2`]/g' | \ +sed -r 's,,![\2](static\1),g' | \ +sed -r '/^\+\+\+$/{c\ +--- +};/^tags = \[.*$/d;1,5s/(.*) = "(.*)"/\1: \2/'