summaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/blog/md/CodeBlock.kt
blob: 4251001b17d6bb196effef22d19e7743f36c492a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package moe.nea.blog.md

import moe.nea.blog.util.indent
import java.io.PrintStream

data class CodeBlock(val language: String, val lines: List<String>) : MarkdownBlock {
    override fun debugFormat(indent: Int, printStream: PrintStream) {
        printStream.indent(indent)
        printStream.println("<code language=$language>")
        lines.forEach {
            printStream.indent(indent)
            printStream.println(it)
        }
        printStream.indent(indent)
        printStream.println("</code>")
    }
}