diff options
author | sejo <sejo@texto-plano.xyz> | 2021-05-20 16:13:28 -0500 |
---|---|---|
committer | sejo <sejo@texto-plano.xyz> | 2021-05-20 16:13:28 -0500 |
commit | 7ed55bdd291c4ae654a5fe7f22e062e48a9b854c (patch) | |
tree | 1cdaa1f52e1db5cb67fdc9ec6cf7f6266aee1b6c | |
parent | e6d54f976e313e149e5f3688d4db3c23cfb5adf5 (diff) | |
download | sitio-7ed55bdd291c4ae654a5fe7f22e062e48a9b854c.tar.gz |
no imprimas <nav> vacíos
-rw-r--r-- | gemtext2html.awk | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gemtext2html.awk b/gemtext2html.awk index 0fa9326..d81c991 100644 --- a/gemtext2html.awk +++ b/gemtext2html.awk @@ -17,7 +17,9 @@ BEGIN{ modo_parrafo = 0 modo_galeria = 0 - en_section = 1 + en_section = 1 #empezamos abriendo una <section> sin h1 + + navcount = 0 bloque = 0 # para no agregar <br/> después de headers y blockquotes @@ -37,6 +39,7 @@ function appendContenido( t ){ } function appendNav( t ){ nav = nav t "\n" + navcount++ } function wikiLink( t ){ @@ -82,7 +85,7 @@ NR == 1{ -/^\+/{ # include literal +/^\+ /{ # include literal sub(/^+ /,"",$0) # elimina el + appendContenido( $0 ) next @@ -293,8 +296,10 @@ NR == 1{ END{ # imprime y cierra nav - print nav - print "</ul></nav>" + if(navcount){ + print nav + print "</ul></nav>" + } # imprime contenido print contenido |