public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Julien Dutant <julien.dutant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Lua filter to fix incorrectly nested lists?
Date: Fri, 3 Mar 2023 07:51:23 -0800 (PST)	[thread overview]
Message-ID: <81f58aeb-ac35-45ab-a8f7-79da06619047n@googlegroups.com> (raw)
In-Reply-To: <ee3c85ef-c9ca-473c-9df8-b18be45cc6abn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2170 bytes --]

Might be worth trying what happens if you return pandoc.Softbreak() instead 
of pandoc.Space() https://pandoc.org/lua-filters.html#pandoc.softbreak

On Thursday, March 2, 2023 at 9:59:58 PM UTC JDTS wrote:

> Update: I find that any number of \n's is swallowed, but \r is converted 
> to \n on org output.  
>
> On Thursday, March 2, 2023 at 4:24:06 PM UTC-5 JDTS wrote:
>
>> 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.  pandoc.str('\n') 
>> doesn't seem to result in any output.  
>> On Tuesday, February 28, 2023 at 9:13:14 AM 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 use a filter that converts Linebreaks to Space. Save as 
>>> removeLinebreak.lua:
>>>
>>> function Linebreak (elem)
>>>   return pandoc.Space()
>>> end
>>>
>>> Could be added to the previous one with
>>>
>>> return {{ 
>>> OrderedList = fixList, 
>>> BulletList = fixList,
>>> Linebreak = replaceBySpace
>>> }}
>>>
>>> I think replacing it with a space is the safest. To remove it entirely, 
>>> you couldn't return nil as Pandoc treats this as "leave unmodified". You'd 
>>> 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 AM UTC JDTS wrote:
>>>
>>> One other quick question: pandoc parses <br> as linebreak, and 
>>> translates that into org as double-backslash \\.  Any way to disable this?  
>>>
>>>
>>>

-- 
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/msgid/pandoc-discuss/81f58aeb-ac35-45ab-a8f7-79da06619047n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 3793 bytes --]

      parent reply	other threads:[~2023-03-03 15:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-25 14:26 JDTS
     [not found] ` <163effbf-b672-4501-9171-8c4681034a96n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-25 15:01   ` Julien Dutant
     [not found]     ` <d63a785d-1d91-4b34-8ab2-aea6ea7447b8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-25 22:06       ` JDTS
     [not found]         ` <d030f117-9471-46dd-b730-d1ea81e3b040n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-26 15:47           ` Julien Dutant
     [not found]             ` <80183457-60c8-4fc3-aa16-13d2f93104f1n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-27  0:33               ` JDTS
     [not found]                 ` <8c2cd1be-52b9-467b-a747-a88fc062209bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-27 20:11                   ` Julien Dutant
     [not found]                     ` <a299184a-2b46-4940-a634-bdb656bfa15dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-28  0:14                       ` JDTS
     [not found]                         ` <8208c36c-dd86-49f6-9b77-32cc5f48299dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-28  0:28                           ` JDTS
     [not found]                             ` <fb8d262d-bddc-4b79-8aca-703c1dffea36n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-02-28 14:13                               ` Julien Dutant
     [not found]                                 ` <9ea5164a-6677-4aa6-850c-d887c77765e3n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-02 21:24                                   ` JDTS
     [not found]                                     ` <c7314562-60e6-4ae9-bb8b-89408251553fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-02 21:59                                       ` JDTS
     [not found]                                         ` <ee3c85ef-c9ca-473c-9df8-b18be45cc6abn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-03-03 15:51                                           ` Julien Dutant [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81f58aeb-ac35-45ab-a8f7-79da06619047n@googlegroups.com \
    --to=julien.dutant-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).