Skip to content

Commit

Permalink
test(Issue285Test.kt): test parse multiline html comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Mar 19, 2023
1 parent b755fdf commit 2825387
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.bsc.makdown.commonmark

import org.bsc.confluence.model.Site
import org.bsc.markdown.commonmark.CommonmarkConfluenceWikiVisitor.parseHTMLComment
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import java.nio.file.Paths

class Issue285Test {

var site = Site().apply {
basedir = Paths.get(System.getProperty("user.dir"))
}

@Test
fun `parse excerpt macros`() {

val excerptMacro = """
<!-- {excerpt:title=MyExcerpt}
This is the content that I want to use as my excerpt.
{excerpt} -->
""".trimIndent()

val multiLineMatcher = parseHTMLComment(excerptMacro)

assertTrue( multiLineMatcher.matches() )
assertEquals( 2, multiLineMatcher.groupCount() )
assertEquals( """
{excerpt:title=MyExcerpt}
This is the content that I want to use as my excerpt.
{excerpt}
""".trimIndent(), multiLineMatcher.group(2).trimEnd() )

}

}

0 comments on commit 2825387

Please sign in to comment.