diff --git a/commons/src/androidTest/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParserTest.kt b/commons/src/androidTest/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParserTest.kt index ddf88e065..711da77fe 100644 --- a/commons/src/androidTest/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParserTest.kt +++ b/commons/src/androidTest/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParserTest.kt @@ -78,4 +78,29 @@ class MetaTagsParserTest { } } } + + @Test + fun testParseWithAdditionalTags() { + val input = + """ + | + | + | + | + """.trimMargin() + + val exp = + listOf( + listOf("property" to "og:title", "content" to "Uma conversa com Antonio Vargas"), + ) + + val metaTags = MetaTagsParser.parse(input).toList() + println(metaTags) + assertEquals(exp.size, metaTags.size) + metaTags.zip(exp).forEach { (meta, expAttrs) -> + expAttrs.forEach { (name, expValue) -> + assertEquals(expValue, meta.attr(name)) + } + } + } } diff --git a/commons/src/main/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParser.kt b/commons/src/main/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParser.kt index 4ecdcf149..d859c78ca 100644 --- a/commons/src/main/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParser.kt +++ b/commons/src/main/java/com/vitorpamplona/amethyst/commons/preview/MetaTagsParser.kt @@ -248,7 +248,14 @@ object MetaTagsParser { } c.isWhitespace() -> {} - else -> return null + + else -> { + // if it is expecting = but gets another name, starts another property + runCatching { attrs.add(Pair(input.slice(nameBegin..