khajavi / pandoc

Automatically exported from code.google.com/p/pandoc
GNU General Public License v2.0
0 stars 0 forks source link

Extend metadata capabilities #288

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I would like to propose a seemingly minor, but powerful enhancement to pandoc's 
metadata parser.

Right now, pandoc parses
% title text
% author text
% date text

at the start of the file, inserting the contents of these fields into the 
variables with the names: $title$, $author$, and $date$

I would like to propose the following metadata format:
% fieldname: contents
% fieldname2: contents2
...
% fieldnameN: contentsN

The idea being, the variable $fieldnameN$ will be set to "contentsN", as if the 
user had specified -V fieldnameN="contentsN"

If no colon-delimited fields are found, the old metadata format would be used. 
For ease of processing, I might assume that the metadata is at the start of the 
file only (with no blank lines).

This would also keep me from forgetting what order to put the metadata in, as I 
could simply state it explicitly:

% title: my document
% author: kj
% date: 20100216

Motivation: Right now, I am extracting the contents of my CMS into static 
markdown text, and I would like to preserve the existing metadata fields. There 
is not currently a mechanism to do so, except perhaps to include them in HTML 
comments, and postprocess using a scripting language

Original issue reported on code.google.com by Kjell.Wo...@gmail.com on 16 Feb 2011 at 10:49

GoogleCodeExporter commented 9 years ago
If you search the pandoc-discuss archives, you'll see quite a bit of fairly 
recent discussion of metadata extensions.  I'm sold on the general idea, but I 
want to get the details right, and there are a lot of considerations.

Original comment by fiddloso...@gmail.com on 17 Feb 2011 at 4:21