diff options
author | sejo <sejo@texto-plano.xyz> | 2021-05-19 20:31:57 -0500 |
---|---|---|
committer | sejo <sejo@texto-plano.xyz> | 2021-05-19 20:31:57 -0500 |
commit | eb41e8b03bbcba93d23d04cb616e1400e4ff204e (patch) | |
tree | aaa85be7251cbff351e08c73c946b70efa8504a7 /gemtext2html.awk | |
parent | a190c3707b5e31a11890af657f96960b05d5f38e (diff) | |
download | sitio-eb41e8b03bbcba93d23d04cb616e1400e4ff204e.tar.gz |
agrega decisión para links locales
Diffstat (limited to 'gemtext2html.awk')
-rw-r--r-- | gemtext2html.awk | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/gemtext2html.awk b/gemtext2html.awk index f2739ea..02271cf 100644 --- a/gemtext2html.awk +++ b/gemtext2html.awk @@ -43,7 +43,7 @@ function wikiLink( t ){ nombre = substr(t, i+1, ifinal-i-1) # link post = substr(t, ifinal+1) # string posterior - return prev "<a href='" nombre ".html'>" link "</a>" post + return prev "<a href='./" nombre ".html'>" link "</a>" post } else{ return t @@ -121,18 +121,20 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales texto = texto" "$i } - # si el path es imagen - if( match($1, /(png|jpg|gif)$/) ){ - # crea imagen <img> - $0="<img src='"$1"' alt='"texto"'/>" - } - # si el path no es imagen - else{ - # convierte enlace de .gmi a .html ! - sub(".gmi$",".html",$1) + if( match($1, /^\.\//)) { # si es link local + # si el path es imagen + if( match($1, /(png|jpg|gif)$/) ){ + # crea imagen <img> + $0="<img src='"$1"' alt='"texto"'/>" + } + # si el path no es imagen + else{ + # convierte enlace de .gmi a .html ! + sub(".gmi$",".html",$1) - # crea link <a> - $0="<a href='"$1"'>"texto"</a><br/>" + # crea link <a> + $0="<p><a href='"$1"'>"texto"</a></p>" + } } } appendContenido( $0 ) @@ -235,7 +237,7 @@ END{ print nav print "</ul></nav>" print contenido - # cierra tags que pudiero n haber quedado abiertas + # cierra tags que pudieron haber quedado abiertas if(modo_pre) print "</pre>" else if(modo_parrafo) @@ -249,7 +251,7 @@ END{ print "<p>página actualizada en: " fecha = system( "date -r " FILENAME " --rfc-3339=date" ) print "</p>" - + print "<p><a href='./index.html'>inicio</a></p>" print "</footer>" print "</body>" print "</html>" |