From: John MACFARLANE <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Markdown syntax can't handle BibLaTeX formatting
Date: Thu, 2 Nov 2017 15:19:45 -0700 [thread overview]
Message-ID: <20171102221945.GE27752@protagoras> (raw)
In-Reply-To: <87k1z84bpy.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
Nice! I hadn't even thought of having the lua filter
do the whole job.
+++ Albert Krewinkel [Nov 02 17 22:22 ]:
>This is such a beautiful solution that I couldn't resist to code up a
>proof-of-concept. The path to the bibtex file must be stored in the
>*bibliography* yaml field:
>
> ```
> bibliography: path/to/bibliography.bib
> ...
>
>fix-bibkeys.lua:
>
> function references_from_bibfile (filename)
> local yaml = io.popen('pandoc-citeproc -y ' .. filename):read("*a")
> return pandoc.read(yaml).meta.references
> end
>
> function Meta(meta)
> local bibfile = meta.bibliography[1].text
> local references = references_from_bibfile(bibfile)
> -- modify keys, replace ???? with 0000
> for k, v in pairs(references) do
> references[k].id = v.id[1].text:gsub("%?%?%?%?", "0000")
> end
> meta.references = references
> return meta
> end
>
>Run with
>
> pandoc --lua-filter=fix-bibkeys.lua --filter=pandoc-citeproc …
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/20171102221945.GE27752%40protagoras.
For more options, visit https://groups.google.com/d/optout.
next prev parent reply other threads:[~2017-11-02 22:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 13:25 distantflag
[not found] ` <90e14ff2-6cec-4dfe-9236-0998cf317b6c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-11-01 16:40 ` John MACFARLANE
2017-11-01 20:40 ` Albert Krewinkel
[not found] ` <87tvyd4trv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2017-11-02 7:39 ` distantflag
[not found] ` <cfc702fb-7389-4b78-88c8-0ec235ffa481-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-11-02 7:53 ` Björn Ekström
[not found] ` <5fdd83a6-e681-42bf-91b5-1216e605f76b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-11-02 19:22 ` John MACFARLANE
2017-11-02 20:02 ` Albert Krewinkel
[not found] ` <87po904ffv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2017-11-02 20:22 ` John MACFARLANE
2017-11-02 21:22 ` Albert Krewinkel
[not found] ` <87k1z84bpy.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2017-11-02 22:19 ` John MACFARLANE [this message]
2017-11-03 9:37 ` Björn Ekström
[not found] ` <1de89ee9-9064-4020-8419-4bcf7755cf9b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-11-03 9:56 ` Björn Ekström
[not found] ` <219efc35-d812-4b40-addd-adaed55955d8-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-11-03 18:51 ` Albert Krewinkel
[not found] ` <87bmkj42mv.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2017-11-04 7:04 ` Björn Ekström
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=20171102221945.GE27752@protagoras \
--to=jgm-tvlzxgkolnx2fbvcvol8/a@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).