From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/18523 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Bj=C3=B6rn_Ekstr=C3=B6m?= Newsgroups: gmane.text.pandoc Subject: Re: Markdown syntax can't handle BibLaTeX formatting Date: Fri, 3 Nov 2017 02:56:28 -0700 (PDT) Message-ID: <219efc35-d812-4b40-addd-adaed55955d8@googlegroups.com> References: <90e14ff2-6cec-4dfe-9236-0998cf317b6c@googlegroups.com> <87tvyd4trv.fsf@zeitkraut.de> <87po904ffv.fsf@zeitkraut.de> <20171102202200.GB25469@protagoras> <87k1z84bpy.fsf@zeitkraut.de> <20171102221945.GE27752@protagoras> <1de89ee9-9064-4020-8419-4bcf7755cf9b@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2449_129338406.1509702988676" X-Trace: blaine.gmane.org 1509702991 30159 195.159.176.226 (3 Nov 2017 09:56:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 3 Nov 2017 09:56:31 +0000 (UTC) To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCR4PQ5D3UPRBTP26DHQKGQELTW7XOY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri Nov 03 10:56:26 2017 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane.org Original-Received: from mail-oi0-f57.google.com ([209.85.218.57]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAYi7-0007Gc-1O for gtp-pandoc-discuss@m.gmane.org; Fri, 03 Nov 2017 10:56:23 +0100 Original-Received: by mail-oi0-f57.google.com with SMTP id b189sf2262162oia.10 for ; Fri, 03 Nov 2017 02:56:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=q9Mhh0sRAcIAiBboc1CIYQHMQL+jRxBslk7auzwIJSg=; b=cLWHZcAEatsJCyP88BMg9otCP5ZD3EUJp6ANwbM7a/GPwDSYg4k4kHW988fxbKDixG fREaHdnpaezcYwXA+EK4MWrvcGT3pMFnuRrb54ZBYBJrUq3LQBe/kTaGlg+AYyVhkDL0 Tri/iPDnveJu8cc7TYMVVla/IaPzn3+bQA4uPtdXzVZYCqJygDtDzOmlyTUVjFPq12HD J/gbGA7UOrv8ePG0YDie5OeVP9UIMcLvJygkq4GF2BSajDCDg8vVuvZDqX8lMM3drXFL 3IfD1gifpVwWsLIC5ThCFLF63xrdTp1lIdvWhoqJx/5vry6/D9QTDD4OEcGz8JdmH2ug 8FqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=q9Mhh0sRAcIAiBboc1CIYQHMQL+jRxBslk7auzwIJSg=; b=hZ2+H/zz4EGsxnjIxIsC61rTF94+wjZRl+ROL89jyrQnajAAFQfeI8tabaAXQNPmz3 aNz8h0oaL8uldR0N9d4CjqvwAgRhLSdNmfGgwVJRJ7XD+YwC7ksW04wnnA3wJOCSYiY3 e/CNR++r1UUpVz+hdjX9wkAUGX8te47iXcoHlsMAMszgecAEsARLK0lK+ittEP2pgAmJ p9XKfOjGBsNVRzB1cf/firEREkeTXQHL1fyEL7RXR+U5oKPlUdcXlgtaHmcovErm+Esm /jBHaepqGEFbfNYa8tjEA/S3UAHl7UZ+BKgcLQKOL4EgxNr/TpSMHRk4HF2uQNXnmhk6 Fw0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=q9Mhh0sRAcIAiBboc1CIYQHMQL+jRxBslk7auzwIJSg=; b=ZnHyYiSp1eqrXYIfiIlDzTMDui0IzpRw++ah+qioXwX7JFtuzDTkiaRBKkJR4HTeYo V/UK4Ti90MWeUR8oAD/iOEl7j1RMOnGU48Tc7L3jpQCX4/vB7xo+lYRzTE67oUw5/cDl rRk+eEULnlUYCxLV3YkTl5yJSYnxk7B5p+fIIcJfch4oNwkRRdhxjwHiqM6CLQhR1EM3 Uez8xo2kWf/ab56aanPdUQpcQD356FkJTED+WGIvJPCS97lWDJNin3xJBmCVVaQKn7GM VQ6WjuBO/ZykbmgVSPbeXihuS4VDaiZckhrhxw1M+tM/KWeVSc2zRiHKFFIWWSaVDzVA STfw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJaThX5qGmRsS4Igsi+Eo+AvPnhWXKMt5UZXgKBaDpJp1FI0Kcxu/EQ/ iK8eectObk6HwpwVzSC2mzQ= X-Google-Smtp-Source: ABhQp+TjUylsIEJdlRkRQq7JAx52A4Yh2wSenJdAkbF4mpNu0X3ijpqkRWuWveaDx3R0N2Sf9zo9tQ== X-Received: by 10.157.68.130 with SMTP id v2mr187581ote.9.1509702990314; Fri, 03 Nov 2017 02:56:30 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 10.202.252.20 with SMTP id a20ls1491010oii.16.gmail; Fri, 03 Nov 2017 02:56:29 -0700 (PDT) X-Received: by 10.157.12.211 with SMTP id o19mr187529otd.0.1509702989224; Fri, 03 Nov 2017 02:56:29 -0700 (PDT) In-Reply-To: <1de89ee9-9064-4020-8419-4bcf7755cf9b-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: eksbjo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.org gmane.text.pandoc:18523 Archived-At: ------=_Part_2449_129338406.1509702988676 Content-Type: multipart/alternative; boundary="----=_Part_2450_936532133.1509702988676" ------=_Part_2450_936532133.1509702988676 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Never mind, I installed the latest pandoc and got it to work. So thanks for all your help. Now I just need to figure out how to another= =20 filter which removes the colon in this bibkey title [@organization_endreport:_2016] since the colon (which is part of the title) creates a syntax error with=20 the following underscore. Den fredag 3 november 2017 kl. 10:37:42 UTC+1 skrev Bj=C3=B6rn Ekstr=C3=B6m= : > > Hm, okay. Thanks. Although, both --lua-script and -lua-filter=3D gives > > pandoc.exe: unrecognized option `--lua-[...]' > > > Den torsdag 2 november 2017 kl. 23:19:29 UTC+1 skrev John MacFarlane: >> >> Nice! I hadn't even thought of having the lua filter=20 >> do the whole job.=20 >> >> +++ Albert Krewinkel [Nov 02 17 22:22 ]:=20 >> >This is such a beautiful solution that I couldn't resist to code up a= =20 >> >proof-of-concept. The path to the bibtex file must be stored in the=20 >> >*bibliography* yaml field:=20 >> >=20 >> > ```=20 >> > bibliography: path/to/bibliography.bib=20 >> > ...=20 >> >=20 >> >fix-bibkeys.lua:=20 >> >=20 >> > function references_from_bibfile (filename)=20 >> > local yaml =3D io.popen('pandoc-citeproc -y ' ..=20 >> filename):read("*a")=20 >> > return pandoc.read(yaml).meta.references=20 >> > end=20 >> >=20 >> > function Meta(meta)=20 >> > local bibfile =3D meta.bibliography[1].text=20 >> > local references =3D references_from_bibfile(bibfile)=20 >> > -- modify keys, replace ???? with 0000=20 >> > for k, v in pairs(references) do=20 >> > references[k].id =3D v.id[1].text:gsub("%?%?%?%?", "0000")=20 >> > end=20 >> > meta.references =3D references=20 >> > return meta=20 >> > end=20 >> >=20 >> >Run with=20 >> >=20 >> > pandoc --lua-filter=3Dfix-bibkeys.lua --filter=3Dpandoc-citeproc = =E2=80=A6=20 >> > --=20 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 e= mail 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/219efc35-d812-4b40-addd-adaed55955d8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout. ------=_Part_2450_936532133.1509702988676 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Never mind, I installed the latest pandoc and got it to wo= rk.

So thanks for all your help. Now I just need to figu= re out how to another filter which removes the colon in this bibkey title

[@organization_endreport:_2016]
<= br>
since the colon (which is part of the title) creates a syntax= error with the following underscore.

Den fredag 3 november 2= 017 kl. 10:37:42 UTC+1 skrev Bj=C3=B6rn Ekstr=C3=B6m:
Hm, okay. Thanks. Although, both --= lua-script and -lua-filter=3D gives

pandoc.exe: unrecognized option= `--lua-[...]'

Den torsdag 2 november 2= 017 kl. 23:19:29 UTC+1 skrev John MacFarlane:
Nice! =C2=A0I 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 cod= e up a
>proof-of-concept. =C2=A0The path to the bibtex file must be stored = in the
>*bibliography* yaml field:
>
> =C2=A0 =C2=A0```
> =C2=A0 =C2=A0bibliography: path/to/bibliography.bib
> =C2=A0 =C2=A0...
>
>fix-bibkeys.lua:
>
> =C2=A0 =C2=A0function references_from_bibfile (filename)
> =C2=A0 =C2=A0 =C2=A0local yaml =3D io.popen('pandoc-citeproc -= y ' .. filename):read("*a")
> =C2=A0 =C2=A0 =C2=A0return pandoc.read(yaml).meta.references
> =C2=A0 =C2=A0end
>
> =C2=A0 =C2=A0function Meta(meta)
> =C2=A0 =C2=A0 =C2=A0local bibfile =3D meta.bibliography[1].text
> =C2=A0 =C2=A0 =C2=A0local references =3D references_from_bibfile(<= wbr>bibfile)
> =C2=A0 =C2=A0 =C2=A0-- modify keys, replace ???? with 0000
> =C2=A0 =C2=A0 =C2=A0for k, v in pairs(references) do
> =C2=A0 =C2=A0 =C2=A0 =C2=A0references[k].id =3D = v.id[1].text:gsub("%?%?%?%?", "0000")
> =C2=A0 =C2=A0 =C2=A0end
> =C2=A0 =C2=A0 =C2=A0meta.references =3D references
> =C2=A0 =C2=A0 =C2=A0return meta
> =C2=A0 end
>
>Run with
>
> =C2=A0 =C2=A0pandoc --lua-filter=3Dfix-bibkeys.lua --filter=3Dpand= oc-citeproc =E2=80=A6

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/219efc35-d812-4b40-addd-adaed55955d8%40googlegroups.co= m.
For more options, visit http= s://groups.google.com/d/optout.
------=_Part_2450_936532133.1509702988676-- ------=_Part_2449_129338406.1509702988676--