blob: b2005af614771c7bd7c46c845320cd2eac04d1f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#!/usr/bin/env bash
# Article compilers
echo "#### STARTING TO COMPILE ARTICLES. Press a key to proceed..."
read
for i in `ls -d */`; do
echo "*** $i"
YEAR=`echo $i | cut -d '-' -f1`
cd $i
LANGORIG=`cat index | grep langorig | cut -d "@" -f 4 | cut -d "_" -f 3`
echo $LANGORIG
if [[ -f $LANGORIG.txt ]]
then
echo "la version en el idioma original esta procesada"
for j in `ls *.txt`; do
LANG=`echo $j | cut -d '.' -f1`
echo "**** $LANG"
# Creates the article directory
if [[ ! -d ../../../data/pages/$LANG/article/$i ]]
then
echo "Create the article directory for $i in $LANG"
mkdir ../../../data/pages/$LANG/article/$i
fi
# Creates the index file
echo "Regenerate the index file for $i in $LANG"
INDEX="../../../data/pages/$LANG/article/$i/index.txt"
head -n1 $LANG.txt > $INDEX
echo "" >> $INDEX
cat index >> $INDEX
cat $LANG.notes | sed s/\*/\ \ \*/ >> $INDEX
echo "" >> $INDEX
echo "~~NOTOC~~" >> $INDEX
sed -i "s/\*YEAR\*/$YEAR/g" $INDEX
# Creates the link to the text in the specific language
cd ../../../data/pages/$LANG/article/$i
if [[ ! -f text.txt ]]
then
ln -s ../../../../../contents/articles/$i$LANG.txt text.txt
fi
cd -
done
else
echo "La version en el idioma original NO esta procesada, entonces marcamos como pendiente y creamos un index"
# Creates the article directory
if [[ ! -d ../../../data/pages/$LANGORIG/article/$i ]]
then
echo "Create the article directory for $i in $LANGORIG"
mkdir ../../../data/pages/$LANGORIG/article/$i
fi
# Creates the index file
echo "Creates the index file for $i in $LANGORIG"
INDEX="../../../data/pages/$LANGORIG/article/$i/index.txt"
echo $INDEX
TITLEORIG=`cat index | grep titleorig | cut -d "_" -f3`
echo "# $TITLEORIG" > $INDEX
echo "" >> $INDEX
cat index >> $INDEX
cat $LANGORIG.notes | sed s/\*/\ \ \*/ >> $INDEX
echo "" >> $INDEX
echo "~~NOTOC~~" >> $INDEX
sed -i "s/\*YEAR\*/$YEAR/g" $INDEX
echo "{{tag>pending}}" >> $INDEX
fi
cd ..
echo ""
done
|