home · contact · privacy
Fix tests, improve templates.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 3 Jan 2017 01:52:01 +0000 (02:52 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 3 Jan 2017 01:52:01 +0000 (02:52 +0100)
processor/default.html.do
processor/index.html.do
processor/metadata/article.tmpl.do
processor/metadata/index.tmpl.do
test.sh
test/test_files/bar baz.html.ignoring
test/test_files/foo.html.ignoring
test/test_files/index.html.ignoring
test/test_files/test.html.ignoring

index 9c8c3014a825151d9d4573b24cf67c75aaf50e8f..8777d435c51210a5dc6eebd5f94beecf296857f0 100644 (file)
@@ -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' '%'
index 031029404ade82260ccb369b63f345d9961cb82f..725bccb243670cacf9a5ced56d5e1d7ad93968fc 100644 (file)
@@ -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' '%'
index 13beb35ff2823034b2ea4bbc5dbf59ade6d27b80..575e4334c6c4473d67a3a312618c670d09a3c454 100644 (file)
@@ -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>
index 5fbc63b730944986e410ad8a5d99cbd50f73c333..5befb4f20b7ffd066e80e00d9671d4c9dca895ae 100644 (file)
@@ -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 f7e54e955c0c150207282aca59afd09c51aca9f1..da87a2b6ed5f113d9161e4ddf056142f2f40a8de 100755 (executable)
--- 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
 
index 410dadf45ab2041052aafb4bc42849e03c27327a..704347539d58e7863f4093789b880f1342af0548 100644 (file)
@@ -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>
index 72d138864929f55bfea08b1346730144f44eaa71..490e71aba5f6e13555a24afa0aafd9e3d99bae0e 100644 (file)
@@ -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>
index a091bae048bf9909e214a1400a2cd89587ec6265..54b41722b2764caaaf75e597cb324d8bbd4612ec 100644 (file)
@@ -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>
index 31fa71508fb68d40491ca3d8faba3aab48250d36..91687d7e6d2a88a8a88d0ed23a32ffd70d4cb717 100644 (file)
@@ -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>