home · contact · privacy
Add modification date element to article template.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 3 Jan 2017 09:12:41 +0000 (10:12 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 3 Jan 2017 09:12:41 +0000 (10:12 +0100)
processor/default.html.do
processor/metadata/article.tmpl.do
test/test_files/bar baz.html.ignoring
test/test_files/foo.html.ignoring
test/test_files/test.html.ignoring

index 8777d435c51210a5dc6eebd5f94beecf296857f0..7adf89b6ed73ddd27191416c18483cf480f7a7ea 100644 (file)
@@ -20,7 +20,9 @@ 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_friendly=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}")
+date_created=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}")
+datetime_lastmod_unix=$(get_lastmod_date_from_meta_file "$meta_file")
+date_updated=$(date -u "+%Y-%m-%d" -d "@${datetime_lastmod_unix}")
 
 # Put data into template.
 template=$(cat "$template_file")
@@ -28,6 +30,7 @@ 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/%DATE_CREATED%/'"$datetime_created_friendly"'/g' | \
+sed 's/%DATE_CREATED%/'"$date_created"'/g' | \
+sed 's/%DATE_UPDATED%/'"$date_updated"'/g' | \
 sed 's/%BODY%/'"$body"'/g' | \
 tr '\a' '%'
index 575e4334c6c4473d67a3a312618c670d09a3c454..e945d5b88819a63e7dc5427b742ce6c00923b42d 100644 (file)
@@ -23,7 +23,7 @@ header p { margin: 0; }
 <article>
 <header>
 <h1>%ARTICLE_TITLE_HTML%</h1>
-<p><time>%DATE_CREATED%</time></p>
+<p>created: <time>%DATE_CREATED%</time> / last update: <time>%DATE_UPDATED%</time></p>
 </header>
 %BODY%
 </article>
index 704347539d58e7863f4093789b880f1342af0548..b4167b77e990e3c6bd9d276139676acf556d460e 100644 (file)
@@ -19,7 +19,7 @@ header p { margin: 0; }
 <article>
 <header>
 <h1>foo</h1>
-<p><time>IGNORE</time></p>
+<p>created: <time>IGNORE</time> / last update: <time>IGNORE</time></p>
 </header>
 <h2 id="bar">bar</h2>
 <p>bar</p>
index 490e71aba5f6e13555a24afa0aafd9e3d99bae0e..ba0044677c5cf5abd1cabb1ebf478a8d4977410a 100644 (file)
@@ -19,7 +19,7 @@ header p { margin: 0; }
 <article>
 <header>
 <h1>a title with some nasty characters: &amp;&lt;&gt;&quot;' %BODY%</h1>
-<p><time>IGNORE</time></p>
+<p>created: <time>IGNORE</time> / last update: <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 91687d7e6d2a88a8a88d0ed23a32ffd70d4cb717..454343ffc33a2d48da34967506814a2847f52732 100644 (file)
@@ -19,7 +19,7 @@ header p { margin: 0; }
 <article>
 <header>
 <h1>foo <em>bar</em> <strong>baz</strong></h1>
-<p><time>IGNORE</time></p>
+<p>created: <time>IGNORE</time> / last update: <time>IGNORE</time></p>
 </header>
 <p>foo</p>
 <h2 id="bar">bar</h2>