diff options
Diffstat (limited to 'gmo2gmi.awk')
-rw-r--r-- | gmo2gmi.awk | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gmo2gmi.awk b/gmo2gmi.awk new file mode 100644 index 0000000..b54dae0 --- /dev/null +++ b/gmo2gmi.awk @@ -0,0 +1,47 @@ +function nombre2Link( t, r ){ # convierte un nombre con espacios, a uno con r (e.g. "_" + gsub(" ",r,t); + return t +} + +/^+ /{ # literal html + next # salta la línea +} + +/^& /{ # literal gemtext + sub(/^& /,"",$0) + print $0 + next + +} + +# imprime líneas normamlmente + +{ + print $0 +} + +# si tienen sintaxis de wikilink, y no son líneas de enlace, agrega el link +# (el % es por las líneas de uxn jaja) +/^[^=%].+{.+}/{ + i = match( $0, /{.+}/) + ifinal = index($0, "}") # índice del } final + + link = substr($0, i, ifinal-i+1) # {link} + nombre = substr($0, i+1, ifinal-i-1) # link + nombre = nombre2Link( nombre, "_" ) + + print "=> ./" nombre ".gmi " link +} + +# agrega footer + +END{ + print "" + print "página actualizada en: " fechasjm " (1" fecha ")" +# print "=> ./index.gmi {🥭}" +# print "=> ./index.gmi {🧆}" + print "=> ./index.gmi {lenteja numérica}" + print "" + print "=> https://endefensadelsl.org/ppl_es.html ppl: licencia de producción de pares" +# fecha = system( "date -r " FILENAME " --rfc-3339=date" ) +} |