-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·55 lines (43 loc) · 1.08 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
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
49
50
51
52
53
54
55
#!/bin/bash
# Author: Riley Spahn
# Date: June, 2014
# The tile of the webpage
TITLE="Riley Spahn"
# Script files that will be used in the webpage.
SCRIPT_FILE="analytics.js"
# CSS Files
STYLE="style.css"
# Directory of markdown pages.
INPUT_DIR="pages"
# Directory where the webpages are placed
OUTPUT_DIR="site"
# Assets Directory
ASSET_DIR="assets"
# Markdown Command
MARKDOWN=markdown_py
# Creates the header of the file including
create_header() {
echo "<html><head><title>$TITLE</title><style>" > $1
cat $STYLE >> $1
echo "</style></head>" >> $1
}
# Create the footer with scripts.
create_footer() {
echo '<script type="text/javascript">' >> $1
cat $SCRIPT_FILE >> $1
echo '</script>' >> $1
}
handle_assets() {
cp -r $ASSET_DIR $1
}
for i in $( ls -1 pages | grep "md$"); do
echo "Processing $i."
input="$INPUT_DIR/$i"
output="$OUTPUT_DIR/$(echo $i | sed s/md$/html/g)"
create_header $output
echo "output = $output"
$MARKDOWN $input >> $output
create_footer $output
echo "</html>" >> $output
done
handle_assets $OUTPUT_DIR