mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 18:25:45 +00:00
* Support markdown on input * unit-test files * doc mods * Unit-test cases for I/O-format keystroke-savers * -i/-o md as well as -i/-o markdown
30 lines
700 B
Go
30 lines
700 B
Go
package input
|
|
|
|
import (
|
|
"regexp"
|
|
|
|
"github.com/johnkerl/miller/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
|
|
|
|
}
|