From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/24731 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Andrzej Wodecki Newsgroups: gmane.text.pandoc Subject: Re: generate bibliography from citations keys in docx? Date: Wed, 25 Mar 2020 10:09:54 -0700 (PDT) Message-ID: References: <4d035407-d692-4ada-ac1a-b2668c8c80bc@googlegroups.com> <30f53079-9e7a-2046-f458-b23f9736ac48@reagle.org> <7e7dfd7e-1bf1-4557-a5f0-e686d48e2438@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2897_1021304741.1585156195024" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="83987"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBCAJTAHOV4CRBZFA53ZQKGQEQDPM2TY-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Mar 25 18:09:59 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f64.google.com ([209.85.210.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jH9XT-000Lfo-Fn for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 25 Mar 2020 18:09:59 +0100 Original-Received: by mail-ot1-f64.google.com with SMTP id a21sf2142044oto.15 for ; Wed, 25 Mar 2020 10:09:59 -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=R3zipgXus6h2E+gQXCudiW8oEtV0mlMaq5rbB8irDy0=; b=L/x/MoyxvEbD3DVMT7/0HsH1JCAwe2LUymtO1BXPYVVDugL3yEKRRf/gpXExDsRJVw OM6ndTIf16fCc2yWdORP50NZJgn//XoUM10Bs90dHe44eSOmR9/AbMP3xnMOgdfDfzVI VAqbnfnm/0MClJ6Gl9ACeRpo8eVHMq5obfvkhE3+UT5eLMFtRBAvKVc8vmTS4wYrT6g9 mpQ9m+cvooiubHYKwQQTTLLBlVPejmOM8VYkNz95ISuZLShR7MhG+KkidlMK4TnPAIxF OajBJVlr7xDKSbBxzETxPO4tSy3xGw0aqE46YbHSV3ayPJDDjW/dn8UfETK/SB4LEcFe kw3w== 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=R3zipgXus6h2E+gQXCudiW8oEtV0mlMaq5rbB8irDy0=; b=PIQSWr+osczAia7cJyXc3CuxXUXR8tjs4pnfZHv+BO9veMffp/fXq3tDpGMZtm3/tl dvo2MUPdblcZNda9ZT2o3pA33HYE+1Lfb4X6aIYNp8M7YpYmFABtWrlR9S6dhLtPBCrv qqDw6owrAsQ4ajWRi3h1WI2yiVzWud/A/8iykJYK78lN1reF539diLJbGNxMaUiPy7cP fyitkN3EikIlW7FHhK9uoeZxqr9ZiN/caOA4lAUHw9q0Zzs8cB+kAQZYj8s2H6cbaSO/ JUTwvwuHPnStBWELLZyMQrDZDb2Ps+ei6+ECu2SlLTNf5JgZvXLjctE7vM5i9hbhIy5h ulzg== 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=R3zipgXus6h2E+gQXCudiW8oEtV0mlMaq5rbB8irDy0=; b=ahOLHrawYlfan1unacT00cOfItKvHJFUGET05RKvoqpnNCfjsJ4wCfRU/aup/vHi2H BCj2QJ/uE8YJHq5XztALSAC0WjNQC2pvdYA4IsdIzL3t3HqJjCPDctw479y4MoCwDlS/ VMs4CJqohwRSpCuz8xdwvJBqb0YhC4lGfiVH2ADNMty8a/hNIEhU/1CanohebVeSzOkT jnbH6yR7SFvBQjhhqE/Kvd72flHfWRmJx5qfxMr+E9Ag+bXhIX/0DZe75AOAf9Ym5zdb d4TIDQv8E03fXB5VWA50UPaB14DBQDcvduwrumzEDGCrdUsqQ/dLcjL3QdzP+tpJxpWD HVqA== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANhLgQ0cPHXSz0RLPKT9JLKW+73iqCyvaE5wzIP3BboAAAyvtAIBCrOc MW/7UYaBeSZQsfCrZn6Bfkc= X-Google-Smtp-Source: ADFU+vvdls1snPdcAoZBJPddt7bo7l1XJFb5y3qBaHo3T4iLWx95XtrIiDkTIT4ebjDcEIJun3fwpA== X-Received: by 2002:a4a:240f:: with SMTP id m15mr2054779oof.85.1585156198375; Wed, 25 Mar 2020 10:09:58 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:aca:474a:: with SMTP id u71ls771475oia.0.gmail; Wed, 25 Mar 2020 10:09:55 -0700 (PDT) X-Received: by 2002:aca:a857:: with SMTP id r84mr3232968oie.65.1585156195625; Wed, 25 Mar 2020 10:09:55 -0700 (PDT) In-Reply-To: X-Original-Sender: andrzej.wodecki-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.io gmane.text.pandoc:24731 Archived-At: ------=_Part_2897_1021304741.1585156195024 Content-Type: multipart/alternative; boundary="----=_Part_2898_1174433926.1585156195024" ------=_Part_2898_1174433926.1585156195024 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable DearJohn,=20 many thanks. I've tried, and with: pandoc in.docx --filter pandoc-citeproc --bibliography mylibrary.bib -t=20 native I get [Para [Str "From",Space,Str "[@andy2020]",Space,Str ... as you suggested. I've looked at: https://pandoc.org/lua-filters.html and successfully run the first example "smallcaps.lua". But here I'm stuck:= =20 I don't know how to write the filter for=20 Str "[@ > Cite "[ replacement. If its not a problem, I would appreciate any tip/help, or just a snippet, many thanks in advance,=20 Andy W dniu =C5=9Broda, 25 marca 2020 17:36:06 UTC+1 u=C5=BCytkownik John MacFar= lane=20 napisa=C5=82: > > > You could use a lua filter.=20 > > If you do `pandoc your.docx -t native` you'll see how pandoc=20 > parses these faux markdown citations.=20 > > If they appear as=20 > > Str "[@jones]"=20 > > then you could use a filter to replace any Str elements=20 > fitting this pattern with a Cite element. I can't explain=20 > the whole thing here -- if you want to pursue this, see=20 > the lua filter docs on the website.=20 > > Andrzej Wodecki > writes:=20 > > > The reason I have citation keys in MS Word is a consequence of my=20 > original=20 > > workflow:=20 > > Scrivener > markdown > pandoc-citeproc > MS Word, BTW described here:= =20 > >=20 > https://medium.com/@andrzej.wodecki/scrivener-for-scientific-writing-setu= p-af5edf4482b8=20 > >=20 > > But at the final stage of my writings I escaped from Scrivener (export= =20 > to=20 > > MS Word), with only citation keys left in my doc.=20 > > If only I start from scratch in MS Word that wouldn't be a problem,=20 > but...=20 > >=20 > > My temporary workaround (very primitive, but works) is:=20 > > 1. docx > pandoc > markdown=20 > > 2. markdown: replace all \@ by @=20 > > 3. markdown > pandoc-citeproc > docx=20 > >=20 > > Anyway, if you have any ideas for anything smarter would be nice to hea= r=20 > :)=20 > >=20 > > Yours,=20 > >=20 > > Andy=20 > >=20 > >=20 > > W dniu =C5=9Broda, 25 marca 2020 14:11:06 UTC+1 u=C5=BCytkownik Joseph = napisa=C5=82:=20 > >>=20 > >>=20 > >> On 3/25/20 8:01 AM, Andrzej Wodecki wrote:=20 > >> > Second trial =20 > >> > with in.docx:=20 > >>=20 > >> Pandoc doesn't expect to find markdown (including pandoc's citation=20 > >> syntax) in a Word file. That only works in markdown files (and perhaps= =20 > org=20 > >> files). So when it sees a citation in word->markdown, it takes it=20 > >> literally, and escapes the brackets so it remains so in the markdown.= =20 > >>=20 > >> Perhaps someone else can recommend a configuration that won't escape= =20 > >> citation syntax, allowing you to go to markdown, and then from that=20 > back to=20 > >> Word.=20 > >>=20 > >> This seems convoluted though. If you're using Zotero, why not use the= =20 > Word=20 > >> plugin for that? Or, why not stay in markdown as your source document?= =20 > >>=20 > >>=20 > >=20 > > --=20 > > You received this message because you are subscribed to the Google=20 > Groups "pandoc-discuss" group.=20 > > To unsubscribe from this group and stop receiving emails from it, send= =20 > an email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org .=20 > > To view this discussion on the web visit=20 > https://groups.google.com/d/msgid/pandoc-discuss/7e7dfd7e-1bf1-4557-a5f0-= e686d48e2438%40googlegroups.com.=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 view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/db7c031a-9b53-42e5-b073-f70fa0c16de1%40googlegroups.com. ------=_Part_2898_1174433926.1585156195024 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
DearJohn,=C2=A0

many thanks. I've t= ried, and with:

pandoc in.docx --filter pandoc-citeproc --bi= bliography mylibrary.bib -t native


I get

[Para [Str "From",Space,Str "[@andy2020= ]",Space,Str=C2=A0...


as you suggested. I've looked at:=C2= =A0https://pandoc.org/lua-f= ilters.html
and successfully run the first example "smal= lcaps.lua". But here I'm stuck: I don't know how to write the = filter for=C2=A0
Str "[@ > Cite "[
replace= ment.

If its not a problem, I would appreciate any= tip/help, or just a snippet,

many thanks in advan= ce,=C2=A0

Andy


W dniu= =C5=9Broda, 25 marca 2020 17:36:06 UTC+1 u=C5=BCytkownik John MacFarlane n= apisa=C5=82:

You could use a lua filter.

If you do `pandoc your.docx -t native` you'll see how pandoc
parses these faux markdown citations.

If they appear as

Str "[@jones]"

then you could use a filter to replace any Str elements
fitting this pattern with a Cite element. =C2=A0I can't explain
the whole thing here -- if you want to pursue this, see
the lua filter docs on the website.

Andrzej Wodecki <andrzej...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> The reason I have citation keys in MS Word is a consequence of my = original=20
> workflow:
> Scrivener > markdown > pandoc-citeproc > MS Word, BTW des= cribed here:=20
> https://medium.com/@andrzej.wodecki/scrivener-for-scientific-writing-setup-af5edf4482b8
>
> But at the final stage of my writings I escaped from Scrivener (ex= port to=20
> MS Word), with only citation keys left in my doc.
> If only I start from scratch in MS Word that wouldn't be a pro= blem, but...
>
> My temporary workaround (very primitive, but works) is:
> 1. docx > pandoc > markdown
> 2. markdown: replace all \@ by @
> 3. markdown > pandoc-citeproc > docx
>
> Anyway, if you have any ideas for anything smarter would be nice t= o hear :)
>
> Yours,=20
>
> Andy
>
>
> W dniu =C5=9Broda, 25 marca 2020 14:11:06 UTC+1 u=C5=BCytkownik Jo= seph napisa=C5=82:
>>
>>
>> On 3/25/20 8:01 AM, Andrzej Wodecki wrote:=20
>> > Second trial =C2=A0=20
>> > with in.docx:=20
>>
>> Pandoc doesn't expect to find markdown (including pandoc&#= 39;s citation=20
>> syntax) in a Word file. That only works in markdown files (and= perhaps org=20
>> files). So when it sees a citation in word->markdown, it ta= kes it=20
>> literally, and escapes the brackets so it remains so in the ma= rkdown.=20
>>
>> Perhaps someone else can recommend a configuration that won= 9;t escape=20
>> citation syntax, allowing you to go to markdown, and then from= that back to=20
>> Word.=20
>>
>> This seems convoluted though. If you're using Zotero, why = not use the Word=20
>> plugin for that? Or, why not stay in markdown as your source d= ocument?=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 email to pandoc-...@googlegroups.com.
> To view this discussion on the web visit https://groups.= google.com/d/msgid/pandoc-discuss/7e7dfd7e-1bf1-4557-a5f0-e686d48= e2438%40googlegroups.com.

--
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 view this discussion on the web visit https://groups.google.com/d/= msgid/pandoc-discuss/db7c031a-9b53-42e5-b073-f70fa0c16de1%40googlegroups.co= m.
------=_Part_2898_1174433926.1585156195024-- ------=_Part_2897_1021304741.1585156195024--