From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 26 Jan 2017 00:27:04 +0000 (+0100)
Subject: Add page URL title template field.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/ledger?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=redo-blog

Add page URL title template field.
---

diff --git a/processor/default.html.do b/processor/default.html.do
index 8e88dbb..f0d43a3 100644
--- a/processor/default.html.do
+++ b/processor/default.html.do
@@ -33,6 +33,7 @@ title_html=$(cat "$intermediate_file" | head -1)
 title_plaintext=`echo "$title_html" | html2text`
 title_html=$(printf "%s" "$title_html" | prep_sed)
 title_plaintext=$(escape_html "$title_plaintext" | prep_sed)
+title_url=$(escape_html "${1%.html}" | prep_sed)
 body=$(cat "$intermediate_file" | sed 1d | prep_sed)
 datetime_created_unix=$(get_creation_date_from_meta_file_seconds "$meta_file")
 date_created=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}")
@@ -52,4 +53,5 @@ sed 's/%DATE_UPDATED%/'"$date_updated"'/g' | \
 sed 's/%BODY%/'"$body"'/g' | \
 sed 's/%LINKBACKS%/'"$replies"'/g' | \
 sed 's/%CAPTCHA%/'"$captcha"'/g' | \
+sed 's/%TITLE_URL%/'"$title_url"'/g' | \
 tr '\a' '%'
diff --git a/processor/metadata/article.tmpl.do b/processor/metadata/article.tmpl.do
index 406878c..ea81ede 100644
--- a/processor/metadata/article.tmpl.do
+++ b/processor/metadata/article.tmpl.do
@@ -27,6 +27,7 @@ Links back:
 <ul>%LINKBACKS%
 </ul>
 Captcha: %CAPTCHA%
+Title in URL: %TITLE_URL%
 </footer>
 </article>
 EOF
diff --git a/test/test_files/bar baz.html.ignoring b/test/test_files/bar baz.html.ignoring
index 76598b5..bf4a6c9 100644
--- a/test/test_files/bar baz.html.ignoring	
+++ b/test/test_files/bar baz.html.ignoring	
@@ -26,5 +26,6 @@ Links back:
 <ul>
 </ul>
 Captcha: apple
+Title in URL: bar baz
 </footer>
 </article>
\ No newline at end of file
diff --git a/test/test_files/foo.html.ignoring b/test/test_files/foo.html.ignoring
index bc19030..cfbd635 100644
--- a/test/test_files/foo.html.ignoring
+++ b/test/test_files/foo.html.ignoring
@@ -29,5 +29,6 @@ Links back:
 <li><a href="http://example.com/some$()wh%20at&#x27;da&amp;quot;ngerusURL">http://example.com/some$()wh%20at&#x27;da&amp;quot;ngerusURL</a></li>
 </ul>
 Captcha: apple
+Title in URL: foo
 </footer>
 </article>
\ No newline at end of file
diff --git a/test/test_files/te&quot;st.html.ignoring b/test/test_files/te&quot;st.html.ignoring
index 55cc1de..0392137 100644
--- a/test/test_files/te&quot;st.html.ignoring
+++ b/test/test_files/te&quot;st.html.ignoring
@@ -25,5 +25,6 @@ Links back:
 <ul>
 </ul>
 Captcha: apple
+Title in URL: te&amp;quot;st
 </footer>
 </article>
\ No newline at end of file