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
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>"