From 72c93faec78c967f9fb101430ebb110cc2e97547 Mon Sep 17 00:00:00 2001
From: sejo
Date: Wed, 19 May 2021 22:21:49 -0500
Subject: agregando estilos
---
gemtext2html.awk | 38 ++++++++++++++++++++++++++++----------
1 file changed, 28 insertions(+), 10 deletions(-)
(limited to 'gemtext2html.awk')
diff --git a/gemtext2html.awk b/gemtext2html.awk
index c808a40..ce11980 100644
--- a/gemtext2html.awk
+++ b/gemtext2html.awk
@@ -1,16 +1,21 @@
# gemtext2html
# convierte un archivo en gemtext a html de acuerdo a la spec
# excepción: enlaces a imagen (jpg, png, gif) se vuelven
+# TODO actualizar descripción
+#
+# importante: solo un {wikilink} (con o sin espacios) por línea
#
# modo de uso:
# awk -f gemtext2html.awk archivo.gmi > archivo.html
#
BEGIN{
+ sitio = "HOLO"
# para poder abrir y cerrar , :
modo_lista = 0
modo_pre = 0
modo_parrafo = 0
+ modo_galeria = 0
en_section = 1
@@ -28,10 +33,10 @@ BEGIN{
}
function appendContenido( t ){
- contenido = contenido t
+ contenido = contenido t "\n"
}
function appendNav( t ){
- nav = nav t
+ nav = nav t "\n"
}
function wikiLink( t ){
@@ -56,10 +61,11 @@ function wikiLink( t ){
NR == 1{
titulo = $0
sub("#[[:blank:]]+","",titulo) #prefijo
- print "
"titulo""
+ print "" sitio " — " titulo ""
print ""
print ""
print ""
@@ -95,10 +101,15 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
modo_parrafo = 0
appendContenido( "
" )
}
- else if( bloque ) # si lo previo fue header o blockquote
- bloque = 0;
+ else if( modo_galeria ){
+ modo_galeria = 0
+ appendContenido( "" )
+ }
# else
# appendContenido( "
" )
+ if( bloque ) # si lo previo fue header o blockquote
+ bloque = 0;
+
}
else
appendContenido( $0 )
@@ -132,7 +143,11 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
# si el path es imagen
if( match($1, /(png|jpg|gif)$/) ){
# crea imagen
- $0=""
+ if( !modo_galeria ){
+ appendContenido("")
+ modo_galeria = 1
+ }
+ appendContenido("")
}
# si el path no es imagen
else{
@@ -140,14 +155,16 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
sub(".gmi$",".html",$1)
# crea link
- $0=""texto"
"
+ appendContenido(""texto"
")
}
}
else{ # link externo
- $0=""texto"
"
+ appendContenido(""texto"
")
}
}
- appendContenido( $0 )
+ else{
+ appendContenido( $0 )
+ }
}
/^* /{ # lista
@@ -263,7 +280,8 @@ END{
print "página actualizada en: "
fecha = system( "date -r " FILENAME " --rfc-3339=date" )
print "
"
- print "inicio
"
+ print "{" sitio "}
"
+ print "ppl: licencia de producción de pares"
print ""
print ""
print "