@@ -16,6 +16,13 @@ echo "$(date +'%0Y-%0m-%0d %0R:%0S'): The script directory is '$scriptDir'."
16
16
currentDir=" $( pwd) "
17
17
echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : We are working in directory: '$currentDir '."
18
18
19
+ if [[ $( declare -p PYTHON_INTERPRETER) == declare\ ? x* ]]; then
20
+ echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : Found python interpreter as: '$PYTHON_INTERPRETER '"
21
+ else
22
+ export PYTHON_INTERPRETER=" $( readlink -f " $( which python3) " ) "
23
+ echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : Setting up python interpreter as '$PYTHON_INTERPRETER '."
24
+ fi
25
+
19
26
websiteDir=" $currentDir /website"
20
27
echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : We will build the website into: '$websiteDir '."
21
28
@@ -44,7 +51,7 @@ PART_A='<!DOCTYPE html><html><title>'
44
51
PART_B=' </title><style>code {background-color:rgb(204 210 95 / 0.3);white-space:nowrap;border-radius:3px}</style><body style="margin-left:5%;margin-right:5%">'
45
52
PART_C=' </body></html>'
46
53
BASE_URL=' https\:\/\/thomasweise\.github\.io\/programmingWithPython\/'
47
- echo " ${PART_A} Programming with Python${PART_B} $( python3 -m markdown -o html ./README.md) $PART_C " > " $websiteDir /index.html"
54
+ echo " ${PART_A} Programming with Python${PART_B} $( " $PYTHON_INTERPRETER " -m markdown -o html ./README.md) $PART_C " > " $websiteDir /index.html"
48
55
sed -i " s/\" $BASE_URL /\" .\//g" " $websiteDir /index.html"
49
56
sed -i " s/=$BASE_URL /=.\//g" " $websiteDir /index.html"
50
57
sed -i " s/<\/h1>/<\/h1><h2>built on\ $( date +' %0Y-%0m-%0d %0R:%0S' ) <\/h2>/g" " $websiteDir /index.html"
@@ -53,10 +60,9 @@ echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished copying README.md to index.html."
53
60
54
61
cd " $websiteDir "
55
62
echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : Now minifying website."
56
- find -type f -name " *.html" -exec python3 -c " print('{}');import minify_html;f=open('{}','r');s=f.read();f.close();s=minify_html.minify(s,do_not_minify_doctype=True,ensure_spec_compliant_unquoted_attribute_values=True,keep_html_and_head_opening_tags=False,minify_css=True,minify_js=True,remove_bangs=True,remove_processing_instructions=True);f=open('{}','w');f.write(s);f.close()" \;
63
+ find -type f -name " *.html" -exec " $PYTHON_INTERPRETER " -c " print('{}');import minify_html;f=open('{}','r');s=f.read();f.close();s=minify_html.minify(s,do_not_minify_doctype=True,ensure_spec_compliant_unquoted_attribute_values=True,keep_html_and_head_opening_tags=False,minify_css=True,minify_js=True,remove_bangs=True,remove_processing_instructions=True);f=open('{}','w');f.write(s);f.close()" \;
57
64
echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : Done minifying website."
58
65
59
66
cd " $currentDir "
60
67
61
68
echo " $( date +' %0Y-%0m-%0d %0R:%0S' ) : The website building script has successfully completed."
62
-
0 commit comments