2 # gmi2html: Sed script to convert text/gemini to html.
3 # Based on v0.14.2 of the gemini spec.
5 # This script is dedicated to the public domain according to the terms of CC0:
6 # https://creativecommons.org/publicdomain/zero/1.0/
8 # TODO: add meta charset header, I suppose, to ensure utf8?
16 s/^((=?>).*)>/\1\>/
29 s/.*/<head><title>&<\/title><\/head>/
49 s/^\* (.*)/<li>\1<\/li>/
50 s/^=>\s*([^[:space:]]+)\s*$/<li><a href="\1">\1<\/a><\/li>/
51 s/^=>\s*([^[:space:]]+)\s+(.+)/<li><a href="\1">\2<\/a><\/li>/
65 s/^\* (.*)/<ul><li>\1<\/li>/
67 s/^=>\s*([^[:space:]]+)\s*$/<ul><li><a href="\1">\1<\/a><\/li>/
68 s/^=>\s*([^[:space:]]+)\s+(.+)/<ul><li><a href="\1">\2<\/a><\/li>/
70 s/^###\s*(.*)/<h3>\1<\/h3>/
71 s/^##\s*(.*)/<h2>\1<\/h2>/
72 s/^#\s*(.*)/<h1>\1<\/h1>/
74 s/^>\s*(.*)/<blockquote>\1<\/blockquote>/