Coverage Summary for Class: RawContentParser (io.heapy.kotmark.ext.front.matter.parser)

Class Method, % Branch, % Line, % Instruction, %
RawContentParser 100% (3/3) 100% (5/5) 100% (28/28)
RawContentParser$Factory 100% (2/2) 100% (2/2) 100% (6/6)
Total 100% (5/5) 100% (7/7) 100% (34/34)


 package io.heapy.kotmark.ext.front.matter.parser
 
 import io.heapy.kotmark.ext.front.matter.YamlFrontMatterBlock
 import io.heapy.kotmark.ext.front.matter.YamlFrontMatterRawContent
 import io.heapy.kotmark.ext.front.matter.parser.FrontMatterParser.SeparatorRole
 import io.heapy.kotmark.parser.SourceLine
 
 /** Keeps YAML lines as text so that callers can parse them with a YAML library of their choice. */
 class RawContentParser : FrontMatterParser {
     private val content = StringBuilder()
 
     override fun onNextLine(block: YamlFrontMatterBlock, line: SourceLine) {
         content.append(line.content).append('\n')
     }
 
     override fun onEndingSeparator(block: YamlFrontMatterBlock, separator: SourceLine): SeparatorRole {
         block.appendChild(YamlFrontMatterRawContent(content.toString()))
         return SeparatorRole.BLOCK_END
     }
 
     class Factory : FrontMatterParser.Factory {
         override fun create(): FrontMatterParser = RawContentParser()
     }
 }