forked from Heegu-sama/Homm3BG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_printable.sh
executable file
·33 lines (30 loc) · 1.09 KB
/
make_printable.sh
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
#!/usr/bin/env bash
#
case "$(uname -s)" in
Darwin*) open=open;;
Linux*) open=xdg-open;;
esac
LANGUAGE=$1
if [[ ${LANGUAGE} == en ]]; then
SECTIONS=sections
else
SECTIONS="sections/translated/${LANGUAGE}"
fi
po4a --no-update po4a.cfg
if [ $(grep -c "icu_locale" index_style.ist) -eq 0 ]
then
echo "icu_locale \"${LANGUAGE}\"" >> index_style.ist
fi
upmendex -s index_style main_${LANGUAGE}
# upmendex sorts non-English characters properly but fails to generate proper ind file
sed -i 's@\(\\noindent\\textbf{\)\(.\)@\\noindent\\textbf{\2}@g' main_${LANGUAGE}.ind
find sections -type f -execdir sed -i 's@\\hypertarget@\\pagetarget@g' '{}' +
python .github/insert_printable_hyperlinks.py "${SECTIONS}"
if [ $(grep -c "sections/index.tex" metadata.tex) -eq 0 ]
then
sed -i 's@\\include{\\sections/back_cover.tex}@\\include{\\sections/index.tex}\\include{\\sections/back_cover.tex}@g' metadata.tex
fi
sed -i -e "/% QR codes placeholder/{r .github/qr-codes-$LANGUAGE.tex" -e 'd}' metadata.tex
latexmk -pdf -shell-escape "main_${LANGUAGE}"
git restore index_style.ist
${open} main_${LANGUAGE}.pdf &