summaryrefslogtreecommitdiff
path: root/platform/bin/doku2md.sh
diff options
context:
space:
mode:
Diffstat (limited to 'platform/bin/doku2md.sh')
-rwxr-xr-xplatform/bin/doku2md.sh73
1 files changed, 53 insertions, 20 deletions
diff --git a/platform/bin/doku2md.sh b/platform/bin/doku2md.sh
index a3f0a13..635effb 100755
--- a/platform/bin/doku2md.sh
+++ b/platform/bin/doku2md.sh
@@ -1,4 +1,7 @@
#!/bin/bash
+# USO : ./doku2md.sh ../../content/illich/contents/books/deschooling/en.txt
+# Genera un .md en la misma carpeta del archivo. Luego ese .md se puede usar dentro de la carpeta book para generar un PDF.
+
### Script para dejar listo los .txt de Doku para hacerlos markdown
url='https://illich.test/'
@@ -11,6 +14,12 @@ IFS=$'\n'
lang=${name: -2}
+ echo "DIR: $dir"
+ echo "NAME: $name"
+ echo "LANG: $lang"
+
+ read
+
## Corta el archivo en dos, empezando por la linea de la primera footnote
n=`grep -n -m 1 ':]' $1 |sed 's/\([0-9]*\).*/\1/'`
@@ -31,6 +40,10 @@ IFS=$'\n'
sed 's/:]/]:/g' $1.tmp > $name.body.tmp
+ cat $name.body.tmp
+
+ read
+
## Borra temporales
@@ -38,11 +51,20 @@ IFS=$'\n'
# agregar cabecera para pandoc!
-if test -f "$dir/index.txt"; then
+if test -f "$dir/index"; then
echo "hay index"
- yaml_title=`head -n1 "$dir/index.txt" | sed 's/# //g'`
- yaml_date=`grep 'LANG_publicationdate' "$dir/index.txt" | cut -d ':' -f2 | sed 's/ //'`
- yaml_author=`grep 'LANG_author' "$dir/index.txt" | cut -d ':' -f2 | sed 's/ //'`
+ LANGORIG=`cat "$dir/index" | grep langorig | cut -d "@" -f 4 | cut -d "_" -f 3`
+ if [[ $lang == $LANGORIG ]]; then
+ echo "Se procesa en idioma original"
+ yaml_title=`grep 'LANG_titleorig' "$dir/index" | cut -d '_' -f3`
+ else
+ echo "No se procesa en idioma original"
+ yaml_title=`head -n1 $1 | sed s/\#\ //`
+ fi
+
+
+ yaml_date=`grep 'LANG_publicationdate' "$dir/index" | cut -d ':' -f2 | sed 's/** //'`
+ yaml_author=`grep 'LANG_author' "$dir/index" | cut -d ':' -f2 | sed 's/ //'`
if [ -z "$yaml_author" ]
then
yaml_author="Ivan Illich"
@@ -57,31 +79,42 @@ if test -f "$dir/index.txt"; then
esac
fi
- meta=`echo "$name.changes" | sed 's/pages/meta/'`
- # el numero de revision es un unix timestamp
- revision=`cat $meta | tail -n1 | cut -f1`
+ # meta=`echo "$name.changes" | sed 's/pages/meta/'`
+ # # el numero de revision es un unix timestamp
+ # revision=`cat $meta | tail -n1 | cut -f1`
+ #
+ # # ../../content/data/pages/es/book/gender/es
+ # # http://illich.test/es:book:gender:es?rev=1620353793
+ # webpage=`echo $name | sed 's/^.*pages\///'| sed 's/\//:/g'`
- # ../../content/data/pages/es/book/gender/es
- # http://illich.test/es:book:gender:es?rev=1620353793
- webpage=`echo $name | sed 's/^.*pages\///'| sed 's/\//:/g'`
-
- echo "
----
+ echo "---
title: \"$yaml_title\"
author: \"$yaml_author\"
-abstract: \"$url$webpage?rev=$revision\"
date: \"$yaml_date\"
lang: \"$lang\"
+documentclass: book
+classoption:
+- oneside
+geometry: margin=1.75in
+fontsize: 12pt
+fontfamily: ebgaramond-maths
+newtxmathoptions:
+- cmintegrals
+- cmbraces
+toc: true
+colorlinks: true
+linkcolor: RoyalBlue
+urlcolor: RoyalBlue
titlepage: true
-titlepage-color: \"FFFFFF\"
-titlepage-text-color: \"000000\"
-titlepage-rule-color: \"CCCCCC\"
-titlepage-rule-height: 4
----
- " > $name.head.tmp
+---" > $name.head.tmp
fi
+echo ""
+echo ""
+
+cat $name.head.tmp
+read
## Hay que cambiar los titulos