File: record_reader_markdown.go

package info (click to toggle)
miller 6.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 87,928 kB
  • sloc: ruby: 162; sh: 119; makefile: 87
file content (30 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (2)
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

}