generated from rnentjes/kotlin-server-web-empty
Extend parser to support #. as an ordered list identifier, add alternative list type tests, and update version to 1.0.9.
This commit is contained in:
@@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "nl.astraeus"
|
group = "nl.astraeus"
|
||||||
version = "1.0.8"
|
version = "1.0.9"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -66,7 +66,7 @@ signing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mavenPublishing {
|
mavenPublishing {
|
||||||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
|
||||||
|
|
||||||
signAllPublications()
|
signAllPublications()
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,11 @@ fun markdown(text: String): List<MarkdownPart> {
|
|||||||
if (line.isBlank()) {
|
if (line.isBlank()) {
|
||||||
parseBuffer()
|
parseBuffer()
|
||||||
continue
|
continue
|
||||||
} else if (line.startsWith("${listIndex++}.") || line.startsWith("-.")) {
|
} else if (
|
||||||
|
line.startsWith("${listIndex++}.")
|
||||||
|
|| line.startsWith("-.")
|
||||||
|
|| line.startsWith("#.")
|
||||||
|
) {
|
||||||
buffer.append("\n")
|
buffer.append("\n")
|
||||||
buffer.append(line.substring(2))
|
buffer.append(line.substring(2))
|
||||||
} else {
|
} else {
|
||||||
@@ -124,7 +128,7 @@ fun markdown(text: String): List<MarkdownPart> {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
line.startsWith("1.") || line.startsWith("-.") -> {
|
line.startsWith("1.") || line.startsWith("-.") || line.startsWith("#.") -> {
|
||||||
parseBuffer()
|
parseBuffer()
|
||||||
type = MarkdownType.ORDERED_LIST
|
type = MarkdownType.ORDERED_LIST
|
||||||
listIndex = 2
|
listIndex = 2
|
||||||
|
|||||||
@@ -68,6 +68,24 @@ class ParseTest {
|
|||||||
printMarkdownParts(md)
|
printMarkdownParts(md)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testUnorderedListAlternative() {
|
||||||
|
val input = """
|
||||||
|
Dit is een text
|
||||||
|
|
||||||
|
* First
|
||||||
|
More text
|
||||||
|
* Second
|
||||||
|
More text
|
||||||
|
|
||||||
|
Another paragraph
|
||||||
|
""".trimIndent()
|
||||||
|
|
||||||
|
val md = markdown(input)
|
||||||
|
|
||||||
|
printMarkdownParts(md)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testOrderedList() {
|
fun testOrderedList() {
|
||||||
val input = """
|
val input = """
|
||||||
@@ -86,6 +104,24 @@ class ParseTest {
|
|||||||
printMarkdownParts(md)
|
printMarkdownParts(md)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testOrderedListAlternative() {
|
||||||
|
val input = """
|
||||||
|
Dit is een text
|
||||||
|
|
||||||
|
#.First
|
||||||
|
More text
|
||||||
|
#.Second
|
||||||
|
More text
|
||||||
|
|
||||||
|
Another paragraph
|
||||||
|
""".trimIndent()
|
||||||
|
|
||||||
|
val md = markdown(input)
|
||||||
|
|
||||||
|
printMarkdownParts(md)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testCheckboxList() {
|
fun testCheckboxList() {
|
||||||
val input = """
|
val input = """
|
||||||
|
|||||||
Reference in New Issue
Block a user