Skip to content

Commit

Permalink
content-parser: html-encode pre-defined title. updated man pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelmartins committed Feb 14, 2017
1 parent 80017f0 commit bc23293
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions man/blogc-source.7.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion man/blogc-template.7.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion src/blogc/content-parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bc23293

Please sign in to comment.