forked from decred/dcrdocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_docs.sh
executable file
·51 lines (42 loc) · 1.62 KB
/
build_docs.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#! /bin/sh
absolutePath=${PWD}
echo "======================================="
echo " E N - E N G L I S H V E R S I O N "
echo "INFO - Building en_docs into directory site/"
mkdocs build -f mkdocs.yml -d site
LANG="de es"
for L in $LANG; do
####################
# BUILD $LANG VERSION
echo "======================================="
echo $L " V E R S I O N "
echo "INFO - Comparing Files and copy missing contents from en version"
mkdir -p ${L}_docs
for i in `diff -rq docs/ ${L}_docs/ | grep "Only in" | sed 's/Only in//' | sed 's/:/\//' | sed 's/ //' | sed 's/docs\///' | awk -F' ' '{print $1$2}'`; do echo $i; cp -r ${absolutePath}/docs/$i ${absolutePath}/${L}_docs/$i; done
echo "INFO - Building "$L"_docs into directory site/"$L
mkdocs build -f ${L}_mkdocs.yml -d site/${L}
# DELETE CSS,JS,FONTS FROM $LANG DIRECTORY
echo "INFO - Remove files and directories site/"$L"/css/ js/ fonts/ Icons/"
rm -rf site/$L/css/
rm -rf site/$L/js/
rm -rf site/$L/fonts/
rm -rf site/$L/Icons
# ADD SYMLINKS TO CSS,JS,FONTS DIRECTORY
# css
echo "INFO - Symlink site/css/ to site/"$L"/css/ js/ fonts/ Icons/"
dirFrom="${absolutePath}/site/css"
dirTo="${absolutePath}/site/${L}/css"
ln -s $dirFrom $dirTo
# js
dirFrom="${absolutePath}/site/js"
dirTo="${absolutePath}/site/${L}/js"
ln -s $dirFrom $dirTo
# fonts
dirFrom="${absolutePath}/site/fonts"
dirTo="${absolutePath}/site/${L}/fonts"
ln -s $dirFrom $dirTo
# Icons
dirFrom="${absolutePath}/site/Icons"
dirTo="${absolutePath}/site/${L}/Icons"
ln -s $dirFrom $dirTo
done