From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32975 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christophe Demko Newsgroups: gmane.text.pandoc Subject: Re: Converting reference footnotes to inline footnotes (md -> md if poss.) Date: Wed, 19 Jul 2023 10:59:23 -0700 (PDT) Message-ID: References: Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_13436_290061065.1689789563573" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27888"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDN5TJEC4AEBB7GI4CSQMGQE3EPUUJI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Wed Jul 19 19:59:29 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f58.google.com ([209.85.161.58]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1qMBST-000758-F9 for gtp-pandoc-discuss@m.gmane-mx.org; Wed, 19 Jul 2023 19:59:29 +0200 Original-Received: by mail-oo1-f58.google.com with SMTP id 006d021491bc7-56601c9a4fesf1558302eaf.1 for ; Wed, 19 Jul 2023 10:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1689789568; x=1690394368; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :sender:from:to:cc:subject:date:message-id:reply-to; bh=2vkzv0p+BwzV7045AkpBwHxclcezpMtrqDlmWVxacnM=; b=I9VuDwbkOATitsZ1Stzgu9g2i4Hk7cwNPE68BFw7qUUgH59aUP0aLvl9gSJAtwNzKU ZyKosC+r9WzFa0WykeSB2Gb0MFrZv/71vi1d0d+eMvdQ6V9woMAnQCxjsUB/SzIG+I9p +C4x2MuP1QKO4/n/c9GtSG6u3NdSuUF0FFDizIAEpgPWQnWBRYaIgKfRCUv6xK9vA24K gM/Xz2+jOTW7hlJt9FUtKikxjlrEFBs+tThTnhLTnsGBn1Ot0gqxNq2sFO0GBF+lGJ+3 DmFD2xNlJKX/7RvbfJXJ4RBbMQtwMfUnlqOZKpDlZdH256MzxYlTcklfPlRLnofU1tS1 mvAQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689789568; x=1690394368; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:x-original-sender :mime-version:subject:references:in-reply-to:message-id:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=2vkzv0p+BwzV7045AkpBwHxclcezpMtrqDlmWVxacnM=; b=pjwlUSCkXMIS23QfuKV49hKPNFzpK290wHCPShcp5KSOBFzT1yrQb6MlTKiJvjQtLy lR4zNgy182jBbi5nVtwWwuUDeeMt2aAJwFJzo9wAtzo31lN1DIhADqeFCzRlDfWzcTKj M5hCF5gZwXsp5sdSSWzUeg8cnzfall1Z1SZd7LwAjh6f5EwuL3GiDlkUulUPPM5AtEl6 aBl101zNdczaLv8bDIYxDp2hR4yQc4/3BvG0vzns7ksgnmzgOyh+egKyUaC/ZargMs+H N3LXYFFrNvKo5naVGbv7DRxx+9Q/92gWafo1j1XFZ+ot5IM61cHntQPiE/0l0ufmPoDO KjZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689789568; x=1690394368; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-sender:mime-version:subject:references:in-reply-to :message-id:to:from:date:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=2vkzv0p+BwzV7045AkpBwHxclcezpMtrqDlmWVxacnM=; b=TYvYgCG6CxAwkXqr1XqK0twq0MQjzpZBUX2P/etCvunCG3rJ1DN6NEG+vQms94QeFd hIo/xt3xsEvAeOW9EM/fOsRgQkFiANu/JhKD0gsoVFuk/OAgfwRu5sb/sC9/BvtVqk5c UgLGCL1pIOc++vAEDQYs4HDME9fvatV7wG/1tn6df0breiPhNa4hM3iFzJUYJGFbbkYI eEuJbB2jK2CgU08fpP8Ogjdo8V+WONmERy0k2Bq4NlE7NHdjeQNXLj9b6jMBWzpeT4x8 s430qaDZj2rLxxkYYMTMp8lYUGtU2EJsU9F/P60Ry9HHRGuhNs Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: ABy/qLbR+6Q5mFuJ8ovmI/t4bUwr4xV4f6b90QWm52JqBNS6FfWW88Pt hPSBlvdgWFotoV5+W/Dd3ko= X-Google-Smtp-Source: APBJJlGkYcofjAs5WkBk1dow5pcHzZx0BVHvAthvJGmBY05RdsLNjDeGvE+kru2oiJLASlhJTb23ag== X-Received: by 2002:a05:6871:520b:b0:1a9:ba31:f0d8 with SMTP id ht11-20020a056871520b00b001a9ba31f0d8mr2404677oac.12.1689789568018; Wed, 19 Jul 2023 10:59:28 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:c69f:b0:1b0:67ac:3bbb with SMTP id cv31-20020a056870c69f00b001b067ac3bbbls4914562oab.0.-pod-prod-05-us; Wed, 19 Jul 2023 10:59:24 -0700 (PDT) X-Received: by 2002:a05:6870:954d:b0:1b0:4726:9ad5 with SMTP id v13-20020a056870954d00b001b047269ad5mr178325oal.9.1689789564216; Wed, 19 Jul 2023 10:59:24 -0700 (PDT) In-Reply-To: X-Original-Sender: chdemko-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:32975 Archived-At: ------=_Part_13436_290061065.1689789563573 Content-Type: multipart/alternative; boundary="----=_Part_13437_62832358.1689789563573" ------=_Part_13437_62832358.1689789563573 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Can you post the files which cause an issue ? Le mercredi 19 juillet 2023 =C3=A0 18:44:09 UTC+2, 'o-Dzin Tridral a =C3=A9= crit : > Hi Christophe, > > I'm sorry to follow up again, but I get an error with my large md file > > The filter fails with the error > > attempt to concatenate a nil value (field 'text') > > The error doesn't mention where the failure happens or what text is=20 > causing the problem. If you have any advice re how to get more informati= on=20 > from pandoc or lua I would very much appreciate it.=20 > > I entirely understand if you don't have time to look at this of course. > > best regards, > > '=C3=B6-Dzin > > =20 > > > =E0=BD=A0=E0=BD=BC=E0=BD=91=E0=BC=8B=E0=BD=A0=E0=BD=9B=E0=BD=B2=E0=BD=93= =E0=BC=8B=E0=BD=91=E0=BE=B2=E0=BD=B2=E0=BC=8B=E0=BD=96=E0=BE=B2=E0=BD=A3 > '=C3=B6-Dzin Tridral > [image: https://]about.me/tridral > > > =E2=98=B8=20 > *Drala Jong Appeal - creating a Buddhist retreat centre in Wales:=20 > https://www.drala-jong.org/ *=E2=98=B8 > > =E2=98=B8 Achos pan ddaw y Pedwar Marchog i ofyn a roist ti o dy gyfan - = fydd gen=20 > ti ddim esgus - Meinir Gwilym =E2=98=B8 > > > On Wed, 19 Jul 2023 at 17:19, 'o-Dzin Tridral wrote: > >> Hi Christophe, >> >> Thank you very much for your reply. >> >> I've not used lua filters before. It took me a while to realise how to= =20 >> make a command line with the input file and output file. >> >> I thought I'd write back and include tis for the benefit of any novices= =20 >> like me. >> >> I've now done this with your script, inserting the* '-i' *for the input= =20 >> file and using output redirection '*>' *for the output file >> >> pandoc --lua-filter note.lua -t markdown -i ** | sed -e= =20 >> 's/%%opening%%/\^\[/g' | sed -e 's/%%closing%%/\]/g' > ** >> >> This works on my small example file. >> >> Thank you once again. >> >> '=C3=B6-Dzin >> >> =20 >> >> >> =E0=BD=A0=E0=BD=BC=E0=BD=91=E0=BC=8B=E0=BD=A0=E0=BD=9B=E0=BD=B2=E0=BD=93= =E0=BC=8B=E0=BD=91=E0=BE=B2=E0=BD=B2=E0=BC=8B=E0=BD=96=E0=BE=B2=E0=BD=A3 >> '=C3=B6-Dzin Tridral >> [image: https://]about.me/tridral >> >> >> =E2=98=B8=20 >> *Drala Jong Appeal - creating a Buddhist retreat centre in Wales:=20 >> https://www.drala-jong.org/ *=E2=98=B8 >> >> =E2=98=B8 Achos pan ddaw y Pedwar Marchog i ofyn a roist ti o dy gyfan -= fydd=20 >> gen ti ddim esgus - Meinir Gwilym =E2=98=B8 >> >> >> On Wed, 19 Jul 2023 at 14:36, Christophe Demko wrote: >> >>> You can use a lua filter: >>> >>> $ pandoc --lua-filter note.lua -t markdown | sed -e=20 >>> 's/%%opening%%/\^\[/g' | sed -e 's/%%closing%%/\]/g' >>> >>> with this note.lua file >>> >>> function Note(note) >>> note.content[1].content[1].text =3D "%%opening%%" ..=20 >>> note.content[1].content[1].text >>> note.content[1].content[#note.content[1].content].text =3D=20 >>> note.content[1].content[#note.content[1].content].text .. "%%closing%%" >>> return note.content[1].content >>> end >>> Le dimanche 16 juillet 2023 =C3=A0 17:35:38 UTC+2, tri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a = =C3=A9crit : >>> >>>> Is it possible to use Pandoc to convert an md file that has reference= =20 >>>> footnotes to one that has inline footnotes - just by going from md -> = md,=20 >>>> but failing that via another format. >>>> >>>> I have a file containing reference footnotes like this >>>> ---- >>>> Example[^1] line of text. >>>> >>>> [^1]: Example footnote >>>> ---- >>>> >>>> I would like to convert them all to inline footnotes like this >>>> >>>> ---- >>>> Example^[Example footnote] line of text. >>>> ---- >>>> >>>> Thank you for any help >>>> >>>> '=C3=B6-Dzin >>>> >>> --=20 >>> You received this message because you are subscribed to the Google=20 >>> Groups "pandoc-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send= =20 >>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To view this discussion on the web visit=20 >>> https://groups.google.com/d/msgid/pandoc-discuss/dabd9a50-de23-47d9-971= e-cfc8d1b92e0dn%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/fdfa600a-c418-467e-a01b-2f8af160eba9n%40googlegroups.com. ------=_Part_13437_62832358.1689789563573 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Can you post the files which cause an issue ?

Le mercredi 19 juillet 2023= =C3=A0 18:44:09 UTC+2, 'o-Dzin Tridral a =C3=A9crit=C2=A0:
<= blockquote class=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-left:= 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Christophe,

I'm sorry to follow up again, but I get an error with my larg= e md file

The filter= fails with the error

=C2=A0 attempt to concatenate a nil value (= field 'text')

The error doesn't mention= where the failure happens or what text is causing the problem.=C2=A0 If yo= u have any advice re how to get more information from pandoc or lua I would= very much appreciate it.

I entirely und= erstand if you don't have time to look at this of course.=

best regards,

'=C3=B6-Dzin

=

=E2=98=B8=C2= =A0Achos pan ddaw y Pedwar Marchog i o= fyn a roist ti o dy gyfan - fydd gen ti ddim esgus - Meinir Gwilym=C2=A0=E2= =98=B8
<= /div>


On Wed, 19 Jul 2023 at 17:19, 'o-Dzin Tri= dral <tri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>= ; wrote:
Hi Christophe,

Thank you very much for your rep= ly.

I= 9;ve not used lua filters before.=C2=A0 It took me a while to realise how t= o make a command line with the input file and output file.

I thought I'd write= back and include tis for the benefit of any novices like me.

I've now done= this with your script, inserting the '-i' for the input fil= e and using output redirection '>'=C2=A0 for the output f= ile

= =C2=A0=C2=A0 pandoc --lua-filter note.lua -t = markdown -i <input file> | sed -e 's/%%opening%%/\^\[/g= 9; | sed -e 's/%%closing%%/\]/g' > <output file>

This wor= ks on my small example file.

Thank you once again.

=
&= #39;=C3=B6-Dzin
=

<= tbody style=3D"margin:0px;padding:0px;border:0px none;outline:0px;font-weig= ht:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline">=
=C2=A0
<= /font>
=E2=98=B8=C2=A0
=
Drala Jong Appeal
- creating a Buddhist retreat cent= re in Wales
:
https://www.dr= ala-jong.org/
=E2=98=B8

=E2=98=B8=C2=A0Achos pan ddaw y Pedwar Marchog i ofyn a roist = ti o dy gyfan - fydd gen ti ddim esgus - Meinir Gwilym=C2=A0=E2=98=B8
<= /div>


On Wed, 19 Jul 2023 at 14:36, Christophe Demko <chd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
You can use a lua= filter:

$ pandoc --lua-filter note.lua -t markdow= n | sed -e 's/%%opening%%/\^\[/g' | sed -e 's/%%closing%%/\]/g&= #39;

with this note.lua file

<= div>function Note(note)
=C2=A0 note.content[1].content[1].text =3D "= ;%%opening%%" .. note.content[1].content[1].text
=C2=A0 note.conten= t[1].content[#note.content[1].content].text =3D note.content[1].content[#no= te.content[1].content].text .. "%%closing%%"
=C2=A0 return not= e.content[1].content
end
Le dimanche 16 juillet 2023 =C3=A0 17:35:38 UTC= +2, tri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org a =C3= =A9crit=C2=A0:
<= div>Is it possible to use Pandoc to convert an md file that has reference f= ootnotes to one that has inline footnotes - just by going from md -> md,= but failing that via another format.

I have a fil= e containing reference footnotes like this
----
=C2= =A0=C2=A0=C2=A0 Example[^1] line of text.

=C2=A0=C2=A0=C2=A0 [^1]: E= xample footnote
----

I would like to con= vert them all to inline footnotes like this

----
=C2=A0=C2=A0=C2=A0 Example^[Example footnote] line of text.
<= div>----

Thank you for any help

=
'=C3=B6-Dzin

--
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 pandoc-discus...@googleg= roups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/dabd9a50-d= e23-47d9-971e-cfc8d1b92e0dn%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/fdfa600a-c418-467e-a01b-2f8af160eba9n%40googlegroups.= com.
------=_Part_13437_62832358.1689789563573-- ------=_Part_13436_290061065.1689789563573--