From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32253 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Julien Dutant Newsgroups: gmane.text.pandoc Subject: Re: Lua filter to fix incorrectly nested lists? Date: Tue, 28 Feb 2023 06:13:13 -0800 (PST) Message-ID: <9ea5164a-6677-4aa6-850c-d887c77765e3n@googlegroups.com> 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> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_9780_483028153.1677593593929" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23475"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC5Y3356IYIPXF7YT4DBUBCIZZB7K-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Tue Feb 28 15:13:18 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qk1-f192.google.com ([209.85.222.192]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pX0jF-0005qs-Vq for gtp-pandoc-discuss@m.gmane-mx.org; Tue, 28 Feb 2023 15:13:18 +0100 Original-Received: by mail-qk1-f192.google.com with SMTP id c15-20020a37e10f000000b00741a3333881sf6084653qkm.13 for ; Tue, 28 Feb 2023 06:13:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; 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=aLMNYXj7UXTFXNsQKH19Kh+KUnlQAnktinQboSdrEho=; b=gCdMUIDsKPqhcyqnsljygC/oCth/Dlt/C1dZFJ31rgQ9FfPLOrSjUqKSzMPjyl8diC BNQYUnzwvO5W8UWPeZmApvKt7sECpw9cewIlYsDHbVXej1knPYdJFsGu4Fps1f6FYHLw Lch5y3/kddpxxjk/aiUjughIEzS6LGuF1pYMXjgzxukCW0iHFFmkZnxLKaJdFe5qfzeg Bvh0jcmBzITIOxrr6GwQEqgi4dpU6ynw9F7ZsxEQgreCexQ3MBCeUvDFZZ6GlnHVDNeT mnY2qqk7kr63+tMfI2iD4M4+Dge2VTgu62rdBOhjcMsnk1znbGsZVcXNnJHxL+sQdJJW ua+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=aLMNYXj7UXTFXNsQKH19Kh+KUnlQAnktinQboSdrEho=; b=YVTwf26kF9gvE+SElWzxbYTydv+nuNP0CNHsoLrEuDadXPbS2eXq7+Z4YIIixgs6zX mM8v81KWzOJZUl1YLW0z/VErvghmoBEfCZJbjRtgwT1T39dDENMxWkF5ezVPhD7goIcz qeFfJvsGuG0RW8YmGjOUDs5ShuVE9tMpzgH8hCEM5sfKHfuPlxovwBPjGSRKjF+U04gw MKk2TdcVd4/GJBt+2f3PVFb9NtdOicy2G8cfTw0l68QV7YjTTXIkWKbM5ZbeC1T3tlM1 TnfyALAqVU/SBL19q8ZkxzSQx78WASt7UqSi5sW6gJsGKsI3DRSkD1uAV2gugTdQwk5O Bhdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=aLMNYXj7UXTFXNsQKH19Kh+KUnlQAnktinQboSdrEho=; b=NTW1GCLefMaJSnuIntJksBjGW/cDDfDq6YUMF196lkLkthqYMfQ39eoGW8plbx6mA/ PP6pP30nwcxaudZA0mG8HsTqMK1fEKiaC3+Fo1762aTVxmNeYgAD9d3AvDSiq4ujr3PY h1Fli1T++tcw07pzKPrTz/uGY/sLAtifq1Q8SoXOXcmYUbg2botHwJm+L6mPk+fvqVTn S9MVXtVrWPC/l81sspfK1XGZP/4EZkjY7o1a/a5IyrzgII2wPlMw1ZZ34FEK5RMw1Svk zlMBEtryYnusvGsEoIcBbqJam9RBdtKCFediJePdFz1vo9BA8hinnj6UUewdd8x94/qX Y99w== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKVoqvY8WUV/f9Lz5+7JUR7Kg8J/JJtK6Ep1wKDOoqU+N468yCWJ VzXsiKMPgvc3W+GplqQK5xs= X-Google-Smtp-Source: AK7set8tNSdytlEp84D9X3mXgcRe4eOIrl85m/96wgqt2hXf4hcYGqF8cYaVRoojmV7u2VqzL7ha8g== X-Received: by 2002:a05:620a:208c:b0:742:34c9:a6c2 with SMTP id e12-20020a05620a208c00b0074234c9a6c2mr475205qka.4.1677593596942; Tue, 28 Feb 2023 06:13:16 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:622a:4c12:b0:3b0:98a4:96b8 with SMTP id ey18-20020a05622a4c1200b003b098a496b8ls13438901qtb.8.-pod-prod-gmail; Tue, 28 Feb 2023 06:13:14 -0800 (PST) X-Received: by 2002:ac8:1cd:0:b0:3b7:fda5:1cb9 with SMTP id b13-20020ac801cd000000b003b7fda51cb9mr668154qtg.2.1677593594513; Tue, 28 Feb 2023 06:13:14 -0800 (PST) In-Reply-To: X-Original-Sender: julien.dutant-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:32253 Archived-At: ------=_Part_9780_483028153.1677593593929 Content-Type: multipart/alternative; boundary="----=_Part_9781_503492693.1677593593929" ------=_Part_9781_503492693.1677593593929 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Pandoc -f html -t native shows that
is turned into a Linebreak 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, you= =20 couldn't return nil as Pandoc treats this as "leave unmodified". You'd have= =20 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/9ea5164a-6677-4aa6-850c-d887c77765e3n%40googlegroups.com. ------=_Part_9781_503492693.1677593593929 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Pandoc -f html -t native shows that <br> is turned into a Linebr= eak element:

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

So I'd use a filter that converts Linebreaks to Space. Save as remove= Linebreak.lua:

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

Co= uld be added to the previous one with

return {{
OrderedList <= span>=3D
fixList,

BulletList =3D
fixList,
<= span>Linebreak =3D replaceBySpace
}}

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

fu= nction Linebreak (elem)
=C2=A0 return pandoc.List:new()
end

Best,
J

On Tuesday, February 28, 2023 at 12:28:55=E2=80= =AFAM UTC JDTS wrote:
One ot= her quick question: pandoc parses <br> as linebreak, and translates t= hat 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/9ea5164a-6677-4aa6-850c-d887c77765e3n%40googlegroups.= com.
------=_Part_9781_503492693.1677593593929-- ------=_Part_9780_483028153.1677593593929--