-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-html.sh
More file actions
executable file
·35 lines (32 loc) · 925 Bytes
/
build-html.sh
File metadata and controls
executable file
·35 lines (32 loc) · 925 Bytes
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
#Clean output if you want
rm -rf site-data
mkdir -p site-data
mkdir -p site-data/static
cp -r static-files/. site-data/static
documentation-builder --force --no-link-extensions --output-path site-data --source-folder site-data-md
seoContent=`cat meta-tags.xml`
seoContent=$(sed 's/$/\\n/' meta-tags.xml | tr -d '\n')
seoContent=${seoContent//\"/\\\"}
seoContent=${seoContent//\//\\/}
updateScript(){
context=''
if [ "$(echo "$2" | cut -c 1-1)" = '/' ]
then
context='\'$2
fi
for file in "$1"/*
do
if [ -d "$file" ]
then
updateScript "$file" "$2"
else
if [[ $file == *".html" ]];
then
echo 'Processing: ' $file
sed -i -e "s/<head>/<head>$seoContent/" $file
sed -i '/<style>/ {:a; $!N; s/<style>.*<\/style>/<link rel="stylesheet" href="'$context'\/kernal.css"\/>/; t; ba}' $file
fi
fi
done
}
updateScript "site-data" "$1"