@@ -30,12 +30,14 @@ if [ "$MODE" = "HTML" -o "$MODE" = "html" -o "$MODE" = "gh-pages" ] ; then
30
30
if [ ! -f " ${TOC} " ] ; then
31
31
echo " TOC file (contents.md) not found. It will be created using a script..."
32
32
(cd " ${SRC} " ; python /usr/local/src/toc.py " ${TOC} " )
33
+ CLEAN_TOC=true
33
34
fi
34
35
35
36
# Index is the entrypoint of every website so it's mandatory
36
37
if [ ! -f " ${SRC} /index.md" ] ; then
37
38
echo " Index file (index.md) not found. It will be created using a script..."
38
39
echo " # ${GITHUB_REPOSITORY:- Documentation} " > " ${SRC} /index.md"
40
+ CLEAN_INDEX=true
39
41
fi
40
42
41
43
# Styling should be provided inside a "css" folder but the default, base style file should be called style.css.
@@ -44,6 +46,7 @@ if [ "$MODE" = "HTML" -o "$MODE" = "html" -o "$MODE" = "gh-pages" ] ; then
44
46
echo " Main CSS style file (css/style.css) not found. It will be created using a script..."
45
47
mkdir -p " ${SRC} /css"
46
48
cp /usr/local/src/style.css " ${SRC} /css/style.css"
49
+ CLEAN_STYLE=true
47
50
fi
48
51
49
52
# Javascript should be provided inside a "js" folder but the default, base script file should be called script.js.
@@ -52,6 +55,7 @@ if [ "$MODE" = "HTML" -o "$MODE" = "html" -o "$MODE" = "gh-pages" ] ; then
52
55
echo " Main JS script file (js/script.js) not found. It will be created using a script..."
53
56
mkdir -p " ${SRC} /js"
54
57
cp /usr/local/src/script.js " ${SRC} /js/script.js"
58
+ CLEAN_SCRIPT=true
55
59
fi
56
60
57
61
# Mirrors the directory structure
@@ -69,6 +73,24 @@ if [ "$MODE" = "HTML" -o "$MODE" = "html" -o "$MODE" = "gh-pages" ] ; then
69
73
fi
70
74
fi
71
75
76
+ if [ " ${CLEAN_TOC} " = true ] ; then
77
+ rm " ${TOC} "
78
+ fi
79
+
80
+ if [ " ${CLEAN_INDEX} " = true ] ; then
81
+ rm " ${SRC} /index.md"
82
+ fi
83
+
84
+ if [ " ${CLEAN_STYLE} " = true ] ; then
85
+ rm " ${SRC} /css/style.css"
86
+ find " ${SRC} /css" -type d -empty -delete
87
+ fi
88
+
89
+ if [ " ${CLEAN_SCRIPT} " = true ] ; then
90
+ rm " ${SRC} /js/script.js"
91
+ find " ${SRC} /js" -type d -empty -delete
92
+ fi
93
+
72
94
# Print results
73
95
echo " Done. Result:"
74
96
tree $DEST
0 commit comments