From b75f33f8facf41eaae0699811ebe7595ed582c14 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 26 Jan 2017 01:27:04 +0100
Subject: [PATCH] Add page URL title template field.

---
 processor/default.html.do                | 2 ++
 processor/metadata/article.tmpl.do       | 1 +
 test/test_files/bar baz.html.ignoring    | 1 +
 test/test_files/foo.html.ignoring        | 1 +
 test/test_files/te&quot;st.html.ignoring | 1 +
 5 files changed, 6 insertions(+)

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
-- 
2.30.2