Skip to content
Snippets Groups Projects
Commit 31b51a52 authored by Lukáš Krupčík's avatar Lukáš Krupčík
Browse files

edit html_md.sh

parent 0a412f7c
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ if [ "$1" = "-w" ]; then ...@@ -31,7 +31,7 @@ if [ "$1" = "-w" ]; then
# test exists file -> yes - kill process wget # test exists file -> yes - kill process wget
until test -f $FILE until test -f "$FILE"
do do
if [ ! -f "$FILE" ]; then if [ ! -f "$FILE" ]; then
echo "Download..." echo "Download..."
...@@ -40,7 +40,7 @@ if [ "$1" = "-w" ]; then ...@@ -40,7 +40,7 @@ if [ "$1" = "-w" ]; then
done done
echo "Download complete..." echo "Download complete..."
kill $pid kill "$pid"
find . -name "@@s*" | find . -name "@@s*" |
while read i; while read i;
...@@ -82,7 +82,7 @@ if [ "$1" = "-c" ]; then ...@@ -82,7 +82,7 @@ if [ "$1" = "-c" ]; then
do do
# filtering html # filtering html
echo "$i"; echo "$i";
echo "\t\tfiltering html files..."; printf "\t\tfiltering html files...\n";
HEAD=$(cat "$i" | grep -n -m1 '<h1' |cut -f1 -d: | tr --delete '\n') HEAD=$(cat "$i" | grep -n -m1 '<h1' |cut -f1 -d: | tr --delete '\n')
END=$(cat "$i" | grep -n -m1 '<!-- <div tal:content=' |cut -f1 -d: | tr --delete '\n') END=$(cat "$i" | grep -n -m1 '<!-- <div tal:content=' |cut -f1 -d: | tr --delete '\n')
...@@ -92,7 +92,7 @@ if [ "$1" = "-c" ]; then ...@@ -92,7 +92,7 @@ if [ "$1" = "-c" ]; then
cat "$i" | sed '1,'"$((HEAD-1))"'d' | sed -n -e :a -e '1,'"$DOWN"'!{P;N;D;};N;ba' > "${i%.*}TMP.html" cat "$i" | sed '1,'"$((HEAD-1))"'d' | sed -n -e :a -e '1,'"$DOWN"'!{P;N;D;};N;ba' > "${i%.*}TMP.html"
# converted .html to .md # converted .html to .md
echo "\t\t.html -> .md" printf "\t\t.html -> .md\n"
pandoc -f html -t markdown+pipe_tables-grid_tables "${i%.*}TMP.html" -o "${i%.*}.md"; pandoc -f html -t markdown+pipe_tables-grid_tables "${i%.*}TMP.html" -o "${i%.*}.md";
rm "${i%.*}TMP.html"; rm "${i%.*}TMP.html";
...@@ -113,7 +113,7 @@ if [ "$1" = "-c" ]; then ...@@ -113,7 +113,7 @@ if [ "$1" = "-c" ]; then
done done
# text filtering of html, css, ... # text filtering of html, css, ...
echo "\t\tautomatic filter..." printf "\t\tautomatic filter...\n"
cat filter_auto | cat filter_auto |
while read y; while read y;
do do
...@@ -122,7 +122,7 @@ if [ "$1" = "-c" ]; then ...@@ -122,7 +122,7 @@ if [ "$1" = "-c" ]; then
cat "${i%.*}TMP.md" > "${i%.*}.md"; cat "${i%.*}TMP.md" > "${i%.*}.md";
done done
#echo "\t\tother filter..." printf "\t\tother filter...\n"
cat filter_other | cat filter_other |
while read a; while read a;
do do
...@@ -137,4 +137,4 @@ if [ "$1" = "-c" ]; then ...@@ -137,4 +137,4 @@ if [ "$1" = "-c" ]; then
done done
rm filter_autoTMP rm filter_autoTMP
rm filter_auto rm filter_auto
fi fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment