blob: 26d163c65b43d3d87d57107c3e357f1bb67868cd (
plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/bin/sh
source _config.sh
###################################################################################
# !WARNING!
# You probably don't need to tweak anything below this line. Edit at your own risk!
###################################################################################
# Create the $OUTPUT directory if it does not exist yet
mkdir -p $OUTPUT
if [[ $TOC = true ]]
then
TOC_TOGGLE="--toc";
else
TOC_TOGGLE="";
fi
if [[ $SYNTAX = true ]]
then
SYNTAX_TOGGLE="";
else
SYNTAX_TOGGLE="--no-highlight";
fi
# Create the web browser-focused HTML versions for all posts
for i in $POSTS; do pandoc --css=../style.css --ascii --metadata lang="$HTML_LANG" $TOC_TOGGLE $SYNTAX_TOGGLE --wrap=none -A _footer.html -B _header.html -s $i -o ${i%.*}.html; done;
rsync $POSTS_DIR*.html $OUTPUT$WEB_HTML;
rm $POSTS_DIR*.html
# Create the web browser-focused HTML versions for all pages
for i in $PAGES; do pandoc --css=style.css --ascii --metadata lang="$HTML_LANG" $TOC_TOGGLE $SYNTAX_TOGGLE --wrap=none -A _footer.html -B _header.html -s $i -o ${i%.*}.html; done;
rsync $PAGES_DIR*.html $OUTPUT;
rm $PAGES_DIR*.html
# Copy XSLT, stylesheet, and media files
rsync rss.xsl $OUTPUT;
rsync style.css $OUTPUT;
rsync -r media $OUTPUT;
# Remove the default blog index to avoid pulling into the XML feed
rm $OUTPUT$WEB_HTML/index.html
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<?xml-stylesheet href=\"rss.xsl\" type=\"text/xsl\"?>
<rss version=\"2.0\">
<channel>
<title>$TITLE</title>
<link>$DOMAIN</link>
<description>$DESCRIPTION</description>
<copyright>$COPYRIGHT</copyright>
<ttl>$TTL</ttl>";
for file in $OUTPUT$WEB_HTML*; do
POST_DATE=$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)
POST_TITLE=$(sed -n 's|^<h1 class="title">\([^<]*\)</h1>$|\1|p' $file)
POST_CONTENT=$(sed -n '/<article>/,/<\/article>/p' $file | sed -e '1s/.*<article>//' -e '$s/<\/article>.*//')
if [[ $OS = "BSD" ]]
then
CAT_DATE=$(gdate -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")
POST_DATE=$(gdate -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y")
else
CAT_DATE=$(date -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%Y/%m/%d/%u")
POST_DATE=$(date -d "$(sed -n 's|^<p class="date">\([^<]*\)</p>$|\1|p' $file)" +"%a, %d %b %Y")
fi
echo "<item>
<pubDate>$POST_DATE $TIME</pubDate>
<category>$CAT_DATE</category>
<title>$POST_TITLE</title>
<link>$DOMAIN/$WEB_HTML$(basename ${file})</link>
<description><![CDATA[$POST_CONTENT]]></description>
<author>$AUTHOR</author>
<guid>$DOMAIN/$WEB_HTML$(basename ${file})</guid>
</item>";
done
echo " </channel>
</rss>";
|