yosup/log/gmi2md
William Casarin 9788baa322 latest
Signed-off-by: William Casarin <jb55@jb55.com>
2022-08-19 11:15:26 -07:00

25 lines
451 B
Text
Executable file

#!/usr/bin/env sedef
# gmi2md: Sed script to convert text/gemini to markdown.
# Based on v0.14.2 of the gemini spec.
#
# This script is dedicated to the public domain according to the terms of CC0:
# https://creativecommons.org/publicdomain/zero/1.0/
x
/^```/ {
x
/^```/ {
x
s/.*//
x
}
b
}
g
/^=>/ {
s/[][()]/\\&/g
s/^=>\s*([^[:space:]]+)\s*$/[\1](\1)/
s/^=>\s*([^[:space:]]+)\s+(.+)/[\2](\1)/
}