From: Christian Heller Date: Tue, 3 Jan 2017 01:52:01 +0000 (+0100) Subject: Fix tests, improve templates. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=54220bdf43b8a1269dc54ae19dad9038b11e9981;p=redo-blog Fix tests, improve templates. --- diff --git a/processor/default.html.do b/processor/default.html.do index 9c8c301..8777d43 100644 --- a/processor/default.html.do +++ b/processor/default.html.do @@ -20,8 +20,7 @@ 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_rfc3339=$(date -u "+%Y-%m-%dT%TZ" -d "@${datetime_created_unix}") -datetime_created_friendly=$(date -u "+%Y-%m-%d %H:%M (UTC)" -d "@${datetime_created_unix}") +datetime_created_friendly=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}") # Put data into template. template=$(cat "$template_file") @@ -29,7 +28,6 @@ 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/%DATETIME_CREATED_RFC3339%/'"$datetime_created_rfc3339"'/g' | \ -sed 's/%DATETIME_CREATED_FRIENDLY%/'"$datetime_created_friendly"'/g' | \ +sed 's/%DATE_CREATED%/'"$datetime_created_friendly"'/g' | \ sed 's/%BODY%/'"$body"'/g' | \ tr '\a' '%' diff --git a/processor/index.html.do b/processor/index.html.do index 0310294..725bccb 100644 --- a/processor/index.html.do +++ b/processor/index.html.do @@ -42,6 +42,6 @@ rm -rf "${tmp_snippets_dir}" # Put data into template. template=$(cat "$template_file") printf "%s" "$template" | \ -sed 's/%TITLE%/'"$title"'/g' | \ -sed 's/%LIST%/'"$list"'/g' | \ +sed 's/%BLOG_TITLE%/'"$title"'/g' | \ +sed 's/%INDEX%/'"$list"'/g' | \ tr '\a' '%' diff --git a/processor/metadata/article.tmpl.do b/processor/metadata/article.tmpl.do index 13beb35..575e433 100644 --- a/processor/metadata/article.tmpl.do +++ b/processor/metadata/article.tmpl.do @@ -23,7 +23,7 @@ header p { margin: 0; }

%ARTICLE_TITLE_HTML%

-

+

%BODY%
diff --git a/processor/metadata/index.tmpl.do b/processor/metadata/index.tmpl.do index 5fbc63b..5befb4f 100644 --- a/processor/metadata/index.tmpl.do +++ b/processor/metadata/index.tmpl.do @@ -10,13 +10,13 @@ cat << EOF h1 { font-size: 2em; } -%TITLE% +%BLOG_TITLE% -

%TITLE%

+

%BLOG_TITLE%

feed

diff --git a/test.sh b/test.sh index f7e54e9..da87a2b 100755 --- a/test.sh +++ b/test.sh @@ -99,10 +99,13 @@ for file in "$expected_files_dir"/*.html.ignoring; do fi generated_file="$cmp_file".ignoring cat "$cmp_file" | \ - sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' | \ - sed 's/IGNORET[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z/IGNORE/g' | \ - sed 's/IGNORE [0-9]\{2\}:[0-9]\{2\} (UTC)/IGNORE/g' \ + sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' \ > "$generated_file" +# cat "$cmp_file" | \ +# sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}/IGNORE/g' | \ +# sed 's/IGNORET[0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}Z/IGNORE/g' | \ +# sed 's/IGNORE [0-9]\{2\}:[0-9]\{2\} (UTC)/IGNORE/g' \ +# > "$generated_file" diff_test "$file" "$generated_file" done diff --git a/test/test_files/bar baz.html.ignoring b/test/test_files/bar baz.html.ignoring index 410dadf..7043475 100644 --- a/test/test_files/bar baz.html.ignoring +++ b/test/test_files/bar baz.html.ignoring @@ -1,6 +1,17 @@ + + Yet another blog – foo @@ -8,7 +19,7 @@

foo

-

+

bar

bar

diff --git a/test/test_files/foo.html.ignoring b/test/test_files/foo.html.ignoring index 72d1388..490e71a 100644 --- a/test/test_files/foo.html.ignoring +++ b/test/test_files/foo.html.ignoring @@ -1,6 +1,17 @@ + + Yet another blog – a title with some nasty characters: &<>"' %BODY% @@ -8,7 +19,7 @@

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

-

+

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

some sub-heading

diff --git a/test/test_files/index.html.ignoring b/test/test_files/index.html.ignoring index a091bae..54b4172 100644 --- a/test/test_files/index.html.ignoring +++ b/test/test_files/index.html.ignoring @@ -1,6 +1,10 @@ + + Yet another blog diff --git a/test/test_files/test.html.ignoring b/test/test_files/test.html.ignoring index 31fa715..91687d7 100644 --- a/test/test_files/test.html.ignoring +++ b/test/test_files/test.html.ignoring @@ -1,6 +1,17 @@ + + Yet another blog – foo bar baz @@ -8,7 +19,7 @@

foo bar baz

-

+

foo

bar