From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32259 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:59:57 -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_612_544564387.1677794397874" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14523"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDEZRENAQYORBX5YQSQAMGQEQ2GWKJQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Mar 02 23:00:02 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 1pXqy2-0003a1-8L for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Mar 2023 23:00:02 +0100 Original-Received: by mail-qv1-f60.google.com with SMTP id ny17-20020a056214399100b00570f687e908sf385831qvb.14 for ; Thu, 02 Mar 2023 14:00:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; t=1677794401; 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=q8W9gf03q17Zj7B5YCmRxpsj9qS53NU6XGlBaE1QNiY=; b=CC/AbDgN3SCLuHGktuNU2AL6lBHpXAe4cbhnA4ibo8F1Cr64lN2wst8/8tCTY76CxL c/T3+Je37SwQA3KzO8mN+KN5CWe9rEK7f1S/mrMA+TBtHmR7mW+SXC+yZg41FOcYLAtv RxgO+P9UN7DzBBU+om6VFCB44Tejj6BbR4VZFQC2KraxQ+I+Jl22ukaHkh4Nnous3wds 3SLif9LZ/9XD+ggouwKr3/+fHaL4v65npjiOrlHXiMz4zyZt8RG19Bo+75TgmRMfPMUK 6axg3jeb7pyGCpyU+gmYMmpJfnDYmLbuclJdJpiBITbnid8EJTTe3z7B1TbKFLJlXcef 21Rg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1677794401; 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=q8W9gf03q17Zj7B5YCmRxpsj9qS53NU6XGlBaE1QNiY=; b=kU2D/DJbTISlWfbcUjxZXXDELEywkBntRoP4iJsYgfwxrlita5Dn21b+/2sumCsA7R zOFnObfHTjmpjcsVCVHHFCHVrXOLeshGYRbIrmXa7Fa6wGf4ELploDRJrAwi47ol0W6W ItIfSq8jspI86vR/AqyosQQ7ncDK1oKLXKzojtURMHWDf9RH2cr528GXK9sa6sp9TP+0 c3Syba1QfRUi6Mqa/n96f/9TTaedpmpjAGVjQ2FDR6kpqBarmzDi5JLer5UBogt5TKcK 0KLJya2Y7k0S0t1qt9SRfP8ZGdaWCxqWO5c0EJF+vgcOfLnuAdY2/5Msa6GCEdm27wWl 8S3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677794401; 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=q8W9gf03q17Zj7B5YCmRxpsj9qS53NU6XGlBaE1QNiY=; b=IDXCqtW9MRubacgOEY8VTSYIsBFAupWGJjADI6IyNEWBrkMwiFmzEEi3pSujQdAIvA fGQoxJCeXHpOKNvoBN6DFJiEHGfPsQJpIAo/9J/4wDD/2yifi465wMsyVrjWG+25D9Ma +xbI/QBwyegN+b2SQ55ZkUQsvFG/eglapeCRwBAObi5jKx9ZXwfZXNQmQs62DD4NkCLn zM5Oe0iIKySKiDuQ8znagAgfI1gIVJIEfM9qCIgbSooNlWGtESsXx9VNKDcpJGcU9iHK qPAzFPN1Px/vTHDq1zNVEx+REVA4DRzBPHzRIudYldOwDuoo29XfIijdlZqwSWQAjxwG Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKVrBxR8Mnz8NUEHV2MR/Xc1dVXy0LAOmmOvRVY5gAYnf58OTk0h aTotVLBLWGORbwUPqsWrHmg= X-Google-Smtp-Source: AK7set9ANlkH2XueX7BTF8lyg8C9C2MVR+atW0qg8jMZoPE0cQQ4/yAHwUzNKEMKAfdLsjXV6/ouqg== X-Received: by 2002:a05:6214:1907:b0:56e:fbea:9e9a with SMTP id er7-20020a056214190700b0056efbea9e9amr3020250qvb.0.1677794401145; Thu, 02 Mar 2023 14:00:01 -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-20020ac843cd000000b003bfa488a7cfls1024196qtn.4.-pod-prod-gmail; Thu, 02 Mar 2023 13:59:58 -0800 (PST) X-Received: by 2002:ac8:434c:0:b0:3bf:baab:bf95 with SMTP id a12-20020ac8434c000000b003bfbaabbf95mr936408qtn.4.1677794398452; Thu, 02 Mar 2023 13:59:58 -0800 (PST) In-Reply-To: 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:32259 Archived-At: ------=_Part_612_544564387.1677794397874 Content-Type: multipart/alternative; boundary="----=_Part_613_1509361463.1677794397874" ------=_Part_613_1509361463.1677794397874 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Update: I find that any number of \n's is swallowed, but \r is converted to= =20 \n on org output. =20 On Thursday, March 2, 2023 at 4:24:06=E2=80=AFPM UTC-5 JDTS wrote: > Thanks again, something like this should work. I'd prefer to turn it into= =20 > a 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 w= rote: > >> 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 translate= s=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/ee3c85ef-c9ca-473c-9df8-b18be45cc6abn%40googlegroups.com. ------=_Part_613_1509361463.1677794397874 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Update: I find that any number of \n's is swallowed, but \r is converted to= \n on org output. =C2=A0

On Thursday, March 2, 2023 at 4:24:06=E2=80=AFP= M UTC-5 JDTS wrote:
Thanks again, something like this should work. I'd prefer to tur= n 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 that <br> is turned into a Linebreak element:

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

So I'd u= se a filter that converts Linebreaks to Space. Save as removeLinebreak.lua:=

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

Could be added to th= e previous one with

= 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/ee3c85ef-c9ca-473c-9df8-b18be45cc6abn%40googlegroups.= com.
------=_Part_613_1509361463.1677794397874-- ------=_Part_612_544564387.1677794397874--