Direct specification of data parser’s parameters
-P, --parser-parameter: Defines the parser’s parameters (or configuraion) to use when using the parser. Accepted values have the formfile extensionfollowed by@followed by theparameter nameand then:to end with theparameter value. This option is always optional and is only supported for a few specific parsers and with a predefined set of parameters for each of them.
didot -t template.hbs -s data.tsv -X tsv:csv -P tsv@delimiter:Semicolumn;tsv@commentChar:#
In this example:
template.hbsis the Handlebars template file.data.txtis the source file.tsv:csvassociates the extension.tsvto the CSV parsertsv@delimiter:Semicolumn;tsv@commentChar:#defines two parameters for the configuration of parser associated to.tsvfile’s extension. The first one defines the parameterdelimiterto a semicolumn (;) and the second one set the parametercommentCharto a hash (#).
Parameters for CSV parsers
The following parameters are accepted by Didot to define the behavior of a CSV parser:
delimiter: Specifies the delimiter between fields.lineTerminator: Specifies the delimiter between records.quoteChar: Character used to quote fields.doubleQuote: Whether double quotes are used to escape quotes within quoted fields.escapeChar: Character used for escaping.header: Indicates if the first row contains headers.headerRows: Indexes of rows to consider like headers.headerJoin: concatenor between two headers from different rows.skipInitialSpace: Whether spaces after delimiters are skipped.commentChar: Character used to denote comments.commentRows: Indexes of rows to consider like comments
More information about these parameters can found in the documentation of PocketCsvReader
Synonyms for parameter values
To avoid conflicts with other parts of the command line, Didot supports the following synonyms for parameter values:
delimiter
Comma=,Semicolon=;Tab=\tPipe=|
lineTerminator
CarriageReturnLineFeed=\r\nLineFeed=\nCarriageReturn=\r
quoteChar
DoubleQuote="SingleQuote='
escapeChar
BackSlash=\ForwardSlash=/
commentChar
Hash=#Semicolon=;ForwardSlash=/Dash=-