From db7d3a5afde411f072f7d8b3f809b1906f4910de Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 25 Jan 2017 03:10:03 +0100
Subject: [PATCH] Add captcha placeholder to templating.

---
 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 ba163e2..196713c 100644
--- a/processor/default.html.do
+++ b/processor/default.html.do
@@ -38,6 +38,7 @@ 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}")
 replies=$(while read line; do prep_url "$line"; done < "$replies_file")
+captcha=$(escape_html "$(cat "$captcha_file" | sed -n 2p)" | prep_sed)
 
 # Put data into template.
 template=$(cat "$article_tmpl_file")
@@ -49,4 +50,5 @@ sed 's/%DATE_CREATED%/'"$date_created"'/g' | \
 sed 's/%DATE_UPDATED%/'"$date_updated"'/g' | \
 sed 's/%BODY%/'"$body"'/g' | \
 sed 's/%LINKBACKS%/'"$replies"'/g' | \
+sed 's/%CAPTCHA%/'"$captcha"'/g' | \
 tr '\a' '%'
diff --git a/processor/metadata/article.tmpl.do b/processor/metadata/article.tmpl.do
index f24106a..406878c 100644
--- a/processor/metadata/article.tmpl.do
+++ b/processor/metadata/article.tmpl.do
@@ -26,6 +26,7 @@ header p { margin: 0; }
 Links back:
 <ul>%LINKBACKS%
 </ul>
+Captcha: %CAPTCHA%
 </footer>
 </article>
 EOF
diff --git a/test/test_files/bar baz.html.ignoring b/test/test_files/bar baz.html.ignoring
index 1c29f06..76598b5 100644
--- a/test/test_files/bar baz.html.ignoring	
+++ b/test/test_files/bar baz.html.ignoring	
@@ -25,5 +25,6 @@ header p { margin: 0; }
 Links back:
 <ul>
 </ul>
+Captcha: apple
 </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 0af3900..bc19030 100644
--- a/test/test_files/foo.html.ignoring
+++ b/test/test_files/foo.html.ignoring
@@ -28,5 +28,6 @@ Links back:
 <li><a href="http://example.org/">http://example.org/</a></li>
 <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
 </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 d751b3b..55cc1de 100644
--- a/test/test_files/te&quot;st.html.ignoring
+++ b/test/test_files/te&quot;st.html.ignoring
@@ -24,5 +24,6 @@ header p { margin: 0; }
 Links back:
 <ul>
 </ul>
+Captcha: apple
 </footer>
 </article>
\ No newline at end of file
-- 
2.30.2