small fixes - static-site-scripts - static site generator shellscripts | |
git clone git://git.codemadness.org/static-site-scripts | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit e35b07eaa3aa6da544fde733e9a8bcc7bc072a5d | |
parent e534bbba4dcf9ea18fcecf9115c34957cb2594c6 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 16 Dec 2013 21:30:48 +0100 | |
small fixes | |
Signed-off-by: Hiltjo Posthuma <[email protected]> | |
Diffstat: | |
M TODO | 2 +- | |
M generate.sh | 16 ++++++++-------- | |
A site/output/atom.xml | 34 +++++++++++++++++++++++++++++… | |
A site/output/example-page-template.… | 39 +++++++++++++++++++++++++++… | |
A site/output/index.html | 43 ++++++++++++++++++++++++++++++ | |
A site/output/markdown-test.html | 106 ++++++++++++++++++++++++++++++ | |
A site/output/rss.xml | 26 ++++++++++++++++++++++++++ | |
A site/output/sitemap.xml | 6 ++++++ | |
A site/output/urllist.txt | 3 +++ | |
9 files changed, 266 insertions(+), 9 deletions(-) | |
--- | |
diff --git a/TODO b/TODO | |
@@ -1 +1 @@ | |
- | |
+ | |
diff --git a/generate.sh b/generate.sh | |
@@ -2,10 +2,10 @@ | |
# Syntax highlight code. | |
code_highlight() { | |
- printf '%s\n' '<pre>' | |
+ printf '%s\n' '<pre><code>' | |
# escape some HTML entities, prefix code with linenumbers. | |
sed -e 's@&@\&@g' -e 's@>@\>@g' -e 's@<@\<@g' | nl -w 4 -s '… | |
- printf '%s\n' '</pre>' | |
+ printf '%s\n' '</code></pre>' | |
} | |
# page_metadata(filename) | |
@@ -20,7 +20,7 @@ page_metadata() { | |
content="" | |
categories="" | |
timestamp="" | |
- [ ! "$1" = "" ] && [ -f "$1" ] && . "$1" # load page metadata. | |
+ [ ! "$1" = "" ] && [ -f "$1" ] && . "$1" # include page metadata. | |
} | |
# load config (evaluate shellscript). | |
@@ -66,7 +66,7 @@ mkdir -p "${outputdir}" | |
for name in "rss.xml" "atom.xml" "index.html"; do | |
echo > "${outputdir}/${name}" | |
done | |
-find "${pagesdir}" -name "*.sh" | while read -r page; do | |
+find "${pagesdir}" -type f -name "*.sh" | while read -r page; do | |
page_metadata "${page}" # load page metadata. | |
printf "%s\t%s\n" "${timestamp}" "${page}" | |
done | sort -rn | while read -r ts meta; do # process in order of time descend… | |
@@ -74,7 +74,7 @@ done | sort -rn | while read -r ts meta; do # process in orde… | |
page_metadata "${meta}" | |
urlfull="${siteurlfull}/${url}" | |
filename="" | |
- if [ "$content" = "" ]; then # content not set: try data from file. | |
+ if [ "${content}" = "" ]; then # content not set: try data from file. | |
if [ -f "${pagesdir}/${pagename}.html" ]; then | |
filename="${pagesdir}/${pagename}.html" | |
content=$(cat "${filename}") | |
@@ -105,11 +105,11 @@ page_metadata "" | |
content=$(cat "${outputdir}/atom.xml") | |
. "${layoutdir}/atom/atom.sh" > "${outputdir}/atom.xml" | |
-# Goto output dir to make relative urls. | |
+# Goto output dir to make relative urls for find. | |
cd "${outputdir}" | |
# Sitemap: urllist.txt | |
-find ./ -type f -name "*.html" | sort | sed 's@^./\(.*\)$@'${siteurlfull}'/\1@… | |
+find ./ -type f -name "*.html" | sort | sed 's@^\./@'${siteurlfull}'/@' > "url… | |
# Sitemap: sitemap.xml | |
(cat <<! | |
@@ -117,7 +117,7 @@ find ./ -type f -name "*.html" | sort | sed 's@^./\(.*\)$@'… | |
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
! | |
-find ./ -type f -name "*.html" | sort | sed 's@^./\(.*\)$@<url><loc>'${siteurl… | |
+find ./ -type f -name "*.html" | sort | sed 's@^\./\(.*\)$@<url><loc>'${siteur… | |
cat <<! | |
</urlset> | |
diff --git a/site/output/atom.xml b/site/output/atom.xml | |
@@ -0,0 +1,34 @@ | |
+<?xml version="1.0" encoding="UTF-8"?> | |
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"> | |
+ <title type="text">Codemadness</title> | |
+ <subtitle type="text">blog with various projects and articles about co… | |
+ <updated>2013-12-16T00:00:00Z</updated> | |
+ <link rel="alternate" type="text/html" href="http://www.codemadness.nl… | |
+ <id>http://www.codemadness.nl/atom.xml</id> | |
+ <link rel="self" type="application/atom+xml" href="http://www.codemadn… | |
+ | |
+<entry> | |
+ <author> | |
+ <name>author</name> | |
+ <uri></uri> | |
+ </author> | |
+ <title type="html"><![CDATA[Markdown test]]></title> | |
+ <link rel="alternate" type="text/html" href="http://www.codemadness.nl… | |
+ <id>http://www.codemadness.nl/markdown-test.html</id> | |
+ <updated>2013-01-02T00:00:00Z</updated> | |
+ <published>2013-01-02T00:00:00Z</published> | |
+ <summary type="html"><![CDATA[description here]]></summary> | |
+</entry> | |
+<entry> | |
+ <author> | |
+ <name>author</name> | |
+ <uri></uri> | |
+ </author> | |
+ <title type="html"><![CDATA[Example title]]></title> | |
+ <link rel="alternate" type="text/html" href="http://www.codemadness.nl… | |
+ <id>http://www.codemadness.nl/example-page-template.html</id> | |
+ <updated>2013-01-01T00:00:00Z</updated> | |
+ <published>2013-01-01T00:00:00Z</published> | |
+ <summary type="html"><![CDATA[description here]]></summary> | |
+</entry> | |
+</feed> | |
diff --git a/site/output/example-page-template.html b/site/output/example-page-… | |
@@ -0,0 +1,39 @@ | |
+<!DOCTYPE HTML> | |
+<html dir="ltr" lang="en"> | |
+ <head> | |
+ <title>Example title - Codemadness</title> | |
+ <link rel="stylesheet" href="style.css" type="text/css" media=… | |
+ <link rel="stylesheet" href="print.css" type="text/css" media=… | |
+ <link rel="alternate" type="application/rss+xml" title="Codema… | |
+ <link rel="alternate" type="application/atom+xml" title="Codem… | |
+ <link rel="icon" type="image/png" href="/favicon.png" /> | |
+ <meta http-equiv="Content-Type" content="text/html; charset=UT… | |
+ <meta http-equiv="Content-Language" content="en" /> | |
+ <meta content="width=device-width" name="viewport" /> | |
+ <meta content="keywords, comma, separated" name="keywords" /> | |
+ <meta content="description here" name="description" /> | |
+ </head> | |
+ <body> | |
+ <div id="menuwrap"> | |
+ <div id="menu"> | |
+ <span id="links"> | |
+ <a href="/" title="Blog">Blog</a> | | |
+ <a href="/downloads/projects/" title="… | |
+ </span> | |
+ <span id="links-contact"> | |
+ <span class="hidden"> | </span> | |
+ <a href="rss.xml" title="Syndicate thi… | |
+ <a href="atom.xml" title="Atom feed" c… | |
+ <a href="mailto:hiltjo@AT@codemadness.… | |
+ </span> | |
+ </div> | |
+ </div> | |
+ <hr class="hidden" /> | |
+ <div id="mainwrap"> | |
+ <div id="main"> | |
+ <h1><a href="" title="Example title">Example t… | |
+ <p>This is an example page :)</p> | |
+ </div> | |
+ </div> | |
+ </body> | |
+</html> | |
diff --git a/site/output/index.html b/site/output/index.html | |
@@ -0,0 +1,43 @@ | |
+<!DOCTYPE HTML> | |
+<html dir="ltr" lang="en"> | |
+ <head> | |
+ <title>Posts - Codemadness</title> | |
+ <link rel="stylesheet" href="style.css" type="text/css" media=… | |
+ <link rel="stylesheet" href="print.css" type="text/css" media=… | |
+ <link rel="alternate" type="application/rss+xml" title="Codema… | |
+ <link rel="alternate" type="application/atom+xml" title="Codem… | |
+ <link rel="icon" type="image/png" href="/favicon.png" /> | |
+ <meta http-equiv="Content-Type" content="text/html; charset=UT… | |
+ <meta http-equiv="Content-Language" content="en" /> | |
+ <meta content="width=device-width" name="viewport" /> | |
+ <meta content="blog, suckless, dwm-hiltjo" name="keywords" /> | |
+ <meta content="blog with various projects and articles about c… | |
+ </head> | |
+ <body> | |
+ <div id="menuwrap"> | |
+ <div id="menu"> | |
+ <span id="links"> | |
+ <a href="/" title="Blog">Blog</a> | | |
+ <a href="/downloads/projects/" title="… | |
+ </span> | |
+ <span id="links-contact"> | |
+ <span class="hidden"> | </span> | |
+ <a href="rss.xml" title="Syndicate thi… | |
+ <a href="atom.xml" title="Atom feed" c… | |
+ <a href="mailto:hiltjo@AT@codemadness.… | |
+ </span> | |
+ </div> | |
+ </div> | |
+ <hr class="hidden" /> | |
+ <div id="mainwrap"> | |
+ <div id="main"> | |
+<h1>Posts</h1> | |
+<table> | |
+ | |
+<tr><td class="lm">2013-01-02</td><td><a href="markdown-test.html" title="desc… | |
+<tr><td class="lm">2013-01-01</td><td><a href="example-page-template.html" tit… | |
+</table> | |
+ </div> | |
+ </div> | |
+ </body> | |
+</html> | |
diff --git a/site/output/markdown-test.html b/site/output/markdown-test.html | |
@@ -0,0 +1,106 @@ | |
+<!DOCTYPE HTML> | |
+<html dir="ltr" lang="en"> | |
+ <head> | |
+ <title>Markdown test - Codemadness</title> | |
+ <link rel="stylesheet" href="style.css" type="text/css" media=… | |
+ <link rel="stylesheet" href="print.css" type="text/css" media=… | |
+ <link rel="alternate" type="application/rss+xml" title="Codema… | |
+ <link rel="alternate" type="application/atom+xml" title="Codem… | |
+ <link rel="icon" type="image/png" href="/favicon.png" /> | |
+ <meta http-equiv="Content-Type" content="text/html; charset=UT… | |
+ <meta http-equiv="Content-Language" content="en" /> | |
+ <meta content="width=device-width" name="viewport" /> | |
+ <meta content="keywords, comma, separated" name="keywords" /> | |
+ <meta content="description here" name="description" /> | |
+ </head> | |
+ <body> | |
+ <div id="menuwrap"> | |
+ <div id="menu"> | |
+ <span id="links"> | |
+ <a href="/" title="Blog">Blog</a> | | |
+ <a href="/downloads/projects/" title="… | |
+ </span> | |
+ <span id="links-contact"> | |
+ <span class="hidden"> | </span> | |
+ <a href="rss.xml" title="Syndicate thi… | |
+ <a href="atom.xml" title="Atom feed" c… | |
+ <a href="mailto:hiltjo@AT@codemadness.… | |
+ </span> | |
+ </div> | |
+ </div> | |
+ <hr class="hidden" /> | |
+ <div id="mainwrap"> | |
+ <div id="main"> | |
+ <h1><a href="" title="Markdown test">Markdown … | |
+ <h2>simple tests</h2> | |
+<p> | |
+first paragraph. | |
+testing surround: <em>emph</em> then <strong>strong</strong> and <code>code</c… | |
+<p> | |
+<code>\`escaped backticks\`</code>.</p> | |
+<p> | |
+<code>x = *y * 6;</code></p> | |
+<p> | |
+horizontal rule:</p> | |
+<hr /> | |
+<h2>blocks and entities</h2> | |
+<p> | |
+preformatted block: | |
+<pre><code>.'''' .'.'. | | | |
+ '''. | ' | | | | |
+'''' ' ' ""</code></pre> | |
+</p> | |
+<p> | |
+quoted text: | |
+<blockquote><p> | |
+When in doubt, | |
+use brute force.</p> | |
+</blockquote> | |
+</p> | |
+<p> | |
+list: | |
+<ul> | |
+<li>Make each program do one thing well.</li> | |
+<li>Expect the output of every program to become the input to another, | |
+as yet unknown, program.</li> | |
+<li>Design and build software, even operating systems, to be tried early, | |
+ideally within weeks.</li> | |
+<li>Use tools in preference to unskilled help to lighten a programming task.</… | |
+</ul> | |
+</p> | |
+<p> | |
+list in list: | |
+<ul> | |
+<li>a | |
+<ul> | |
+<li>b | |
+<ol> | |
+<li>c</li> | |
+<li>d</li> | |
+</ol> | |
+</li> | |
+<li>e</li> | |
+</ul> | |
+</li> | |
+<li>f</li> | |
+</ul> | |
+</p> | |
+<p> | |
+entity: &, <, ></p> | |
+<p> | |
+code: | |
+<pre><code>int powerof2(unsigned int n) { | |
+ return !((n - 1) & n) && n > 0; | |
+}</code></pre> | |
+</p> | |
+<h2>links</h2> | |
+<p> | |
+<a href="http://suckless.org">suckless</a></p> | |
+<h2>inline html</h2> | |
+<center> | |
+ ABC | |
+</center> | |
+ </div> | |
+ </div> | |
+ </body> | |
+</html> | |
diff --git a/site/output/rss.xml b/site/output/rss.xml | |
@@ -0,0 +1,26 @@ | |
+<?xml version="1.0" encoding="UTF-8"?> | |
+<rss version="2.0"> | |
+ <channel> | |
+ <title>Codemadness</title> | |
+ <link>http://www.codemadness.nl</link> | |
+ <description></description> | |
+ <language>en</language> | |
+ | |
+<item> | |
+ <title>Markdown test</title> | |
+ <link>http://www.codemadness.nl/markdown-test.html</link> | |
+ <pubDate>Wed, 02 Jan 2013 00:00:00 +0100</pubDate> | |
+ <author>author</author> | |
+ <guid isPermaLink="false">http://www.codemadness.nl/markdown-test.html… | |
+ <description><![CDATA[description here]]></description> | |
+</item> | |
+<item> | |
+ <title>Example title</title> | |
+ <link>http://www.codemadness.nl/example-page-template.html</link> | |
+ <pubDate>Tue, 01 Jan 2013 00:00:00 +0100</pubDate> | |
+ <author>author</author> | |
+ <guid isPermaLink="false">http://www.codemadness.nl/example-page-templ… | |
+ <description><![CDATA[description here]]></description> | |
+</item> | |
+ </channel> | |
+</rss> | |
diff --git a/site/output/sitemap.xml b/site/output/sitemap.xml | |
@@ -0,0 +1,6 @@ | |
+<?xml version="1.0" encoding="UTF-8"?> | |
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | |
+<url><loc>http://www.codemadness.nl/example-page-template.html</loc></url> | |
+<url><loc>http://www.codemadness.nl/index.html</loc></url> | |
+<url><loc>http://www.codemadness.nl/markdown-test.html</loc></url> | |
+</urlset> | |
diff --git a/site/output/urllist.txt b/site/output/urllist.txt | |
@@ -0,0 +1,3 @@ | |
+http://www.codemadness.nl/example-page-template.html | |
+http://www.codemadness.nl/index.html | |
+http://www.codemadness.nl/markdown-test.html |