Open
Description
I am using OpenRewrite Version 8.27.0 and the org.openrewrite.xml.format.TabsAndIndents
recept.
The issue: a new line in the <!DOCTYPE>
declaration element of an XML file is not indented with the continuationIndentSize
as it should be.
Following test reproduces the issue:
@DocumentExample
@Test
void continuationIndentsWithinDOCTYPE() {
rewriteRun(
spec -> spec.recipe(toRecipe(() -> new TabsAndIndentsVisitor<>(
TabsAndIndentsStyle.DEFAULT.withIndentSize(2).withContinuationIndentSize(5)
))),
xml(
"""
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<project>
</project>
""",
"""
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<project>
</project>
"""
)
);
}
The result:
expected:
"<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<project>
</project>"
but was:
"<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<project>
</project>
as you see, the continuation line into the doctype has not be indented.
Metadata
Assignees
Labels
Type
Projects
Status
Backlog
Activity