aboutsummaryrefslogtreecommitdiffstats
path: root/gemtext2html.awk
diff options
context:
space:
mode:
authorsejo <sejo@texto-plano.xyz>2021-05-20 15:50:41 -0500
committersejo <sejo@texto-plano.xyz>2021-05-20 15:50:41 -0500
commit38a33534cfb53885ac21ade9fc88b10477e48e57 (patch)
tree0af769940ac673c9c48476619ea3e33bc4083671 /gemtext2html.awk
parent4ec62574117ee07d4f4a461860f4b87510850381 (diff)
downloadsitio-38a33534cfb53885ac21ade9fc88b10477e48e57.tar.gz
h2 y h3 con id
Diffstat (limited to 'gemtext2html.awk')
-rw-r--r--gemtext2html.awk19
1 files changed, 13 insertions, 6 deletions
diff --git a/gemtext2html.awk b/gemtext2html.awk
index 45980bd..ef40384 100644
--- a/gemtext2html.awk
+++ b/gemtext2html.awk
@@ -248,20 +248,27 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
/^## /{ # h2
if(!modo_pre){
- sub("##[[:blank:]]+","<h2>",$0)
- sub("$","</h2>",$0)
+ sub("##[[:blank:]]+","",$0)
+ sub("$","",$0)
+ # crea header con id
+ appendContenido( "<h2 id='"$0"'>"$0"</h2>" )
bloque = 1
}
- appendContenido( $0 )
+ else{
+ appendContenido( $0 )
+ }
}
/^### /{ # h3
if(!modo_pre){
- sub("###[[:blank:]]+","<h3>",$0)
- sub("$","</h3>",$0)
+ sub("###[[:blank:]]+","",$0)
+ sub("$","",$0)
+ appendContenido( "<h3 id='"$0"'>"$0"</h3>" )
bloque = 1
}
- appendContenido( $0 )
+ else{
+ appendContenido( $0 )
+ }
}
END{
Un proyecto texto-plano.xyz