Newer
Older
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
if [ "$1" = "-d" ]; then
# remove pdf, md and epub files
STARTTIME=$(date +%s)
if [ "$2" = "pdf" ]; then
echo "$(tput setaf 9)*.pdf deleted$(tput setaf 15)"
if [ -d ./pdf ]; then
rm -rf ./pdf
fi
elif [ "$2" = "epub" ]; then
echo "$(tput setaf 9)*.epub deleted$(tput setaf 15)"
if [ -d ./epub ]; then
rm -rf ./epub
fi
elif [ "$2" = "md" ]; then
echo "$(tput setaf 9)*.md deleted$(tput setaf 15)"
if [ -d ./converted ]; then
rm -rf ./converted
fi
elif [ "$2" = "all" ]; then
echo "$(tput setaf 9)all files deleted$(tput setaf 15)"
if [ -d ./converted ]; then
rm -rf ./converted
fi
if [ -d ./epub ]; then
rm -rf ./epub
fi
if [ -d ./pdf ]; then
rm -rf ./pdf
fi
if [ -d ./info ]; then
rm -rf ./info
fi
if [ -d ./docs.it4i.cz ]; then
rm -rf ./docs.it4i.cz
fi
fi
ENDTIME=$(date +%s)
echo "It takes $(($ENDTIME - $STARTTIME)) seconds to complete this task..."
fi
if [ "$1" = "-e" ]; then
# export to pdf/epub
STARTTIME=$(date +%s)
counter=1
count=$(find ./converted -name "*.md" -type f | wc -l)
if [ "$2" = "epub" ]; then
find ./converted -name "*.md" |
while read i;
do
a=$(basename "$i")
b=$(dirname "$i")
c=$(pwd)
echo "$(tput setaf 12)($counter/$count)$(tput setaf 11)$a => $(tput setaf 13)${a%.*}.epub$(tput setaf 15)"
counter=$((counter+1))
cd "$b"
mkdir epub;
(while read i;
do
mkdir "./epub/$i";
done) < ./source/list_folder
echo "$(tput setaf 11)moved epub files$(tput setaf 15)";
while read a ; do
mv "./converted/${a%.*}.epub" "./epub/${a%.*}.epub";
done < ./source/list_md_mv
find ./converted -name "*.md" |
while read i;
do
a=$(basename "$i")
b=$(dirname "$i")
c=$(pwd)
echo "$(tput setaf 12)($counter/$count)$(tput setaf 11)$a => $(tput setaf 13)${a%.*}.pdf$(tput setaf 15)"
#echo "$b"
counter=$((counter+1))
cd "$b"
#!double subscripts problem !!!!!!
#ansys-fluent.md
#capacity-computing.md
#job-submission-and-execution.md
pandoc ${a%.*}.md -o ${a%.*}.epub
pandoc ${a%.*}.epub -t latex --latex-engine=xelatex --mathml -o ${a%.*}.pdf
rm "${a%.*}.epub"
elif [ $a = "ansys-fluent.md" ]; then
pandoc ${a%.*}.md -o ${a%.*}.epub
pandoc ${a%.*}.epub -t latex --latex-engine=xelatex --mathml -o ${a%.*}.pdf
rm "${a%.*}.epub"
elif [ $a = "capacity-computing.md" ]; then
pandoc ${a%.*}.md -o ${a%.*}.epub
pandoc ${a%.*}.epub -t latex --latex-engine=xelatex --mathml -o ${a%.*}.pdf
rm "${a%.*}.epub"
else
pandoc ${a%.*}.md -t latex --latex-engine=xelatex --mathml -o ${a%.*}.pdf
fi
cd "$c"
done
mkdir pdf;
(while read i;
do
mkdir "./pdf/$i";
done) < ./source/list_folder
# move pdf files to folder pdf
echo "$(tput setaf 11)moved pdf files$(tput setaf 15)";
while read a ; do
mv "./converted/${a%.*}.pdf" "./pdf/${a%.*}.pdf";
done < ./source/list_md_mv
fi
ENDTIME=$(date +%s)
echo "It takes $(($ENDTIME - $STARTTIME)) seconds to complete this task..."
fi
wget -X pbspro-documentation,changelog,whats-new,portal_css,portal_javascripts,++resource++jquery-ui-themes,anselm-cluster-documentation/icon.jpg -R favicon.ico,pdf.png,logo.png,background.png,application.png,search_icon.png,png.png,sh.png,touch_icon.png,anselm-cluster-documentation/icon.jpg,*js,robots.txt,*xml,RSS,download_icon.png,pdf,*zip,*rar,@@*,anselm-cluster-documentation/icon.jpg.1 --mirror --convert-links --adjust-extension --page-requisites --no-parent https://docs.it4i.cz;
wget --directory-prefix=./docs.it4i.cz/ http://verif.cs.vsb.cz/aislinn/doc/report.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/virtualization/virtualization-job-workflow
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig1.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig2.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig3.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig4.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig5.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig6.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig7.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig7x.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig8.png
wget --directory-prefix=./docs.it4i.cz/ https://docs.it4i.cz/anselm-cluster-documentation/software/omics-master-1/images/fig9.png
ENDTIME=$(date +%s)
echo "It takes $(($ENDTIME - $STARTTIME)) seconds to complete this task..."
if [ -d ./docs.it4i ]; then
rm -rf ./docs.it4i
fi
if [ -d ./info ]; then
rm -rf ./info;
fi
# erasing duplicate files and unwanted files
(while read i;
do
if [ -f "$i" ];
then
echo "$(tput setaf 9)$i deleted";
rm "$i";
fi
done) < ./source/list_rm
counter=1
count=$(find . -name "*.html" -type f | wc -l)
echo "$(tput setaf 12)($counter/$count)$(tput setaf 11)$i";
counter=$((counter+1))
printf "$(tput setaf 15)\t\tFiltering html files...\n";
HEAD=$(grep -n -m1 '<h1' "$i" |cut -f1 -d: | tr --delete '\n')
END=$(grep -n -m1 '<!-- <div tal:content=' "$i" |cut -f1 -d: | tr --delete '\n')
LAST=$(wc -l "$i" | cut -f1 -d' ')
sed '1,'"$((HEAD-1))"'d' "$i" | sed -n -e :a -e '1,'"$DOWN"'!{P;N;D;};N;ba' > "${i%.*}TMP.html"
printf "\t\t.html => $(tput setaf 13).md\n$(tput setaf 15)"
pandoc -f html -t markdown+pipe_tables-grid_tables "${i%.*}TMP.html" -o "${i%.*}.md";
printf "\t\tFiltering html and css elements in md files...\n"
sed -e 's/``` /```/' "${i%.*}.md" | sed -e 's/<\/div>//g' | sed '/^<div/d' | sed -e 's/<\/span>//' | sed -e 's/^\*\*//' | sed -e 's/\\//g' | sed -e 's/^: //g' | sed -e 's/^Obsah//g' > "${i%.*}TMP.md";
while read x ; do
arg1=`echo "$x" | cut -d"&" -f1 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
arg2=`echo "$x" | cut -d"&" -f2 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
sed -e 's/'"$arg1"'/'"$arg2"'/' "${i%.*}TMP.md" > "${i%.*}TMP.TEST.md";
while read x ; do
arg1=`echo "$x" | cut -d"&" -f1 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
arg2=`echo "$x" | cut -d"&" -f2 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
sed -e 's/'"$arg1"'/'"$arg2"'/' "${i%.*}TMP.md" | sed -e 's/^``//g' > "${i%.*}TMP.TEST.md";
while read x ; do
arg1=`echo "$x" | cut -d"&" -f1 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
arg2=`echo "$x" | cut -d"&" -f2 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
sed -e 's/'"$arg1"'/'"$arg2"'/' "${i%.*}TMP.md" > "${i%.*}.md";
while read x ; do
arg1=`echo "$x" | cut -d"&" -f1 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
arg2=`echo "$x" | cut -d"&" -f2 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
sed -e 's/'"$arg1"'/'"$arg2"'/' "${i%.*}TMP.md" > "${i%.*}.md";
sed -e :a -e '/\\$/N; s/\\\n//; ta' "${i%.*}.md" > "${i%.*}TMP.md";
done < ./source/tab
# replace tables
while read x ; do
arg1=`echo "$x" | cut -d"&" -f1 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
arg2=`echo "$x" | cut -d"&" -f2 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
sed -e 's/'"$arg1"'/'"$arg2"'/' "${i%.*}TMP.md" | sed -e 's/^>//' > "${i%.*}.md";
cat -s "${i%.*}.md" > "${i%.*}TMP.md";
done < ./source/tabREPLACE
while read x ; do
arg1=`echo "$x" | cut -d"&" -f1 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
arg2=`echo "$x" | cut -d"&" -f2 | sed 's:[]\[\^\$\.\*\/\"]:\\\\&:g'`;
sed -e 's/'"$arg1"'/'"$arg2"'/' "${i%.*}TMP.md" > "${i%.*}TMP.TEST.md";
cat -s "${i%.*}TMP.TEST.md" > "${i%.*}TMP.md";
done < ./source/lastFilter
find -type f -size -10c |
while read i;
do
rm "$i";
echo "$(tput setaf 11)Create folder info and lists od files...";
find ./docs.it4i.cz -name "*.png" -type f > ./info/list_image;
find ./docs.it4i.cz -name "*.jpg" -type f >> ./info/list_image;
find ./docs.it4i.cz -name "*.jpeg" -type f >> ./info/list_image;
find ./docs.it4i.cz -name "*.md" -type f> ./info/list_md;
find ./docs.it4i.cz -type d | sort > ./info/list_folder;
# move md files to folder converted
echo "$(tput setaf 11)Moved md files...";
echo "$(tput setaf 11)Copy image files...";
cp ./docs.it4i.cz/salomon/salomon ./docs.it4i/salomon/salomon
cp ./docs.it4i.cz/salomon/salomon-2 ./docs.it4i/salomon/salomon-2
cp ./docs.it4i/salomon/resource-allocation-and-job-execution/fairshare_formula.png ./docs.it4i/anselm-cluster-documentation/resource-allocation-and-job-execution/fairshare_formula.png
cp ./docs.it4i/salomon/resource-allocation-and-job-execution/job_sort_formula.png ./docs.it4i/anselm-cluster-documentation/resource-allocation-and-job-execution/job_sort_formula.png
cp ./docs.it4i/salomon/software/debuggers/vtune-amplifier.png ./docs.it4i/anselm-cluster-documentation/software/debuggers/vtune-amplifier.png
cp ./docs.it4i/salomon/software/debuggers/Snmekobrazovky20160708v12.33.35.png ./docs.it4i/anselm-cluster-documentation/software/debuggers/Snmekobrazovky20160708v12.33.35.png
cp ./docs.it4i.cz/virtualization-job-workflow ./docs.it4i/anselm-cluster-documentation/software/
cp ./docs.it4i.cz/anselm-cluster-documentation/anyconnecticon.jpg ./docs.it4i/salomon/accessing-the-cluster/anyconnecticon.jpg
cp ./docs.it4i.cz/anselm-cluster-documentation/anyconnectcontextmenu.jpg ./docs.it4i/salomon/accessing-the-cluster/anyconnectcontextmenu.jpg
cp ./docs.it4i.cz/get-started-with-it4innovations/accessing-the-clusters/graphical-user-interface/vnc/TightVNC_login.png ./docs.it4i/salomon/software/debuggers/TightVNC_login.png
find ./docs.it4i -name "*.png" -type f > ./info/list_image_converted;
find ./docs.it4i -name "*.jpg" -type f >> ./info/list_image_converted;
find ./docs.it4i -name "*.jpeg" -type f >> ./info/list_image_converted;
find ./docs.it4i -name "*.md" -type f> ./info/list_md_converted;
find ./docs.it4i -type d | sort > ./info/list_folder_converted;
echo "$(tput setaf 13)COMPLETED...$(tput setaf 15)";
printf "\n\n$(tput setaf 9)Can not create a folder docs.it4i, because the number of MD files disagrees. The converted files remain in the folder docs.it4i.cz !!!!...$(tput setaf 15)\n\n";
printf "\n\n$(tput setaf 9)Folder docs.it4i.cz not exists!!!!...$(tput setaf 15)\n\nRun html_md.sh -w\n\n";
fi
ENDTIME=$(date +%s)
echo "It takes $(($ENDTIME - $STARTTIME)) seconds to complete this task..."