blob: 8b82c8677d34bbaf5c841e39fc1404987ba5dfeb (
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
|
#!/usr/bin/env bash
# Book compilers
echo "#### STARTING TO COMPILE BOOKS. Press a key to proceed..."
read
for i in `ls -d */`; do
echo "*** $i"
cd $i
for j in `ls *.txt`; do
LANG=`echo $j | cut -d '.' -f1`
echo "**** $LANG"
# Creates the article directory
if [[ ! -d ../../../data/pages/$LANG/book/$i ]]
then
echo "Create the book directory for $i in $LANG"
mkdir ../../../data/pages/$LANG/book/$i
fi
# Creates the index file
echo "Regenerate the index file for $i in $LANG"
INDEX="../../../data/pages/$LANG/book/$i/index.txt"
head -n1 $LANG.txt > $INDEX
echo "" >> $INDEX
cat index >> $INDEX
cat $LANG.notes | sed s/\*/\ \ \*/ >> $LANG.notes.tmp
line=`grep -n -m 1 LANG_comments $INDEX |sed 's/\([0-9]*\).*/\1/'`
sed -i "${line}r $LANG.notes.tmp" $INDEX
rm $LANG.notes.tmp
echo "" >> $INDEX
echo "~~NOTOC~~" >> $INDEX
# Creates the link to the text in the specific language
cd ../../../data/pages/$LANG/book/$i
if [[ ! -f text.txt ]]
then
ln -s ../../../../../contents/books/$i$LANG.txt text.txt
fi
echo ""
cd -
done
cd ..
echo ""
done
|