Skip to content

Problems with html template tag #2258

Description

@efMss24

If we parse the following html

<ul>
    <li>Value 1</li>
    <li>Value 2
       <template id="template-1">
          <li>Template 1 Value 1</li>
          <li>Template 1 Value 2</li>
       </template>
    </li>
    <li>Value 3</li>
</ul>

we get the following Output:

<ul>
<li>Value 1</li>
<li>Value 2 
<template id="template-1">
</template>
</li>
<li>Template 1 Value 1</li>
<li>Template 1 Value 2</li>
<li>Value 3</li>
</ul>

The template-tag is empty and all the contents are added after the tag. We would expect the content of this tag is optimized but remains inside the tag.

We use following OutputSettings:

outputSettings.syntax(Document.OutputSettings.Syntax.html);
outputSettings.escapeMode(Entities.EscapeMode.extended);
outputSettings.prettyPrint(true);
outputSettings.charset(StandardCharsets.UTF_8);
outputSettings.outline(true);
outputSettings.indentAmount(0);

For parsing we use:

Document htmlDocument = Jsoup.parse(htmlString);
String htmlOutput = htmlDocument.outputSettings(outputSettings).toString();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugA confirmed bug, that we should fixfixedAn {bug|improvement} that has been {fixed|implemented}

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions