small fixes - static-site-scripts - static site generator shellscripts
 (HTM) git clone git://git.codemadness.org/static-site-scripts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e35b07eaa3aa6da544fde733e9a8bcc7bc072a5d
 (DIR) parent e534bbba4dcf9ea18fcecf9115c34957cb2594c6
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Mon, 16 Dec 2013 21:30:48 +0100
       
       small fixes
       
       Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
       
       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(-)
       ---
 (DIR) diff --git a/TODO b/TODO
       @@ -1 +1 @@
       -
       +
 (DIR) 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@&@\&amp;@g' -e 's@>@\&gt;@g' -e 's@<@\&lt;@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 descending.
       @@ -74,7 +74,7 @@ done | sort -rn | while read -r ts meta; do # process in order of time descendin
                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@' > "urllist.txt"
       +find ./ -type f -name "*.html" | sort | sed 's@^\./@'${siteurlfull}'/@' > "urllist.txt"
        
        # Sitemap: sitemap.xml
        (cat <<!
       @@ -117,7 +117,7 @@ find ./ -type f -name "*.html" | sort | sed 's@^./\(.*\)$@'${siteurlfull}'/\1@' 
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
        !
        
       -find ./ -type f -name "*.html" | sort | sed 's@^./\(.*\)$@<url><loc>'${siteurlfull}'/\1</loc></url>@'
       +find ./ -type f -name "*.html" | sort | sed 's@^\./\(.*\)$@<url><loc>'${siteurlfull}'/\1</loc></url>@'
        
        cat <<!
        </urlset>
 (DIR) 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 computer-related things</subtitle>
       +        <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.codemadness.nl/atom.xml" />
       +        
       +<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/markdown-test.html" />
       +        <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/example-page-template.html" />
       +        <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>
 (DIR) diff --git a/site/output/example-page-template.html b/site/output/example-page-template.html
       @@ -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="screen" />
       +                <link rel="stylesheet" href="print.css" type="text/css" media="print" />
       +                <link rel="alternate" type="application/rss+xml" title="Codemadness RSS Feed" href="rss.xml" />
       +                <link rel="alternate" type="application/atom+xml" title="Codemadness Atom Feed" href="atom.xml" />
       +                <link rel="icon" type="image/png" href="/favicon.png" />
       +                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       +                <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="Software I've written">Software</a>
       +                                </span>
       +                                <span id="links-contact">
       +                                        <span class="hidden"> | </span>
       +                                        <a href="rss.xml" title="Syndicate this site using RSS 2.0" class="rss">RSS</a> |
       +                                        <a href="atom.xml" title="Atom feed" class="atom">Atom</a> |
       +                                        <a href="mailto:hiltjo@AT@codemadness.DOT.org" title="Mail me" class="mail">Mail</a>
       +                                </span>
       +                        </div>
       +                </div>
       +                <hr class="hidden" />
       +                <div id="mainwrap">
       +                        <div id="main">
       +                                <h1><a href="" title="Example title">Example title</a></h1>
       +                                <p>This is an example page :)</p>
       +                        </div>
       +                </div>
       +        </body>
       +</html>
 (DIR) 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="screen" />
       +                <link rel="stylesheet" href="print.css" type="text/css" media="print" />
       +                <link rel="alternate" type="application/rss+xml" title="Codemadness RSS Feed" href="rss.xml" />
       +                <link rel="alternate" type="application/atom+xml" title="Codemadness Atom Feed" href="atom.xml" />
       +                <link rel="icon" type="image/png" href="/favicon.png" />
       +                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       +                <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 computer-related things" name="description" />
       +        </head>
       +        <body>
       +                <div id="menuwrap">
       +                        <div id="menu">
       +                                <span id="links">
       +                                        <a href="/" title="Blog">Blog</a> |
       +                                        <a href="/downloads/projects/" title="Software I've written">Software</a>
       +                                </span>
       +                                <span id="links-contact">
       +                                        <span class="hidden"> | </span>
       +                                        <a href="rss.xml" title="Syndicate this site using RSS 2.0" class="rss">RSS</a> |
       +                                        <a href="atom.xml" title="Atom feed" class="atom">Atom</a> |
       +                                        <a href="mailto:hiltjo@AT@codemadness.DOT.org" title="Mail me" class="mail">Mail</a>
       +                                </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="description here">Markdown test</a></td></tr>
       +<tr><td class="lm">2013-01-01</td><td><a href="example-page-template.html" title="description here">Example title</a></td></tr>
       +</table>
       +                        </div>
       +                </div>
       +        </body>
       +</html>
 (DIR) 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="screen" />
       +                <link rel="stylesheet" href="print.css" type="text/css" media="print" />
       +                <link rel="alternate" type="application/rss+xml" title="Codemadness RSS Feed" href="rss.xml" />
       +                <link rel="alternate" type="application/atom+xml" title="Codemadness Atom Feed" href="atom.xml" />
       +                <link rel="icon" type="image/png" href="/favicon.png" />
       +                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
       +                <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="Software I've written">Software</a>
       +                                </span>
       +                                <span id="links-contact">
       +                                        <span class="hidden"> | </span>
       +                                        <a href="rss.xml" title="Syndicate this site using RSS 2.0" class="rss">RSS</a> |
       +                                        <a href="atom.xml" title="Atom feed" class="atom">Atom</a> |
       +                                        <a href="mailto:hiltjo@AT@codemadness.DOT.org" title="Mail me" class="mail">Mail</a>
       +                                </span>
       +                        </div>
       +                </div>
       +                <hr class="hidden" />
       +                <div id="mainwrap">
       +                        <div id="main">
       +                                <h1><a href="" title="Markdown test">Markdown test</a></h1>
       +                                <h2>simple tests</h2>
       +<p>
       +first paragraph.
       +testing surround: <em>emph</em> then <strong>strong</strong> and <code>code</code>.</p>
       +<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>.'''' .'.'. |  |
       + '''. | ' | |  |
       +''''  '   '  &quot;&quot;</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.</li>
       +</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: &amp;, &lt;, &gt;</p>
       +<p>
       +code:
       +<pre><code>int powerof2(unsigned int n) {
       +        return !((n - 1) &amp; n) &amp;&amp; n &gt; 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>
 (DIR) 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</guid>
       +        <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-template.html</guid>
       +        <description><![CDATA[description here]]></description>
       +</item>
       +        </channel>
       +</rss>
 (DIR) 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>
 (DIR) 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