citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

gmi2md (452B)


      1 #!/home/jb55/bin/sedef
      2 # gmi2md: Sed script to convert text/gemini to markdown.
      3 # Based on v0.14.2 of the gemini spec.
      4 #
      5 # This script is dedicated to the public domain according to the terms of CC0:
      6 # https://creativecommons.org/publicdomain/zero/1.0/
      7 
      8 x
      9 /^```/ {
     10     x
     11     /^```/ {
     12         x
     13         s/.*//
     14         x
     15     }
     16     b
     17 }
     18 g
     19 
     20 /^=>/ {
     21     s/[][()]/\\&/g
     22     s/^=>\s*([^[:space:]]+)\s*$/[\1](\1)/
     23     s/^=>\s*([^[:space:]]+)\s+(.+)/[\2](\1)/
     24 }