aboutsummaryrefslogtreecommitdiffstats
path: root/gem2gem.awk
diff options
context:
space:
mode:
authorsejo <sejo@texto-plano.xyz>2021-05-19 20:19:47 -0500
committersejo <sejo@texto-plano.xyz>2021-05-19 20:19:47 -0500
commita0ce9d274bec7c704c3fa7fae76d28ef3a3a680e (patch)
tree515baf1818db41802359686fca83d2348e8fb446 /gem2gem.awk
parent00b9fd4d76359fef500c19675ea37bcc7ea0a3c9 (diff)
downloadsitio-a0ce9d274bec7c704c3fa7fae76d28ef3a3a680e.tar.gz
gem2gem para convertir enlaces wiki
Diffstat (limited to 'gem2gem.awk')
-rw-r--r--gem2gem.awk37
1 files changed, 37 insertions, 0 deletions
diff --git a/gem2gem.awk b/gem2gem.awk
new file mode 100644
index 0000000..1ede906
--- /dev/null
+++ b/gem2gem.awk
@@ -0,0 +1,37 @@
+function wikiLink( t ){
+ i = match( t, /{.+}/)
+ if ( i ){
+ ifinal = index(t, "}") # índice del } final
+
+ prev = substr(t, 1, i-1) # string previa al link
+ link = substr(t, i, ifinal-i+1) # {link}
+ nombre = substr(t, i+1, ifinal-i-1) # link
+ post = substr(t, ifinal+1) # string posterior
+
+ return "=> " nombre ".gmi " link
+ }
+ else{
+ return t
+ }
+}
+
+{
+ print $0
+}
+
+/{.+}/{
+ 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
+
+ print ""
+ print "=> " nombre ".gmi " link
+}
+
+END{
+ print ""
+ print "página actualizada en: "
+ fecha = system( "date -r " FILENAME " --rfc-3339=date" )
+}
Un proyecto texto-plano.xyz