commit 16b2e6636fc6f2b2ce8102a44a9804b31c2b9dfe parent a39f09840185a8d499f7478e784a2133e5d5f634 Author: William Casarin <jb55@jb55.com> Date: Sat, 7 Nov 2020 21:21:55 -0800 bin: add gmi2md Diffstat:
A | bin/gmi2md | | | 24 | ++++++++++++++++++++++++ |
A | bin/sedef | | | 2 | ++ |
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/bin/gmi2md b/bin/gmi2md @@ -0,0 +1,24 @@ +#!/home/jb55/bin/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)/ +} diff --git a/bin/sedef b/bin/sedef @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +exec sed -Ef "$@"