From: Christian Heller Date: Tue, 3 Jan 2017 09:12:41 +0000 (+0100) Subject: Add modification date element to article template. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/day?a=commitdiff_plain;h=57b9f8ec5eebf7fed09da3007c0571bab7d982fa;p=redo-blog Add modification date element to article template. --- diff --git a/processor/default.html.do b/processor/default.html.do index 8777d43..7adf89b 100644 --- a/processor/default.html.do +++ b/processor/default.html.do @@ -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' '%' diff --git a/processor/metadata/article.tmpl.do b/processor/metadata/article.tmpl.do index 575e433..e945d5b 100644 --- a/processor/metadata/article.tmpl.do +++ b/processor/metadata/article.tmpl.do @@ -23,7 +23,7 @@ header p { margin: 0; }

%ARTICLE_TITLE_HTML%

-

+

created: / last update:

%BODY%
diff --git a/test/test_files/bar baz.html.ignoring b/test/test_files/bar baz.html.ignoring index 7043475..b4167b7 100644 --- a/test/test_files/bar baz.html.ignoring +++ b/test/test_files/bar baz.html.ignoring @@ -19,7 +19,7 @@ header p { margin: 0; }

foo

-

+

created: / last update:

bar

bar

diff --git a/test/test_files/foo.html.ignoring b/test/test_files/foo.html.ignoring index 490e71a..ba00446 100644 --- a/test/test_files/foo.html.ignoring +++ b/test/test_files/foo.html.ignoring @@ -19,7 +19,7 @@ header p { margin: 0; }

a title with some nasty characters: &<>"' %BODY%

-

+

created: / last update:

this text contains some special characters: /;%'"><&äöüß

some sub-heading

diff --git a/test/test_files/test.html.ignoring b/test/test_files/test.html.ignoring index 91687d7..454343f 100644 --- a/test/test_files/test.html.ignoring +++ b/test/test_files/test.html.ignoring @@ -19,7 +19,7 @@ header p { margin: 0; }

foo bar baz

-

+

created: / last update:

foo

bar