agrega decisión para links locales

This commit is contained in:
sejo 2021-05-19 20:31:57 -05:00
parent a190c3707b
commit eb41e8b03b
1 changed files with 16 additions and 14 deletions

View File

@ -43,7 +43,7 @@ function wikiLink( t ){
nombre = substr(t, i+1, ifinal-i-1) # link nombre = substr(t, i+1, ifinal-i-1) # link
post = substr(t, ifinal+1) # string posterior 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{ else{
return t return t
@ -121,18 +121,20 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
texto = texto" "$i texto = texto" "$i
} }
# si el path es imagen if( match($1, /^\.\//)) { # si es link local
if( match($1, /(png|jpg|gif)$/) ){ # si el path es imagen
# crea imagen <img> if( match($1, /(png|jpg|gif)$/) ){
$0="<img src='"$1"' alt='"texto"'/>" # crea imagen <img>
} $0="<img src='"$1"' alt='"texto"'/>"
# si el path no es imagen }
else{ # si el path no es imagen
# convierte enlace de .gmi a .html ! else{
sub(".gmi$",".html",$1) # convierte enlace de .gmi a .html !
sub(".gmi$",".html",$1)
# crea link <a> # crea link <a>
$0="<a href='"$1"'>"texto"</a><br/>" $0="<p><a href='"$1"'>"texto"</a></p>"
}
} }
} }
appendContenido( $0 ) appendContenido( $0 )
@ -235,7 +237,7 @@ END{
print nav print nav
print "</ul></nav>" print "</ul></nav>"
print contenido print contenido
# cierra tags que pudiero n haber quedado abiertas # cierra tags que pudieron haber quedado abiertas
if(modo_pre) if(modo_pre)
print "</pre>" print "</pre>"
else if(modo_parrafo) else if(modo_parrafo)
@ -249,7 +251,7 @@ END{
print "<p>página actualizada en: " print "<p>página actualizada en: "
fecha = system( "date -r " FILENAME " --rfc-3339=date" ) fecha = system( "date -r " FILENAME " --rfc-3339=date" )
print "</p>" print "</p>"
print "<p><a href='./index.html'>inicio</a></p>"
print "</footer>" print "</footer>"
print "</body>" print "</body>"
print "</html>" print "</html>"