1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package input
import (
"regexp"
"github.com/johnkerl/miller/v6/pkg/cli"
)
func NewRecordReaderMarkdown(
readerOptions *cli.TReaderOptions,
recordsPerBatch int64,
) (IRecordReader, error) {
readerOptions.IFS = "|"
readerOptions.AllowRepeatIFS = false
reader := &RecordReaderPprintBarredOrMarkdown{
readerOptions: readerOptions,
recordsPerBatch: recordsPerBatch,
separatorMatcher: regexp.MustCompile(`^\|[-\| ]+\|$`),
fieldSplitter: newFieldSplitter(readerOptions),
}
if reader.readerOptions.UseImplicitHeader {
reader.recordBatchGetter = getRecordBatchImplicitPprintHeader
} else {
reader.recordBatchGetter = getRecordBatchExplicitPprintHeader
}
return reader, nil
}
|