aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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