Commit 329499db authored by Michael Hamann's avatar Michael Hamann
Browse files

XCOMMONS-901: Support both XHTML 1.0 and XHTML 5 in HtmlCleaner

* Document another exception in BodyFilter
* Improve robustness in HTML version parameter parsing
parent b3805eb7
......@@ -318,8 +318,8 @@ private int getHTMLVersion(HTMLCleanerConfiguration configuration)
{
String param = configuration.getParameters().get(HTMLCleanerConfiguration.HTML_VERSION);
int htmlVersion = 4;
if (param != null) {
htmlVersion = Integer.parseInt(param);
if ("5".equals(param)) {
htmlVersion = 5;
}
return htmlVersion;
}
......
......@@ -57,7 +57,8 @@ public class BodyFilter extends AbstractHTMLFilter
* }</pre>
*
* We also use this list for HTML5 where in theory everything is allowed, but we instead only allow flow content
* that is not also phrasing content except for {@code <ins>} and {@code <del>} that were already allowed in HTML 4.
* that is not also phrasing content except for {@code <ins>} and {@code <del>} that were already allowed in HTML
* 4 and {@code <template>} which is not rendered and thus no extra paragraph should be created for it.
*/
private static final List<String> ALLOWED_BODY_TAGS = Arrays.asList(HTMLConstants.TAG_ADDRESS,
HTMLConstants.TAG_ARTICLE, HTMLConstants.TAG_ASIDE, HTMLConstants.TAG_BLOCKQUOTE, HTMLConstants.TAG_DEL,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment