aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2017-02-15 00:07:28 +0100
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2017-02-15 00:07:28 +0100
commitbc23293bb178b6abcafa0f67d432cbff6ac3c861 (patch)
tree2f68f1abf87c2a326be2a21e275252bb8f565621
parent80017f034146b50fdc441c96636f1098adf7037e (diff)
downloadblogc-bc23293bb178b6abcafa0f67d432cbff6ac3c861.tar.gz
blogc-bc23293bb178b6abcafa0f67d432cbff6ac3c861.tar.bz2
blogc-bc23293bb178b6abcafa0f67d432cbff6ac3c861.zip
content-parser: html-encode pre-defined title. updated man pages
-rw-r--r--man/blogc-source.7.ronn6
-rw-r--r--man/blogc-template.7.ronn2
-rw-r--r--src/blogc/content-parser.c2
3 files changed, 8 insertions, 2 deletions
diff --git a/man/blogc-source.7.ronn b/man/blogc-source.7.ronn
index 0273194..115ff94 100644
--- a/man/blogc-source.7.ronn
+++ b/man/blogc-source.7.ronn
@@ -52,6 +52,12 @@ that stores the name of the source file, without its extension. This is useful
for building permalinks in templates. This variable can't be overriden by an
explicit definition in source file.
+The variable `TITLE` is created by the source parser by default, containing the
+unparsed value of the first header found in the source file. The content is not
+parsed but HTML entities are encoded. Headers inside blockquotes are ignored.
+This variable can be overriden by an explicit definition in source file, that
+must have the HTML entities escaped manually.
+
Another variable, `DESCRIPTION`, will be automatically created by the source
parser. It contains the unparsed content of the first paragraph found in the
source file. The content is not parsed but HTML entities are encoded. Paragraphs
diff --git a/man/blogc-template.7.ronn b/man/blogc-template.7.ronn
index d010a1c..c6a3af1 100644
--- a/man/blogc-template.7.ronn
+++ b/man/blogc-template.7.ronn
@@ -75,7 +75,7 @@ This is how a `listing_once` block is defined:
{% endblock %}
This is a 'real life' usage example of a `listing_once` block, supposing
-that each source file defines a `TITLE` variable:
+that the `TITLE` variable is defined:
{% block listing_once %}
<ul>
diff --git a/src/blogc/content-parser.c b/src/blogc/content-parser.c
index 415e5ee..86aa74b 100644
--- a/src/blogc/content-parser.c
+++ b/src/blogc/content-parser.c
@@ -836,7 +836,7 @@ blogc_content_parse(const char *src, size_t *end_excerpt, char **title,
(real_end != 0 ? real_end : current);
tmp = bc_strndup(src + start, end - start);
if (title != NULL && *title == NULL)
- *title = bc_strdup(tmp);
+ *title = blogc_htmlentities(tmp);
parsed = blogc_content_parse_inline(tmp);
slug = blogc_slugify(tmp);
if (slug == NULL)