summaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt')
-rw-r--r--src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt b/src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt
index cb9d81f..7938cbe 100644
--- a/src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt
+++ b/src/main/kotlin/moe/nea/blog/md/LinePreProcessor.kt
@@ -1,5 +1,13 @@
package moe.nea.blog.md
-interface LinePreProcessor {
+fun interface LinePreProcessor {
fun preprocess(lineIndex: Int, line: String): String?
+
+ companion object {
+ fun whileIgnoringFirst(indent: Int, wrapped: LinePreProcessor): LinePreProcessor {
+ return LinePreProcessor { lineIndex, line ->
+ line.take(indent) + wrapped.preprocess(lineIndex, line.drop(indent))
+ }
+ }
+ }
}