aboutsummaryrefslogtreecommitdiffstats
path: root/gemtext2html.awk
diff options
context:
space:
mode:
authorsejo <sejo@texto-plano.xyz>2021-05-20 16:02:36 -0500
committersejo <sejo@texto-plano.xyz>2021-05-20 16:02:36 -0500
commiteda062e6192566b821b0b0e5f51d5c66e29fb6bc (patch)
tree477f7b8de4684b23920e74eb5fe4ed23bb2400e2 /gemtext2html.awk
parent38a33534cfb53885ac21ade9fc88b10477e48e57 (diff)
downloadsitio-eda062e6192566b821b0b0e5f51d5c66e29fb6bc.tar.gz
+ para incluir líneas html literales
Diffstat (limited to 'gemtext2html.awk')
-rw-r--r--gemtext2html.awk50
1 files changed, 33 insertions, 17 deletions
diff --git a/gemtext2html.awk b/gemtext2html.awk
index ef40384..c7e5fdc 100644
--- a/gemtext2html.awk
+++ b/gemtext2html.awk
@@ -77,24 +77,15 @@ NR == 1{
bloque = 1
- getline # lee la siguiente línea
+ next # lee la siguiente línea
}
-$0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales")
- if(!modo_pre){
- if(!modo_parrafo){
- modo_parrafo = 1
- appendContenido( "<p>" )
- }
- else # nueva línea en el mismo párrafo
- appendContenido( "<br/>" )
-
- # busca y convierte wikiLink (máx uno por línea)
- appendContenido( wikiLink($0) )
- }
- else{
- appendContenido( $0 )
- }
+
+
+/^\+/{ # include literal
+ sub("^+","",$0) # elimina el +
+ appendContenido( $0 )
+ next
}
/^[[:blank:]]*$/ { # línea vacía
@@ -119,7 +110,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
}
else
appendContenido( $0 )
-
+ next
}
/^=>/{ # link
@@ -171,6 +162,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
else{
appendContenido( $0 )
}
+ next
}
/^* /{ # lista
@@ -187,6 +179,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
sub("$","</li>",$0)
}
appendContenido( $0 )
+ next
}
/^```/{ # preformatted
@@ -209,6 +202,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
modo_pre = 1
appendContenido( "<pre>" )
}
+ next
}
/^> /{ # blockquote
@@ -218,6 +212,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
bloque = 1
}
appendContenido( $0 )
+ next
}
/^# /{ # h1
@@ -243,6 +238,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
else{
appendContenido( $0 )
}
+ next
}
@@ -257,6 +253,7 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
else{
appendContenido( $0 )
}
+ next
}
/^### /{ # h3
@@ -269,6 +266,25 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
else{
appendContenido( $0 )
}
+ next
+}
+
+#$0 !~ /^(=>|```|#{1,3} |* |\+|>|[[:blank:]]*$)/{ # líneas de texto (no "especiales")
+{ # cualquier otra línea de texto
+ if(!modo_pre){
+ if(!modo_parrafo){
+ modo_parrafo = 1
+ appendContenido( "<p>" )
+ }
+ else # nueva línea en el mismo párrafo
+ appendContenido( "<br/>" )
+
+ # busca y convierte wikiLink (máx uno por línea)
+ appendContenido( wikiLink($0) )
+ }
+ else{
+ appendContenido( $0 )
+ }
}
END{
Un proyecto texto-plano.xyz