remove DOCTYPE declarations (#1260)

This commit is contained in:
Athou
2025-01-10 16:09:21 +01:00
parent 74f7c48818
commit 62d3ed16e6
3 changed files with 26 additions and 0 deletions

View File

@@ -13,4 +13,22 @@ class FeedCleanerTest {
Assertions.assertEquals("<source>T&#180;l&#180;phone &#8242;</source>", feedCleaner.replaceHtmlEntitiesWithNumericEntities(source));
}
@Test
void testRemoveDoctype() {
String source = "<!DOCTYPE html><html><head></head><body></body></html>";
Assertions.assertEquals("<html><head></head><body></body></html>", feedCleaner.removeDoctypeDeclarations(source));
}
@Test
void testRemoveMultilineDoctype() {
String source = """
<!DOCTYPE
html
>
<html><head></head><body></body></html>""";
Assertions.assertEquals("""
<html><head></head><body></body></html>""", feedCleaner.removeDoctypeDeclarations(source));
}
}