Mercurial > blahgd > fmt4
changeset 1154:6924bb3c7e98
post fmt3: don't wrap verbatim environment in <p></p>
The whole point of the verbatim environment is to allow inserting arbitrary
HTML into the output. Therefore, it doesn't make sense to wrap the result
in a paragraph tag. Furthermore, this change avoids HTML validator errors
caused by illegal nesting of tags. For example, a hand-crafted table in a
verbatim environment produces:
<p><table>...</table></p>
This is an error because <table> cannot exist inside a paragraph. With this
change, the outer <p> isn't added making a valid HTML document.
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 30 Dec 2018 11:09:09 -0500 |
parents | 85edfabdce2f |
children | 551f09261f81 |
files | post_fmt3.y |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/post_fmt3.y Sun Dec 30 11:09:06 2018 -0500 +++ b/post_fmt3.y Sun Dec 30 11:09:09 2018 -0500 @@ -201,7 +201,7 @@ | PERCENT { $$ = STATIC_STR("%"); } | '\\' cmd { $$ = $2; } | MATHSTART math MATHEND { $$ = render_math($2); } - | VERBSTART verb VERBEND { $$ = str_cat(3, STATIC_STR("</p><p>"), $2, STATIC_STR("</p><p>")); } + | VERBSTART verb VERBEND { $$ = str_cat(3, STATIC_STR("</p>"), $2, STATIC_STR("<p>")); } | LISTSTART verb LISTEND { $$ = str_cat(3, STATIC_STR("</p><pre>"), listing_str($2), STATIC_STR("</pre><p>")); }