xref: /haiku/3rdparty/mmu_man/scripts/hugo_to_pandoc.sh (revision 6f80a9801fedbe7355c4360bd204ba746ec3ec2d)
1#!/bin/sh
2
3# This script tries to convert a hugo markdown source into a markdown that pandoc can read, to convert to ODT for example.
4
5# First filter turns inline links into footnotes with italic link text and monospace URL.
6# Second filter turns img tags into regular markdown images
7# Third filter converts enough of the Hugo header into pandoc's own header format.
8
9sed -r 's/\[([^\[]*)\]\(([^()]*)\)/*\1*^[`\2`]/g' | \
10sed -r 's,<img src=\"([^"]*)\".*title=\"([^"]*)\".*>,![\2](static\1),g' | \
11sed -r '/^\+\+\+$/{c\
12---
13};/^tags = \[.*$/d;1,5s/(.*) = "(.*)"/\1: \2/'
14