From f5abc39ada0ebfedca4a089ad1f1891f462ce2e4 Mon Sep 17 00:00:00 2001 From: sejo Date: Sun, 6 Jun 2021 19:45:11 -0500 Subject: =?UTF-8?q?correcci=C3=B3n=20espacios=20en=20wikilinks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gmo2gmi.awk | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gmo2gmi.awk (limited to 'gmo2gmi.awk') 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" ) +} -- cgit v1.2.3