From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32258 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JDTS Newsgroups: gmane.text.pandoc Subject: Re: Lua filter to fix incorrectly nested lists? Date: Thu, 2 Mar 2023 13:24:06 -0800 (PST) Message-ID: References: <163effbf-b672-4501-9171-8c4681034a96n@googlegroups.com> <80183457-60c8-4fc3-aa16-13d2f93104f1n@googlegroups.com> <8c2cd1be-52b9-467b-a747-a88fc062209bn@googlegroups.com> <8208c36c-dd86-49f6-9b77-32cc5f48299dn@googlegroups.com> <9ea5164a-6677-4aa6-850c-d887c77765e3n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_686_151657446.1677792246072" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32909"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDEZRENAQYORB6FHQSQAMGQEDK6RY2Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Mar 02 22:24:11 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qv1-f60.google.com ([209.85.219.60]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXqPL-0008QV-Re for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Mar 2023 22:24:11 +0100 Original-Received: by mail-qv1-f60.google.com with SMTP id pz4-20020ad45504000000b0056f060452adsf353327qvb.6 for ; Thu, 02 Mar 2023 13:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; t=1677792251; 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=uWI2z2bcxrU2kZVi/qkluaLJB9SuExUDe2L5WNVMIC8=; b=S6rMTBC2Hww/cHVh1TxJNIyDPDprNhH9MnNPULuapoCXW3hso8aSlcUGJdLJQsJ5NO rXY8C9kAklZOyY2Fsi2/6SMRuSHIMed4VDhkIExW27P6NCKno6Ua8voqvAKp7WGOZFyS jxW7smi9Gyl09KzVpx7jRugIGSfVitmWiVkOhx9s1EPigd5Awd6Rq4pcjlVRCXc2L7jU jbIJd7uZmTadLQyLjHGNDtzPOm54M4PNXG04sk07XYeHAYT+/LBeN+yn75hxkpN1luib +axeu250jWRaH4b+U8P/9KTteiSrPOcGwMcnPEfU41sBpsuA3PUlQlPVD0/+o/r9HUzJ LnKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677792251; 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=uWI2z2bcxrU2kZVi/qkluaLJB9SuExUDe2L5WNVMIC8=; b=AGalv6w9lS5AB4LTC4FvQ+z+BESa9zUpY9ElSyuYFaymIBgfED0qeciY4rxEpI4Ufz Cc4BMO6RkvDe0uKbuUtAy6Nr45zfofI12oVwgxtTvtKvgh6KKtx9mEJQAYS4zclsPs1I g6hAA7INb1t7nql+dids359Ge+QAKqSzK+0OmTR51nV50uWVnt+7cRH4zGGpRGYkpBKE Ozto+URkgMklOFa4/V+W078sPFtggoX5ApoMUiz5N0hcTE3kgHKD/tW8g68+Gmc0cFUJ NO/SHHduNP18fOxLvz9az0BanB5EucS/jOc4C97q4BCf6zt1raBrvpwyHHApbdzxx3Lg rXVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677792251; 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-gm-message-state:sender:from:to:cc :subject:date:message-id:reply-to; bh=uWI2z2bcxrU2kZVi/qkluaLJB9SuExUDe2L5WNVMIC8=; b=CU7HWPKKNis35zl5FZ9/5SUIJGnK84PXG+beN8/hTWZTdEL3IZ84KVSyz4D77FuFO/ LRqiHazn3U93bsGj8Yfdjj0ND+2/TvztjAQLRRrN80ssJOm6CCIT923ZVdtmcdlAdQZL DWrT4rEn8Ttr+jjM7iqNpiqOAW0hzdkUJ4itb2c1oQCdrPN2p1WX23DNlnl7H8E0nC9U GBRTP1e0gqv4WFqkKI/nnBglhSHd4FQErNNDwVzyhPHhf0MRFr0R1cy2Ik8+Y84SX1TD jE8CxubC7bIou5YcsNdTYkEcYGv5BYQlkZyQp41tmOXs290adpHZdnzLszHHmJMkOWUv Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKWQV9D9+8WT1ytlFoFr3XoBDX/hnM9swqpTstbrObkM+AhdmtXF pu/8fGR2Bh3RhLjNp1f923o= X-Google-Smtp-Source: AK7set+xTSEPPyvjFYz8wjCxxXaQkUtv5DiT3kZPndV3YkKFO0fDlkHxmv3jyxNU5kJj/+czX+amhg== X-Received: by 2002:a05:620a:3cc:b0:742:5db0:2401 with SMTP id r12-20020a05620a03cc00b007425db02401mr3013513qkm.15.1677792250820; Thu, 02 Mar 2023 13:24:10 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:ac8:43cd:0:b0:3bf:a488:a7cf with SMTP id w13-20020ac843cd000000b003bfa488a7cfls929315qtn.4.-pod-prod-gmail; Thu, 02 Mar 2023 13:24:07 -0800 (PST) X-Received: by 2002:aed:27d3:0:b0:3bf:dc7e:9e42 with SMTP id m19-20020aed27d3000000b003bfdc7e9e42mr3211544qtg.10.1677792246868; Thu, 02 Mar 2023 13:24:06 -0800 (PST) In-Reply-To: <9ea5164a-6677-4aa6-850c-d887c77765e3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> X-Original-Sender: jdtsmith-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:32258 Archived-At: ------=_Part_686_151657446.1677792246072 Content-Type: multipart/alternative; boundary="----=_Part_687_989594791.1677792246072" ------=_Part_687_989594791.1677792246072 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks again, something like this should work. I'd prefer to turn it into a= =20 regular newline, but haven't figure out how to do that. pandoc.str('\n')= =20 doesn't seem to result in any output. =20 On Tuesday, February 28, 2023 at 9:13:14=E2=80=AFAM UTC-5 Julien Dutant wro= te: > Pandoc -f html -t native shows that
is turned into a Linebreak=20 > element: > > pandoc -f html -t native > test
> [ Plain [ Str "test" , LineBreak ] ] > > So I'd use a filter that converts Linebreaks to Space. Save as=20 > removeLinebreak.lua: > > function Linebreak (elem) > return pandoc.Space() > end > > Could be added to the previous one with > > return {{=20 > OrderedList =3D fixList,=20 > BulletList =3D fixList, > Linebreak =3D replaceBySpace > }} > > I think replacing it with a space is the safest. To remove it entirely,= =20 > you couldn't return nil as Pandoc treats this as "leave unmodified". You'= d=20 > have to return an empty list instead, I think: > > function Linebreak (elem) > return pandoc.List:new() > end > > Best, > J > > On Tuesday, February 28, 2023 at 12:28:55=E2=80=AFAM UTC JDTS wrote: > > One other quick question: pandoc parses
as linebreak, and translates= =20 > that into org as double-backslash \\. Any way to disable this? =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/c7314562-60e6-4ae9-bb8b-89408251553fn%40googlegroups.com. ------=_Part_687_989594791.1677792246072 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks again, something like this should work. I'd prefer to turn it into a= regular newline, but haven't figure out how to do that. =C2=A0pandoc.str('= \n') doesn't seem to result in any output. =C2=A0
On Tuesday, February 28, 2023= at 9:13:14=E2=80=AFAM UTC-5 Julien Dutant wrote:
Pandoc -f html -t native shows th= at <br> is turned into a Linebreak element:

= pandoc -f html -t native
test <br/>
[ Plain [ Str "test&qu= ot; , LineBreak ] ]

So I'd use a filter that c= onverts Linebreaks to Space. Save as removeLinebreak.lua:

function Linebreak (elem)
=C2=A0 return pandoc.Space()
end

Could be added to the previous one wit= h

return {{
OrderedList =3D
fixList,

BulletList =3D
fixList,
Linebreak =3D replaceBySpace
}}

I thi= nk replacing it with a space is the safest. To remove it entirely, you coul= dn't return nil as Pandoc treats this as "leave unmodified". = You'd have to return an empty list instead, I think:

function Linebreak (elem)
=C2=A0 return pandoc.List:n= ew()
end

Best,
J
=
On Tuesday, February 28, 2023 at 12:28:55= =E2=80=AFAM UTC JDTS wrote:
One other = quick question: pandoc parses <br> as linebreak, and translates that = into org as double-backslash \\. =C2=A0Any way to disable this? =C2=A0
<= br>

--
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/c7314562-60e6-4ae9-bb8b-89408251553fn%40googlegroups.= com.
------=_Part_687_989594791.1677792246072-- ------=_Part_686_151657446.1677792246072--