Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
function checkApp() { | ||
APP_NAME=$1 | ||
if [ "$APP_NAME" = "" ]; then | ||
echo "Missing $APP_NAME" | ||
exit 1 | ||
fi | ||
} | ||
|
||
function softwareCheck() { | ||
for APP_NAME in $@; do | ||
checkApp $APP_NAME | ||
done | ||
} | ||
|
||
function mkPage () { | ||
nav="$1" | ||
content="$2" | ||
html="$3" | ||
|
||
echo "Rendering $html" | ||
mkpage \ | ||
"nav=$nav" \ | ||
"content=$content" \ | ||
page.tmpl > $html | ||
} | ||
|
||
function mkSite() { | ||
FOLDER=$1 | ||
|
||
echo "Generating HTML content for $FOLDER" | ||
find . -type f | grep -v .git | grep -E ".md$" | while read ITEM; do | ||
FNAME=$(basename "$ITEM") | ||
FOLDER=$(dirname "$ITEM") | ||
if [ -f "$FOLDER/$FNAME" ] && [ "$FNAME" != "nav.md" ]; then | ||
EXT=${FNAME:(-3)} | ||
if [ "$EXT" = ".md" ]; then | ||
HTML_FNAME=$(basename $FNAME .md).html | ||
if [ "$HTML_FNAME" = "README.html" ]; then | ||
HTML_FNAME=index.html | ||
fi | ||
# Prefer the local directory's nav.md to the root level one. | ||
if [ -f "$FOLDER/nav.md" ]; then | ||
mkPage "$FOLDER/nav.md" "$FOLDER/$FNAME" "$FOLDER/$HTML_FNAME" | ||
else | ||
mkPage "nav.md" "$FOLDER/$FNAME" "$FOLDER/$HTML_FNAME" | ||
fi | ||
git add "$FOLDER/$FNAME" "$FOLDER/$HTML_FNAME" | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
echo "Checking necessary software is installed" | ||
softwareCheck mkpage | ||
echo "Generating website" | ||
mkSite "." | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
+ [Lesson](.) | ||
+ [Topic 1](00-getting-started.html) | ||
+ [Topic 2](01-working-with-openrefine.html) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Author Carpentry</title> | ||
<link rel="stylesheet" href="/css/site.css"> | ||
</head> | ||
<body> | ||
<header> | ||
<a href="http://authorcarpentry.github.io"><img src="img/AClogo.jpg" alt="Author Carpentry logo"></a> | ||
</header> | ||
<nav> | ||
{{ .nav }} | ||
</nav> | ||
|
||
<section> | ||
{{ .content }} | ||
</section> | ||
|
||
<footer> | ||
<span>© 2017 <a href="http://library.caltech.edu/CLS_Copyright.htm">Caltech Library</a></span> | ||
<address>1200 E California Blvd, Mail Code 1-32, Pasadena, CA 91125-3200</address> | ||
<span><a href="mailto:library@caltech.edu">Email Us</a></span> | ||
<span>Phone: <a href="tel:+1-626-395-3405">(626)395-3405</a></span> | ||
</footer> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
git commit -am snapshot | ||
git push origin gh-pages |