Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend metadata capabilities #83

Closed
jgm opened this issue Jun 10, 2011 · 5 comments
Closed

Extend metadata capabilities #83

jgm opened this issue Jun 10, 2011 · 5 comments
Assignees

Comments

@jgm
Copy link
Owner

jgm commented Jun 10, 2011

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



Google Code Info:
Issue #: 288
Author: Kjell.Wo...@gmail.com
Created On: 2011-02-16T22:49:11.000Z
Closed On: 
@ghost ghost assigned jgm Jun 10, 2011
@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

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.

Google Code Info:
Author: fiddloso...@gmail.com
Created On: 2011-02-17T16:21:46.000Z

@gwern
Copy link
Contributor

gwern commented Sep 24, 2011

Could we simply have Pandoc use Gitit/Hakyll's metadata? As it is, it's more than a little annoying to work on a file, use Pandoc to preview it, and see half the file broken because of the metadata header not being understood by Pandoc. (It's not like there is no obvious mapping for the metadata to HTML - for example 'description:' maps to the tag for name="description".)

@etc
Copy link

etc commented Sep 24, 2011

A more simple amendment, for the time being, would be to enable Pandoc to simply ignore that metadata, until a uniform way of addressing metadata is agreed upon.

@jgm
Copy link
Owner Author

jgm commented Sep 25, 2011

There are lots of issues to consider in adding a metadata format, and I don't want to do it until I'm sure I've got it right. There have been some discussions recently in the markdown-discuss list towards arriving at agreement on a metadata format, but with little progress. In the mean time, you'll have to make do with some scripting.

(By the way, it occurred to me that one nice solution would be to put all specialized metadata inside HTML comments, so that regular markdown processors would ignore them anyway. That wouldn't help you, though, since that's not how gitit and hakyll do it.)

@paul-r-ml
Copy link

Hi John,

what's up with metadata ? I often need them when I use pandoc as a librairie. Your first proposal was appealing in my opinion. If backward compatibility is an issue, maybe a dedicated switch should be added to the readers options.

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants