pandoc-placetable: Pandoc filter to include CSV files

[ program, text ] [ Propose Tags ]

A Pandoc filter that replaces code blocks (that have the class table) with tables generated from CSV. The CSV is read from the code block and from an optional external CSV file and concatenated. There's a flag to enable parsing of inline markdown.


[Skip to Readme]

Flags

Automatic Flags
NameDescriptionDefault
inlinemarkdown

require entire Pandoc as a dependency and use it to compile inline markdown in the CSV and caption

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.2, 0.3, 0.4, 0.4.1, 0.4.2, 0.5, 0.5.1, 0.6
Dependencies base (>=4.2 && <5), explicit-exception (>=0.1 && <0.2), pandoc (>=1.14.0.0), pandoc-types (>=1.12.0.0), spreadsheet (>=0.1.3 && <0.1.4) [details]
License LicenseRef-GPL
Copyright (c) 2015 Mauro Bieg
Author Mauro Bieg
Maintainer Mauro Bieg
Category Text
Home page https://github.com/mb21/pandoc-placetable
Bug tracker https://github.com/mb21/pandoc-placetable/issues
Source repo head: git clone git://github.com/mb21/pandoc-placetable.git
Uploaded by mb21 at 2015-07-12T16:55:16Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables pandoc-placetable
Downloads 6740 total (33 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Last success reported on 2016-12-08 [all 6 reports]

Readme for pandoc-placetable-0.1.0

[back to package description]

Pandoc-placetable Filter

A Pandoc filter that replaces code blocks (that have the class table) with tables generated from CSV. The CSV is read from the code block and from an optional external CSV file and concatenated. There's a flag to enable parsing of inline markdown.

Some usage examples:

```{.table file="foo.csv"}
```

```{.table}
some,values
even,"with spaces"
"with the inlineMarkdown flag enabled","we _can_ write **Markdown** here"
```

```{.table file="foo.csv" header=yes}
Fruit,Quantity,Price
```

```{.table file="foo.csv" header=yes aligns=LRCRR caption="my caption" delimiter="," quotechar="\"" }
```

All attributes are optional and are specified as follows:

  • file: The path to the CSV file that is appended to the code block's content
  • header: If set to yes, then the first row of data is interpreted as the table headers.
  • aligns: For each column, one letter (L, R or C) that specifies the column's alignment.
  • caption: The table caption.
  • delimiter: A one-character string used in the CSV to separate fields, defaults to ,. For characters not allowed standing alone in Pandoc markdown attributes, use \t for a tab and \s for a space.
  • quotechar: A one-character string that may be used in the CSV to quote fields containing special characters, defaults to ".

When compiled with the inlineMarkdown flag, the CSV and the caption may contain markdown that will be interpreted. The CSV may even contain multiline markdown in a cell (the field need to be quoted, of course). Note that the flag causes Pandoc to be required as a dependency so it will take a while to build.

Installation

cabal update
cabal install pandoc-placetable

or with the inlineMarkdown flag (see above):

cabal install -f inlineMarkdown pandoc-placetable

Usage

Prepare a markdown file containing a fenced code block like the ones above, then:

pandoc --filter pandoc-placetable input.md