public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: John MacFarlane <fiddlosopher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: metadata changes merged
Date: Wed, 26 Jun 2013 09:15:05 -0700	[thread overview]
Message-ID: <20130626161505.GA88705@Johns-MacBook-Pro.local> (raw)

I've merged in the (very extensive) metadata changes discussed earlier.

If you are brave, you can try them.  But before you can 'cabal install'
the latest pandoc, you'll need to install the git version of
pandoc-types and then recompile citeproc-hs. This procedure should work:

    git clone git://github.com/jgm/pandoc.git pandoc
    cd pandoc
    git submodule update --init
    git clone git://github.com/jgm/pandoc-types.git pandoc-types
    cd pandoc-types
    cabal install
    cd ..
    darcs get http://gorgias.mine.nu/repos/citeproc-hs/
    cd citeproc-hs
    cabal install
    cd ..
    cabal install

The implemented system is a bit different than what I described before
(and not yet documented at all).  Markdown files can have a YAML
metadata block, but it must come at the very beginning of the file.
(Previously I'd considered allowing metadata anywhere in the file,
but I'm not sold on that -- external tools really wouldn't find metadata
that is not at the beginning of the file useful, because you'd have
to parse markdown to discover which sections were metadata.  I'm still
considering this issue.)

One nice thing about this new system is that you can, for example,
have a letter.latex template with fields like $to$, $salutation$,
$closing$.  Then a letter can begin with:

    ---
    to: |
      | Mr. John Smith
      | 25221 Lana Lane
      | Gotham, XY 23423
    salutation: Dear John,
    closing: Yours sincerely,
    ...

    (text of letter here)

And you can just do

    pandoc --template letter myletter.txt -o myletter.pdf

to get a nicely typeset letter.

Because the metadata values are structured, you can also do things
like this (though you'll need to adjust templates to support it):

    ---
    author:
    - name:  John Doe
      affiliation:  University of Western Tasmania
    - name:  Sarah Smith
      affiliation:  National Institute of Health
    ...

Your template can then contain something like this:

    $for(author)$
    $author.name$ ($author.affiliation$)
    $endfor$

I have not yet implemented the YAML blocks in the markdown writer,
but I plan to do that in time.

John


             reply	other threads:[~2013-06-26 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26 16:15 John MacFarlane [this message]
     [not found] ` <20130626161505.GA88705-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
2013-06-26 16:32   ` BP Jonsson
     [not found]     ` <51CB17AE.5090108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-06-26 17:16       ` John MacFarlane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130626161505.GA88705@Johns-MacBook-Pro.local \
    --to=fiddlosopher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).