diff options
author | sejo <sejo@texto-plano.xyz> | 2021-06-06 19:45:11 -0500 |
---|---|---|
committer | sejo <sejo@texto-plano.xyz> | 2021-06-06 19:45:11 -0500 |
commit | f5abc39ada0ebfedca4a089ad1f1891f462ce2e4 (patch) | |
tree | f071240b8cd36ca2b72bad3fb0bb88ab2bdd13ef /gmo2gmi.awk | |
parent | 0f8637dc51f82f5c8db06233b1e189891e787751 (diff) | |
download | sitio-f5abc39ada0ebfedca4a089ad1f1891f462ce2e4.tar.gz |
corrección espacios en wikilinks
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" ) +} |