summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2023-09-18 21:25:23 -0300
committerYaco <franco@reevo.org>2023-09-18 21:25:23 -0300
commit3a9bcfe1847854207427814b714ce191109cecc8 (patch)
tree56792b6c8465be9d097ce67e21f7444699eded66
parented7c71ec0a4178ed7568216379aad942900a120c (diff)
updates script to compile pages from sources to wiki
-rwxr-xr-xplatform/bin/contents_compile.sh43
1 files changed, 32 insertions, 11 deletions
diff --git a/platform/bin/contents_compile.sh b/platform/bin/contents_compile.sh
index 25cf6da..a46f78d 100755
--- a/platform/bin/contents_compile.sh
+++ b/platform/bin/contents_compile.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Contents compilee
# ./contents_compile.sh <collection> <type>
-# ./contents_compile.sh illich archive
+# ./contents_compile.sh illich article
COLLECTION=$1
TYPE=$2
@@ -17,37 +17,38 @@ BASEURL=`cat ../../../../platform/www/conf/farm.ini | grep basedomain | cut -d '
echo "#### STARTING TO COMPILE! Collection: $1 Type: $2. Press a key to proceed..."
read
+# Clean previous files
rm index*
echo "" > index.txt
+# Define languages to generate
LANGS=("en" "es")
for lng in ${LANGS[@]}; do
+ echo "Generating files for lang: $lng"
echo "" > index.$lng.txt
rm -rf ../../data/pages/$lng/$TYPE/*
cd ../../data/pages/$lng/$TYPE/
ln -s ../../../../contents/$TYPE/index.$lng.txt index.txt
- cd -
+ cd $OLDPWD
done
echo "" > index.es.txt
-
-
-
for i in `ls -d */`; do
- echo "*** $i"
+ echo "#### PROCESSING: $i"
+
FOLDER=$i
YEAR=`echo $i | cut -d '-' -f1`
cd $i
LANGORIG=`cat index | grep langorig | cut -d "@" -f 4 | cut -d "_" -f 3`
- echo $LANGORIG
+ # echo $LANGORIG
TITLEORIG=`cat index | grep titleorig | cut -d "_" -f3`
- echo $TITLEORIG
+ # echo $TITLEORIG
if [[ -f $LANGORIG.txt ]]
then
- echo "la version en el idioma original esta procesada"
+ echo "The version in the original language is already processed"
for j in `ls *.txt`; do
LANG=`echo $j | cut -d '.' -f1`
echo "**** $LANG"
@@ -76,14 +77,23 @@ for i in `ls -d */`; do
sed -i "s/LANG_authors@#:\*\*/LANG_authors\@\#:\*\* $AUTHOR;/g" $INDEX
AUTHORS=`grep "LANG_authors" $INDEX | cut -d '*' -f6 | sed s/\;/\ and/g | sed s/^\ //`
else
- # only man author
+ # only main author
AUTHORS=$AUTHOR
fi
+
+ if grep "LANG_publicationdate" $INDEX
+ then
+ PUBDATE=`grep "LANG_publicationdate" $INDEX | cut -d '*' -f6 | sed s/\;/\ and/g | sed s/^\ //`
+ else
+ # Use year if full date is not defined
+ PUBDATE=$YEAR
+ fi
+
if grep "LANG_translators" $INDEX
then
TRANSLATORS=`grep "LANG_translators" $INDEX | cut -d '*' -f6 | sed s/\;/\ and/g | sed s/^\ //`
else
- # only man author
+ # no translators
TRANSLATORS=""
fi
KEY=`echo $FOLDER | sed 's/\///'`
@@ -94,10 +104,13 @@ for i in `ls -d */`; do
author = {$AUTHORS},
title = {$TITLE},
year = {$YEAR},
+ date = {$PUBDATE},
+ origdate = {$PUBDATE},
language = {$LANG},
translator = {$TRANSLATORS},
url = {$URL}
}" > $LANG.bib
+ echo "Generated $LANG.bib"
cat $LANG.bib >> ../index.$LANG.bib
echo "" >> ../index.$LANG.bib
echo "\`\`\`" >> $INDEX
@@ -125,6 +138,13 @@ for i in `ls -d */`; do
then
ln -s ../../../../../contents/$TYPE/$i$LANG.notes notes.txt
fi
+
+ if [[ ! -f index.bib ]]
+ then
+ ln -s ../../../../../contents/$TYPE/$i$LANG.bib index.bib
+ fi
+
+
cd -
if [[ $TITLELANG == $TITLEORIG ]]
@@ -199,3 +219,4 @@ for file in `ls index*.txt`; do
done
done
+rm *.old