diff options
author | sejo <sejo@texto-plano.xyz> | 2021-05-20 16:29:48 -0500 |
---|---|---|
committer | sejo <sejo@texto-plano.xyz> | 2021-05-20 16:29:48 -0500 |
commit | 77bdaf00ef1e72362f423179a9cbe056a027193f (patch) | |
tree | 48343b867fd7046a301c8b65248172863f752b62 /generasitio.sh | |
parent | 7ed55bdd291c4ae654a5fe7f22e062e48a9b854c (diff) | |
download | sitio-77bdaf00ef1e72362f423179a9cbe056a027193f.tar.gz |
fechas
Diffstat (limited to 'generasitio.sh')
-rwxr-xr-x | generasitio.sh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/generasitio.sh b/generasitio.sh index cbd8b5a..a0705bc 100755 --- a/generasitio.sh +++ b/generasitio.sh @@ -10,20 +10,32 @@ done echo "revisando y convirtiendo archivimos gmi a html..." +orig=$(date +"%s" -d "1989-07-27") + # convierte y actualiza archivos gmi a html -for f in $(find src/ -iname *.gmi) +for f in $(find src/ -iname *.gmo) do path=${f#src/} # quita el prefijo de "src/" - htmlpath="web/${path%gmi}html" # agrega "web/" y cambia el sufijo - gempath="gem/${path}" # agrega "gem/" + htmlpath="web/${path%gmo}html" # agrega "web/" y cambia el sufijo + gempath="gem/${path%gmo}gmi" # agrega "gem/" + fecha=$(date -r $f +"%s") + + sem=$(echo "(${fecha} - ${orig})/3600/24/7" | bc) + dia=$(echo "(${fecha} - ${orig})/3600/24%7 + 1" | bc) + + fechasjm="sejmana-${sem}, día ${dia}" + fecha=$(date -r $f --rfc-3339=date) + + # if [ $f -nt $htmlpath ] # si archivo gmi es "newer than" el html # then - echo "${f} -> ${htmlpath}" - echo "${f} -> ${gempath}" + echo "${f}" +# echo "${f} -> ${htmlpath}" +# echo "${f} -> ${gempath}" # mkdir -p $(dirname $htmlpath) # crea el directorio si no existe # mkdir -p $(dirname $htmlpath) # crea el directorio si no existe # haz la conversión - awk -f gemtext2html.awk $f > $htmlpath - awk -f gem2gem.awk $f > $gempath + awk -v fecha=$fecha -v fechasjm="$fechasjm" -f gemtext2html.awk $f > $htmlpath + awk -v fecha=$fecha -v fechasjm="$fechasjm" -f gem2gem.awk $f > $gempath # fi done |