From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/24732 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: John MacFarlane Newsgroups: gmane.text.pandoc Subject: Re: generate bibliography from citations keys in docx? Date: Wed, 25 Mar 2020 13:21:34 -0700 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: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="94866"; mail-complaints-to="usenet@ciao.gmane.io" To: Andrzej Wodecki , pandoc-discuss Original-X-From: pandoc-discuss+bncBCJZJHG45QDBBXH253ZQKGQE6JY6EOQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Mar 25 21:21:51 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-il1-f186.google.com ([209.85.166.186]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jHCX9-000OWo-7e for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 25 Mar 2020 21:21:51 +0100 Original-Received: by mail-il1-f186.google.com with SMTP id n18sf2559977ilp.13 for ; Wed, 25 Mar 2020 13:21:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1585167710; cv=pass; d=google.com; s=arc-20160816; b=MO9q0gLNwW7kjPyGNC5O4+cRhTXHMcPhqfz6iWvT1lUJWe2oshpgqMbtPV9Fk7bRRo R2KOKqs+4hhLb9yExi/HA8EqsdlJrdJszessd5tS09rxkEJlHmdGqXbw8creUddxovMy eJIrQ9pcZkidR8wgEebZ8i1e/sXHNtMJ5Z27vnW3IQGsbdpxgAF634Rwn7VKLzOr6f3V Uda42pabQl27CT69lHT5sFmgzVtXIuhyUavYmrzJ18kG5T8mXIimK2Q1OXZwA1IwW1OI g0fRtIOIR5kj4JYq1RJmdINKVt4Rrd2AWUZxQoEXGLsGaVC0uhX2g5nSGM5krfCldgsv VcCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:content-transfer-encoding :mime-version:message-id:date:references:in-reply-to:subject:to:from :sender:dkim-signature; bh=FslkgQJoO2KAYs3/UONSZx1/u9XlI+tfiHR2DWd6XyM=; b=BhN8GGO+w06Pq9dswAwHTnyOoTGL0Ln9CCsYdcc/zEDG4UeStFl/CHZ9B8DiErREXV lmro5+wbOrQyldgw1Jh19apTqduxJi0YGwwxGtDi+MhCwAPT0Mye/F74jAXz/uP+5r2i QW4RxyswCuE1G6S0rgi9xpJ6QSSa8UMruiJETLEa/tJ0o+0uYpyiikItMw/mWRVQJ4e6 LAFU91B+mEGbcjEelzSGVs6rkr5OTwnP7AVGe5HaLwB4T1NRAs9tEoftO0bNt0zJOK8Q XccS3niyxsAPIRulkuUD1AAMMAyEgBkSUsxf1GRFs0YlvDrJmSF1hOL7ojlfa1MH+L1E laxQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=xwmqIo3Q; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::429 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=FslkgQJoO2KAYs3/UONSZx1/u9XlI+tfiHR2DWd6XyM=; b=Owr4HTmY5o6uqDUGp4vAhNEItDjXR4JDZB3kROzC2H7dpTzzfSQOKaBYKI57cHlpuK WAPDUs+rVJCdVpYxFPczxSLZpuduXFkX+04OMZu1h6Y7XmH+9gI7Ta1WaQJQNZ6UYqgz 86zLcTl7AW5+NX9duQqIuuJNHfAPrXObScz2A6Nm3tgRhUuuWK+kL+9CmF3cBNrKWDEi +fpO0t100u7MEXqYk15qtNHx8Ls7Sr7M+dy8eKhc/Ez2eOINPff1+Y9HJIvt6hzR533l flh02bE5cTo3azIh/eggMTICAlxJVNeBXUVRZyjBhJeFGcpYbYUQ0fp+r97GTryyF2QU W/tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:subject:in-reply-to:references :date:message-id:mime-version:content-transfer-encoding :x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=FslkgQJoO2KAYs3/UONSZx1/u9XlI+tfiHR2DWd6XyM=; b=E/efGCuv/4o3AG5sFuUw1CROuBHf2JUZca8YetrT2DEC+mmSBQ/Nlp/+quh8ZvRlXH FVuET1mFM9kW5Ej2eJOMIhQKcmqvIqcBPyowFEf2ydRoZQpGPzWO9OPHZQyqHR4wKm3t 3OUkqHhIV3Gsl5Gg3BkMYyEHfYkzDXEPCcw7ODtPE7//d/5CYOvTfSVo0EFaLEvFEHXT VOOuBU3pzJ8oSktGhfzXN46Ula95Vn1WjfVHyEiNr0kOpwxXhzr2xWZwBvxLIYfrSVvF SrpMEC7UEVG33kNNrrWgoQJ466NPp8z6d482ta5S0NdDDkteLRrDVtKrie8Tfp7gu0bn Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ANhLgQ1gGAiX3iuYN4IhxIzENTDkaja98+qQBBhmac9p8EcMr4Gnfocc YeuwssvU0abFEtZdk5gUWY0= X-Google-Smtp-Source: ADFU+vtq3SCERWztXoIohlqTVTHg9dRhfa6RNiIUo4CWsnb1v0N0cWqL3en+jSPZ90NotvoGH/KKsg== X-Received: by 2002:a5e:8d19:: with SMTP id m25mr4633447ioj.118.1585167710294; Wed, 25 Mar 2020 13:21:50 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a92:3a9a:: with SMTP id i26ls931673ilf.3.gmail; Wed, 25 Mar 2020 13:21:47 -0700 (PDT) X-Received: by 2002:a92:3501:: with SMTP id c1mr5131384ila.91.1585167707424; Wed, 25 Mar 2020 13:21:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585167707; cv=none; d=google.com; s=arc-20160816; b=WQgX51cGP2daOdHL2S8L8iebi1woAWJptAlv1Xp8FfZQsQXWJ4Fto9i/laeQqpCzv8 JIxCK9mAMvSTmPQ8qdghnxH4PTYX6rw3EX1PfFVvOr6clrJCTYlfvdfdG75hezcjQuIl hh2ZuxqnMwhECxugI5n9kwUrgVcBy6bLCSlHAxxF1ekVdDd8sSWxQsZIXehb7rr7cm1x CcdZf2f7XztSe3Y2hOArrC/NuSJz1FR1pZfgMZk/dC+qHrQKWlfMS4WG/vbtXayLGQk4 4B9jTZ3C5d6E6zUna5bV0eYx/3y92vipECjsD5x39G0MWZRMuHA6Vf/yQmKz03JpwslA C8Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:to:from:dkim-signature; bh=aKfe+3k+jeQEJpgBYRfB9MQWI7aB+zrou4Q78DrM0nc=; b=KbTAv1JvafFbPojpp9FDeoJDtFE4i+skguSKNIr3bsFDIHftuuhv8snvkTuCibTTcT iAZ4V81OrCwSbRvpukWBO6RUi8G92O4JVRfM3Oq5ue//s0g2BcEi76+4lgFS1HYPYLIh HXy7UbqI0E4q13qQkCtcShcovwi0VT3DQOV7ad0dKjYR23xIUlwG9nqgZHWzAJhhdcMl wG689qOKl3kFwbzj/G8Dfgz0ZvYsgtzLfcHTjo2WHG3RHs5BKlya/vlTIq8GuDT2yk6U MWJLQYKOTAaHtNRXjPPVxXLaHlp8eQnn2v3SXioBXfArI/WvfmgwMJlFe5GSpAt1t8GT H3ew== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=xwmqIo3Q; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::429 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org Original-Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com. [2607:f8b0:4864:20::429]) by gmr-mx.google.com with ESMTPS id a3si17349iog.2.2020.03.25.13.21.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Mar 2020 13:21:47 -0700 (PDT) Received-SPF: pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::429 as permitted sender) client-ip=2607:f8b0:4864:20::429; Original-Received: by mail-pf1-x429.google.com with SMTP id h72so1620258pfe.4 for ; Wed, 25 Mar 2020 13:21:47 -0700 (PDT) X-Received: by 2002:a62:ea08:: with SMTP id t8mr5177519pfh.71.1585167706635; Wed, 25 Mar 2020 13:21:46 -0700 (PDT) Original-Received: from johnmacfarlane.net (li55-134.members.linode.com. [74.82.3.134]) by smtp.gmail.com with ESMTPSA id i26sm18796809pfk.176.2020.03.25.13.21.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2020 13:21:45 -0700 (PDT) Original-Received: by johnmacfarlane.net (Postfix, from userid 1000) id 01D9FA26A; Wed, 25 Mar 2020 16:21:34 -0400 (EDT) In-Reply-To: X-Original-Sender: jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@berkeley-edu.20150623.gappssmtp.com header.s=20150623 header.b=xwmqIo3Q; spf=pass (google.com: domain of jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org designates 2607:f8b0:4864:20::429 as permitted sender) smtp.mailfrom=jgm-TVLZxgkOlNX2fBVCVOL8/A@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:24732 Archived-At: function Str(el) local citekey =3D el.text:match("[[]@(%w+)[]]") local citation =3D pandoc.Citation(citekey, 'NormalCitation') return pandoc.Cite({pandoc.Str(citekey)}, {citation}) end Andrzej Wodecki writes: > 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 stuc= k:=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 MacF= arlane=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-set= up-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 he= ar=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 perhap= s=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= email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgi= d/pandoc-discuss/db7c031a-9b53-42e5-b073-f70fa0c16de1%40googlegroups.com. --=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/m2wo78rxrl.fsf%40johnmacfarlane.net.