Skip to content

Commit

Permalink
v.0.0.10
Browse files Browse the repository at this point in the history
- Technical version
  • Loading branch information
belyaev-mikhail committed Jun 17, 2020
1 parent aa62245 commit 04f253c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

<groupId>ru.spbstu</groupId>
<artifactId>kotlin-pandoc</artifactId>
<version>0.0.10-SNAPSHOT</version>
<version>0.0.11-SNAPSHOT</version>
<scm>
<url>https://github.com/belyaev-mikhail/kotlin-pandoc</url>
<connection>scm:git:[email protected]:belyaev-mikhail/kotlin-pandoc.git</connection>
<developerConnection>scm:git:[email protected]:belyaev-mikhail/kotlin-pandoc.git</developerConnection>
</scm>

<properties>
<kotlin.version>1.3.61</kotlin.version>
<kotlin.version>1.3.72</kotlin.version>
<jackson.version>2.10.2</jackson.version>
</properties>

Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/ru/spbstu/pandoc/builder/BlockBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ sealed class BlockBuilderBase {
private val list: MutableList<Block> = mutableListOf()
fun build(): List<Block> = list

operator fun Block.unaryPlus() { list.add(this) }
operator fun Iterable<Block>.unaryPlus() { list.addAll(this) }
operator fun Sequence<Block>.unaryPlus() { list.addAll(this) }

fun plain(body: InlineBuilder.() -> Unit) {
list += Block.Plain(inlines(body))
}
Expand Down Expand Up @@ -90,3 +94,5 @@ fun blocks(body: BlockBuilder.() -> Unit): List<Block> {
builder.body()
return builder.build()
}

fun block(body: BlockBuilder.() -> Unit): Block = blocks(body).single()
5 changes: 5 additions & 0 deletions src/main/kotlin/ru/spbstu/pandoc/builder/InlineBuilder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ sealed class InlineBuilderBase {
operator fun String.unaryPlus() {
list += Inline.Str(this)
}
operator fun Inline.unaryPlus() { list.add(this) }
operator fun Iterable<Inline>.unaryPlus() { list.addAll(this) }
operator fun Sequence<Inline>.unaryPlus() { list.addAll(this) }

fun str(text: () -> String) {
list += Inline.Str(text())
Expand Down Expand Up @@ -89,3 +92,5 @@ fun inlines(body: InlineBuilder.() -> Unit): List<Inline> {
builder.body()
return builder.build()
}

fun inline(body: InlineBuilder.() -> Unit): Inline = inlines(body).single()

0 comments on commit 04f253c

Please sign in to comment.