From 5e965ffa80a5c3142abc9f2f4bb67375a5193496 Mon Sep 17 00:00:00 2001 From: sejo Date: Wed, 19 May 2021 20:48:34 -0500 Subject: =?UTF-8?q?comentarios=20y=20formato=20del=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gemtext2html.awk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'gemtext2html.awk') diff --git a/gemtext2html.awk b/gemtext2html.awk index 409de18..6241cfc 100644 --- a/gemtext2html.awk +++ b/gemtext2html.awk @@ -74,6 +74,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales else # nueva línea en el mismo párrafo appendContenido( "
" ) + # busca y convierte wikiLink (máx uno por línea) appendContenido( wikiLink($0) ) } else{ @@ -111,7 +112,8 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales modo_parrafo = 0 appendContenido( "

" ) } - bloque = 1 + + bloque = 1 #empieza bloque porque es

# borra flecha del inicio sub("^=>","",$0) @@ -138,7 +140,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales $0="

"texto"

" } } - else{ + else{ # link externo $0="

"texto"

" } } @@ -157,11 +159,8 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales } sub("*[[:blank:]]+","
  • ",$0) sub("$","
  • ",$0) - appendContenido( $0 ) - } - else{ - appendContenido( $0 ) } + appendContenido( $0 ) } /^```/{ # preformatted @@ -209,6 +208,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales appendContenido( "
    " ) } + # crea header con id appendContenido( "

    "$0"

    " ) # agrega header a navegación @@ -239,8 +239,11 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales } END{ + # imprime y cierra nav print nav print "" + + # imprime contenido print contenido # cierra tags que pudieron haber quedado abiertas if(modo_pre) @@ -250,6 +253,7 @@ END{ else if(modo_lista) print "" + # finaliza... print "
    " print "" print "