home
·
contact
·
privacy
projects
/
redo-blog
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
389680b
)
Add modification date element to article template.
author
Christian Heller
<c.heller@plomlompom.de>
Tue, 3 Jan 2017 09:12:41 +0000
(10:12 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Tue, 3 Jan 2017 09:12:41 +0000
(10:12 +0100)
processor/default.html.do
patch
|
blob
|
history
processor/metadata/article.tmpl.do
patch
|
blob
|
history
test/test_files/bar baz.html.ignoring
patch
|
blob
|
history
test/test_files/foo.html.ignoring
patch
|
blob
|
history
test/test_files/test.html.ignoring
patch
|
blob
|
history
diff --git
a/processor/default.html.do
b/processor/default.html.do
index 8777d435c51210a5dc6eebd5f94beecf296857f0..7adf89b6ed73ddd27191416c18483cf480f7a7ea 100644
(file)
--- 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")
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")
# 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/%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' '%'
sed 's/%BODY%/'"$body"'/g' | \
tr '\a' '%'
diff --git
a/processor/metadata/article.tmpl.do
b/processor/metadata/article.tmpl.do
index 575e4334c6c4473d67a3a312618c670d09a3c454..e945d5b88819a63e7dc5427b742ce6c00923b42d 100644
(file)
--- 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>
<article>
<header>
<h1>%ARTICLE_TITLE_HTML%</h1>
-<p>
<time>%DATE_CRE
ATED%</time></p>
+<p>
created: <time>%DATE_CREATED%</time> / last update: <time>%DATE_UPD
ATED%</time></p>
</header>
%BODY%
</article>
</header>
%BODY%
</article>
diff --git
a/test/test_files/bar baz.html.ignoring
b/test/test_files/bar baz.html.ignoring
index 704347539d58e7863f4093789b880f1342af0548..b4167b77e990e3c6bd9d276139676acf556d460e 100644
(file)
--- a/
test/test_files/bar baz.html.ignoring
+++ b/
test/test_files/bar baz.html.ignoring
@@
-19,7
+19,7
@@
header p { margin: 0; }
<article>
<header>
<h1>foo</h1>
<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>
</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 490e71aba5f6e13555a24afa0aafd9e3d99bae0e..ba0044677c5cf5abd1cabb1ebf478a8d4977410a 100644
(file)
--- a/
test/test_files/foo.html.ignoring
+++ b/
test/test_files/foo.html.ignoring
@@
-19,7
+19,7
@@
header p { margin: 0; }
<article>
<header>
<h1>a title with some nasty characters: &<>"' %BODY%</h1>
<article>
<header>
<h1>a title with some nasty characters: &<>"' %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: /;%'"><&äöüß</p>
<h2 id="some-sub-heading">some sub-heading</h2>
</header>
<p>this text contains some special characters: /;%'"><&äöüß</p>
<h2 id="some-sub-heading">some sub-heading</h2>
diff --git
a/test/test_files/test.html.ignoring
b/test/test_files/test.html.ignoring
index 91687d7e6d2a88a8a88d0ed23a32ffd70d4cb717..454343ffc33a2d48da34967506814a2847f52732 100644
(file)
--- a/
test/test_files/test.html.ignoring
+++ b/
test/test_files/test.html.ignoring
@@
-19,7
+19,7
@@
header p { margin: 0; }
<article>
<header>
<h1>foo <em>bar</em> <strong>baz</strong></h1>
<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>
</header>
<p>foo</p>
<h2 id="bar">bar</h2>