From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 3 Jan 2017 01:52:01 +0000 (+0100)
Subject: Fix tests, improve templates.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/todo?a=commitdiff_plain;h=54220bdf43b8a1269dc54ae19dad9038b11e9981;p=redo-blog

Fix tests, improve templates.
---

diff --git a/processor/default.html.do b/processor/default.html.do
index 9c8c301..8777d43 100644
--- a/processor/default.html.do
+++ b/processor/default.html.do
@@ -20,8 +20,7 @@ title_html=$(printf "%s" "$title_html" | prep_sed)
 title_plaintext=$(escape_html "$title_plaintext" | prep_sed)
 body=$(cat "$intermediate_file" | sed 1d | prep_sed)
 datetime_created_unix=$(get_creation_date_from_meta_file_seconds "$meta_file")
-datetime_created_rfc3339=$(date -u "+%Y-%m-%dT%TZ" -d "@${datetime_created_unix}")
-datetime_created_friendly=$(date -u "+%Y-%m-%d %H:%M (UTC)" -d "@${datetime_created_unix}")
+datetime_created_friendly=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}")
 
 # Put data into template.
 template=$(cat "$template_file")
@@ -29,7 +28,6 @@ printf "%s" "$template" | \
 sed 's/%BLOG_TITLE%/'"$blog_title"'/g' | \
 sed 's/%ARTICLE_TITLE_ESCAPED%/'"$title_plaintext"'/g' | \
 sed 's/%ARTICLE_TITLE_HTML%/'"$title_html"'/g' | \
-sed 's/%DATETIME_CREATED_RFC3339%/'"$datetime_created_rfc3339"'/g' | \
-sed 's/%DATETIME_CREATED_FRIENDLY%/'"$datetime_created_friendly"'/g' | \
+sed 's/%DATE_CREATED%/'"$datetime_created_friendly"'/g' | \
 sed 's/%BODY%/'"$body"'/g' | \
 tr '\a' '%'
diff --git a/processor/index.html.do b/processor/index.html.do
index 0310294..725bccb 100644
--- a/processor/index.html.do
+++ b/processor/index.html.do
@@ -42,6 +42,6 @@ rm -rf "${tmp_snippets_dir}"
 # Put data into template.
 template=$(cat "$template_file")
 printf "%s" "$template" | \
-sed 's/%TITLE%/'"$title"'/g' | \
-sed 's/%LIST%/'"$list"'/g' | \
+sed 's/%BLOG_TITLE%/'"$title"'/g' | \
+sed 's/%INDEX%/'"$list"'/g' | \
 tr '\a' '%'
diff --git a/processor/metadata/article.tmpl.do b/processor/metadata/article.tmpl.do
index 13beb35..575e433 100644
--- a/processor/metadata/article.tmpl.do
+++ b/processor/metadata/article.tmpl.do
@@ -23,7 +23,7 @@ header p { margin: 0; }
 <article>
 <header>
 <h1>%ARTICLE_TITLE_HTML%</h1>
-<p><time datetime="%DATETIME_CREATED_RFC3339%">%DATETIME_CREATED_FRIENDLY%</time></p>
+<p><time>%DATE_CREATED%</time></p>
 </header>
 %BODY%
 </article>
diff --git a/processor/metadata/index.tmpl.do b/processor/metadata/index.tmpl.do
index 5fbc63b..5befb4f 100644
--- a/processor/metadata/index.tmpl.do
+++ b/processor/metadata/index.tmpl.do
@@ -10,13 +10,13 @@ cat << EOF
 h1 { font-size: 2em; }
 </style>
 <link rel="alternate" type="application/rss+xml" title="atom feed" href="feed.xml" />
-<title>%TITLE%</title>
+<title>%BLOG_TITLE%</title>
 </head>
 <body>
-<h1>%TITLE%</h1>
+<h1>%BLOG_TITLE%</h1>
 <p><a href="feed.xml">feed</a></p>
 <ul>
-%LIST%
+%INDEX%
 </ul>
 </body>
 </html>
diff --git a/test.sh b/test.sh
index f7e54e9..da87a2b 100755
--- a/test.sh
+++ b/test.sh
@@ -99,10 +99,13 @@ for file in "$expected_files_dir"/*.html.ignoring; do
   fi
   generated_file="$cmp_file".ignoring
   cat "$cmp_file" | \
-    sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' | \
-    sed 's/IGNORET[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z/IGNORE/g' | \
-    sed 's/IGNORE [0-9]\{2\}:[0-9]\{2\} (UTC)/IGNORE/g' \
+    sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' \
     > "$generated_file"
+#  cat "$cmp_file" | \
+#    sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' | \
+#    sed 's/IGNORET[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z/IGNORE/g' | \
+#    sed 's/IGNORE [0-9]\{2\}:[0-9]\{2\} (UTC)/IGNORE/g' \
+#    > "$generated_file"
   diff_test "$file" "$generated_file"
 done
 
diff --git a/test/test_files/bar baz.html.ignoring b/test/test_files/bar baz.html.ignoring
index 410dadf..7043475 100644
--- a/test/test_files/bar baz.html.ignoring	
+++ b/test/test_files/bar baz.html.ignoring	
@@ -1,6 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
+<meta charset="UTF-8">
+<style type="text/css">
+h1 { font-size: 2em; }
+h2 { font-size: 1.5em; }
+h3 { font-size: 1.17em; }
+h4 { font-size: 1.12em; }
+h5 { font-size: .83em; }
+h6 { font-size: .75em; }
+header h1 { margin-bottom: 0.1em; }
+header p { margin: 0; }
+</style>
 <title>Yet another blog – foo</title>
 </head>
 <body>
@@ -8,7 +19,7 @@
 <article>
 <header>
 <h1>foo</h1>
-<p><time datetime="IGNORE">IGNORE</time></p>
+<p><time>IGNORE</time></p>
 </header>
 <h2 id="bar">bar</h2>
 <p>bar</p>
diff --git a/test/test_files/foo.html.ignoring b/test/test_files/foo.html.ignoring
index 72d1388..490e71a 100644
--- a/test/test_files/foo.html.ignoring
+++ b/test/test_files/foo.html.ignoring
@@ -1,6 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
+<meta charset="UTF-8">
+<style type="text/css">
+h1 { font-size: 2em; }
+h2 { font-size: 1.5em; }
+h3 { font-size: 1.17em; }
+h4 { font-size: 1.12em; }
+h5 { font-size: .83em; }
+h6 { font-size: .75em; }
+header h1 { margin-bottom: 0.1em; }
+header p { margin: 0; }
+</style>
 <title>Yet another blog – a title with some nasty characters: &amp;&lt;&gt;&quot;&#x27; %BODY%</title>
 </head>
 <body>
@@ -8,7 +19,7 @@
 <article>
 <header>
 <h1>a title with some nasty characters: &amp;&lt;&gt;&quot;' %BODY%</h1>
-<p><time datetime="IGNORE">IGNORE</time></p>
+<p><time>IGNORE</time></p>
 </header>
 <p>this text contains some special characters: /;%'&quot;&gt;&lt;&amp;äöüß</p>
 <h2 id="some-sub-heading">some sub-heading</h2>
diff --git a/test/test_files/index.html.ignoring b/test/test_files/index.html.ignoring
index a091bae..54b4172 100644
--- a/test/test_files/index.html.ignoring
+++ b/test/test_files/index.html.ignoring
@@ -1,6 +1,10 @@
 <!DOCTYPE html>
 <html>
 <head>
+<meta charset="UTF-8">
+<style type="text/css">
+h1 { font-size: 2em; }
+</style>
 <link rel="alternate" type="application/rss+xml" title="atom feed" href="feed.xml" />
 <title>Yet another blog</title>
 </head>
diff --git a/test/test_files/test.html.ignoring b/test/test_files/test.html.ignoring
index 31fa715..91687d7 100644
--- a/test/test_files/test.html.ignoring
+++ b/test/test_files/test.html.ignoring
@@ -1,6 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
+<meta charset="UTF-8">
+<style type="text/css">
+h1 { font-size: 2em; }
+h2 { font-size: 1.5em; }
+h3 { font-size: 1.17em; }
+h4 { font-size: 1.12em; }
+h5 { font-size: .83em; }
+h6 { font-size: .75em; }
+header h1 { margin-bottom: 0.1em; }
+header p { margin: 0; }
+</style>
 <title>Yet another blog – foo bar baz</title>
 </head>
 <body>
@@ -8,7 +19,7 @@
 <article>
 <header>
 <h1>foo <em>bar</em> <strong>baz</strong></h1>
-<p><time datetime="IGNORE">IGNORE</time></p>
+<p><time>IGNORE</time></p>
 </header>
 <p>foo</p>
 <h2 id="bar">bar</h2>