#!/bin/sh mkdir -p web/static mkdir -p gem fecha=$(date +"%s") echo "empezando conversión, estamos en ${fecha}" echo "revisando y copiando imágenes..." for f in $(find src/ -regextype awk -regex ".*(jpg|png|gif)") do path="web/${f#src/}" # quita el prefijo de src/ y agrega web/ gempath="gem/${f#src/}" # quita el prefijo de src/ y agrega gem/ mkdir -p $(dirname $path) # crea directorio si no existe mkdir -p $(dirname $gempath) # crea directorio si no existe cp -vu $f $path cp -vu $f $gempath done #cp src/tw.txt web/ #cp src/tw.txt gem/ #cp src/llave_sejo.asc web/ #cp src/llave_sejo.asc gem/ cp src/estilo.css web/static/ # limpia echo "limpiando archivos previos..." rm web/*html rm gem/*gmi # crea índice echo "generando índice..." rm src/pages.gmo ls -t src/*gmo | awk -f genindice.awk > src/pages.gmo echo "revisando y convirtiendo archivimos gmo a html y gmi..." i=0 # convierte y actualiza archivos gmi a html for f in $(find src/ -iname *.gmo) do path=${f#src/} # quita el prefijo de "src/" htmlpath="web/${path%gmo}html" # agrega "web/" y cambia el sufijo gempath="gem/${path%gmo}gmi" # agrega "gem/" fecha=$(date -r $f --rfc-3339=date) # echo "${f}" # echo "${f} -> ${htmlpath}" # echo "${f} -> ${gempath}" # haz la conversión awk -v fecha=$fecha -f gemtext2html.awk $f > $htmlpath awk -v fecha=$fecha -f gmo2gmi.awk $f > $gempath (( i++ )) done echo "convertidas ${i} páginas!"