public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* metadata changes merged
@ 2013-06-26 16:15 John MacFarlane
       [not found] ` <20130626161505.GA88705-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2013-06-26 16:15 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: metadata changes merged
       [not found] ` <20130626161505.GA88705-9Rnp8PDaXcadBw3G0RLmbRFnWt+6NQIA@public.gmane.org>
@ 2013-06-26 16:32   ` BP Jonsson
       [not found]     ` <51CB17AE.5090108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: BP Jonsson @ 2013-06-26 16:32 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

2013-06-26 18:15, John MacFarlane skrev:
> 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.)

I suppose you can still have the metadata in a separate file as
long as pandoc sees that file first?

     pandoc --template foo metadata.yaml bar.mkd -o bar.pdf

What about concatenating several source files which all have
YAML blocks at the beginning. Will pandoc ignore them, filter
them out or what?

> 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:

What about relative precedence of variables defined on the
command line and in-file?

/bpj


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: metadata changes merged
       [not found]     ` <51CB17AE.5090108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-06-26 17:16       ` John MacFarlane
  0 siblings, 0 replies; 3+ messages in thread
From: John MacFarlane @ 2013-06-26 17:16 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

+++ BP Jonsson [Jun 26 13 18:32 ]:
> 2013-06-26 18:15, John MacFarlane skrev:
> >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.)
> 
> I suppose you can still have the metadata in a separate file as
> long as pandoc sees that file first?
> 
>     pandoc --template foo metadata.yaml bar.mkd -o bar.pdf

Yes.

> What about concatenating several source files which all have
> YAML blocks at the beginning. Will pandoc ignore them, filter
> them out or what?

Currently pandoc would try to parse the YAML blocks inside
the file as text.

> >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:
> 
> What about relative precedence of variables defined on the
> command line and in-file?

Currently pandoc does a "merge."  So, if you have an "author"
defined in metadata, and you specify an additional "author"
variable on the command line, pandoc will behave as if you
had given a list of two authors.

I'm really not sure what the optimal behavior is here.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-26 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 16:15 metadata changes merged John MacFarlane
     [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

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).