agregando estilos

This commit is contained in:
sejo 2021-05-19 22:21:49 -05:00
parent 4498c5c129
commit 72c93faec7
2 changed files with 90 additions and 10 deletions

View File

@ -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 <img>
# 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 <ul>, <pre>, <p>:
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 "<title>"titulo"</title>"
print "<title>" sitio " &mdash; " titulo "</title>"
print "</head>"
print "<body>"
print "<header>"
print "<p><a href='./index.html'>{" sitio "}</a></p>"
print "<h1>"titulo"</h1>"
print "</header>"
@ -95,10 +101,15 @@ $0 !~ /^(=>|```|#{1,3} |* |>|[[:blank:]]*$)/{ # líneas de texto (no "especiales
modo_parrafo = 0
appendContenido( "</p>" )
}
else if( bloque ) # si lo previo fue header o blockquote
bloque = 0;
else if( modo_galeria ){
modo_galeria = 0
appendContenido( "</gallery>" )
}
# else
# appendContenido( "<br/>" )
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 <img>
$0="<img src='"$1"' alt='"texto"' loading='lazy'/>"
if( !modo_galeria ){
appendContenido("<gallery>")
modo_galeria = 1
}
appendContenido("<img src='"$1"' alt='"texto"' loading='lazy'/>")
}
# 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 <a>
$0="<p><a href='"$1"'>"texto"</a></p>"
appendContenido("<p><a href='"$1"'>"texto"</a></p>")
}
}
else{ # link externo
$0="<p><a href='"$1"' rel=external target=_blank>"texto"</a></p>"
appendContenido("<p><a href='"$1"' rel=external target=_blank>"texto"</a></p>")
}
}
appendContenido( $0 )
else{
appendContenido( $0 )
}
}
/^* /{ # lista
@ -263,7 +280,8 @@ END{
print "<p>página actualizada en: "
fecha = system( "date -r " FILENAME " --rfc-3339=date" )
print "</p>"
print "<p><a href='./index.html'>inicio</a></p>"
print "<p><a href='./index.html'>{" sitio "}</a></p>"
print "<a href='https://endefensadelsl.org/ppl_es.html' rel=external target=_blank>ppl: licencia de producción de pares</a></p>"
print "</footer>"
print "</body>"
print "</html>"

62
web/static/estilo.css Normal file
View File

@ -0,0 +1,62 @@
/* links en el sitio */
a[href^="./"]{
text-decoration:none;
}
/* links externos */
a[rel=external]:after{
content:"↝";
}
a{
color: #363;
}
a:hover{
background-color: #363;
color: #fff;
}
a:visited{
color: #773;
}
a:visited:hover{
background-color: #773;
color: #fff;
}
body{
color: #333;
max-width:40em;
margin:0 auto;
font-size:18px;
padding: 1em;
}
nav,footer,section{
border-top: 1px dotted;
}
footer{
font-size: small;
text-align: center;
}
pre{
background-color: #ddd;
padding:1em;
}
gallery{
display:flex;
flex-direction:row;
flex-wrap:wrap;
justify-content:space-evenly;
align-content:center;
}
img{
margin:10px;
}
nav{
font-size:smaller;
}
nav li{
list-style-type:square;
}