From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/32233 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: Sat, 25 Feb 2023 07:01:08 -0800 (PST) Message-ID: References: <163effbf-b672-4501-9171-8c4681034a96n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_2272_1970621178.1677337268308" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3948"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC5Y3356IYILLRPIT4DBUBAQROTZG-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Sat Feb 25 16:01:13 2023 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-qv1-f57.google.com ([209.85.219.57]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pVw2y-0000qf-QH for gtp-pandoc-discuss@m.gmane-mx.org; Sat, 25 Feb 2023 16:01:12 +0100 Original-Received: by mail-qv1-f57.google.com with SMTP id ef20-20020a0562140a7400b004c72d0e92bcsf939158qvb.12 for ; Sat, 25 Feb 2023 07:01:12 -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=Ph6z1ygGW8KITKWg7pTyHGSioUXS99gLRSyZm4EjECI=; b=SQYMj7Y5aWbr7Q4cXNoQuY4qJ2TyZk1xKJQXl0YYhXQhDFYCipKGf9v3NtbAzRX2H8 pKlqrhVvoe8x/WtKj5TP6rSYbQjxDn1zJPYxEsz0Mn3iQPjip10j0oZZlF0O3/KYT0nf wG49IPRnxZJsAa5tt0rAC5wXWPM8S8j0fmAmrfoJnp84KsMl2/8p7XvrMuL8/qeo+STk NKzpKs7574haTmiaeqt5aAjOORr7ZNI1W4kv1O62q2qKli/YYyYcbbJnJS1A3UcyrdBv wsSG5i4WJ6rRw1hp6Vg+MTML325OYkUaf446UzU2KWR7owAipHVDeEjz6IhimspbO1vY JRFg== 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=Ph6z1ygGW8KITKWg7pTyHGSioUXS99gLRSyZm4EjECI=; b=IsjVHSGSjd4M4QAVf1mkkjndKzMLpfN4MYAirBG0SbfWgfw856bnBEQBMv723/t6qI Wp38/HUH5EgtWsrJnRSiYtEGZ/pj4/ojpeTd3riiS+fMQpUfXvYkOtG0V9tbbM7D/S7w U3vLn6oa6pUy9/kqa+Fj3FbKbmgbd3K/+P49uy0oEESMwmUgZfqqJd3t5vLktrfnEV4f LQKxYQxenxqPQ/wA8E7yfgHCsiu/sL9xGkPH4pDAr2yQhupeZYRgvdA5DGFmJa+XdnEG J5PTEk4KRMMesjvHlqDrgC53PzVunJgkbIYRc9ieyZbCiXgTg1ewnu11wCtU4Jmvg+V7 dj5Q== 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=Ph6z1ygGW8KITKWg7pTyHGSioUXS99gLRSyZm4EjECI=; b=GRtcN7kLhoaRVLJWCfdOlfqvIO/MGO4tzmU55b3/BrLLKgMOn8WSwm9H1oZ615NKdd rNePSOWMrA4Pq82vihFSBEP7SxObWUM4e8GHuqZNgWBzXlSOS+0y8Q4aoL9POTlpCCx9 6jh2LkxWBXYTwPfEQ2TIXgV1iI365tgrpuj07oM834Wl0uO2Vnc3g2qHyRZ3OK7fJnB/ FJWUOil/kQv4HrfC02g6nehA6K+KrDCiQkyVuTTpCtdhPMZ/RO8URrO5DNCU42Jmdu0c AQzeUiH2opesa/whbdv0DdvpEgytPIDuuWQXAon7PSJzJ+TGZTJXmyioq5omN+XjY8nO NsNg== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AO0yUKVn2gxu1LRLyF6EYDKx9NlSzTMKdEAAepshi7/6b57lXpbsl5h8 lS/TtMtUPwkcy0RjmkuBZ2o= X-Google-Smtp-Source: AK7set87BYjJGg3EN6chGVKGEl/gYXgT/TrbpcuOWdHHlxGApwn9dzcTYPpHoqFmRKI+qVXokprHsA== X-Received: by 2002:ad4:4a6e:0:b0:571:7c9:3f0b with SMTP id cn14-20020ad44a6e000000b0057107c93f0bmr3535610qvb.8.1677337271755; Sat, 25 Feb 2023 07:01:11 -0800 (PST) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:620a:98f:b0:73b:79fc:2f0 with SMTP id x15-20020a05620a098f00b0073b79fc02f0ls1093915qkx.9.-pod-prod-gmail; Sat, 25 Feb 2023 07:01:09 -0800 (PST) X-Received: by 2002:a05:620a:1115:b0:71f:b908:7b83 with SMTP id o21-20020a05620a111500b0071fb9087b83mr3318810qkk.15.1677337268974; Sat, 25 Feb 2023 07:01:08 -0800 (PST) In-Reply-To: <163effbf-b672-4501-9171-8c4681034a96n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 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:32233 Archived-At: ------=_Part_2272_1970621178.1677337268308 Content-Type: multipart/alternative; boundary="----=_Part_2273_1707767265.1677337268308" ------=_Part_2273_1707767265.1677337268308 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Looks feasible. Pandoc converts the first html to: [ BulletList [ [ Plain [ ... Inlines ] ] , [ BulletList [ [ Plain [ ... Inlines ] ] , [ Plain [ ... Inlines ] ] ] ] , [ Plain [ Inlines ] ] ] ] I.e., the sublist is converted to its own list item. So the filter should= =20 pick up list, check if any item within them consists of a lone sublist, and= =20 if so, move it to the previous item. (And best, apply the filter=20 recursively to that sublist itself.) On Saturday, February 25, 2023 at 2:26:04=E2=80=AFPM UTC JDTS wrote: > The Apple Notes app produces (via AppleScript) HTML for notes with nested= =20 > lists structured like: > >
    > >
  • Level 1 element 1
  • > >
      > >
    • Level 2 element 1
    • > >
    • Level 2 element 2
    • > >
    > >
  • Level 1 element 2
  • > >
> > As you can see, the sublist is incorrectly positioned. It should be=20 > positioned *within* the
  • Level 1 element 1 item, ala: > >
      > >
    • Level 1 element 1 > >
        > >
      • Level 2 element 1
      • > >
      • Level 2 element 2
      • > >
      > >
    • > >
    • Level 1 element 2
    • > >
    > > Is there a straightforward way with Lua filters to fix this at the AST=20 > level, for arbitrary-depth sublist nesting? > --=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/d63a785d-1d91-4b34-8ab2-aea6ea7447b8n%40googlegroups.com. ------=_Part_2273_1707767265.1677337268308 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
    Looks feasible. Pandoc converts the first html to:

    [ BulletList
    =C2=A0 =C2=A0 [ [ Plain
    =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 [ ... Inlines ]
    =C2=A0 =C2=A0 =C2=A0 ]
    =C2=A0 =C2= =A0 , [ BulletList
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [ [ Plain
    = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [ ... Inlines ]
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ]
    =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 , [ Plain
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 [ ... Inlines=C2=A0 ]
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= ]
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ]
    =C2=A0 =C2=A0 =C2=A0 ]=C2=A0 =C2=A0 , [ Plain
    =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 [ Inline= s ]
    =C2=A0 =C2=A0 =C2=A0 ]
    =C2=A0 =C2=A0 ]
    ]

    I.e., the sublist is converted to its own list item. So t= he filter should pick up list, check if any item within them consists of a = lone sublist, and if so, move it to the previous item. (And best, apply the= filter recursively to that sublist itself.)

    On Saturday= , February 25, 2023 at 2:26:04=E2=80=AFPM UTC JDTS wrote:
    The Apple Notes app produces (= via AppleScript) HTML for notes with nested lists structured like:

    =

    <ul>

    <li>Level 1 element 1</li>=

    <ul>

    <li>Level 2 element 1</li>=

    <li>Level 2 element 2</li>=

    </ul>

    <li>Level 1 element 2</li>=

    </ul>


    As you can see, the sublist is incorrectly positioned. =C2= =A0It should be positioned=C2=A0within=C2=A0the <li> Level 1 element 1 item, ala:

    <= div>

    <ul>

    <li>Level 1 element 1

    =C2=A0 =C2=A0 <ul>

    =C2=A0 =C2=A0 <li>Level 2 element 1</li>

    =C2=A0 =C2=A0 <li>Level 2 elem= ent 2</li>

    =C2=A0 =C2= =A0 </ul>

    </li><= br>

    <li>Level 1 elemen= t 2</li>

    </ul>


    Is there a straightforward way wi= th Lua filters to fix this at the AST level, for arbitrary-depth sublist ne= sting?

    --
    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/d63a785d-1d91-4b34-8ab2-aea6ea7447b8n%40googlegroups.= com.
    ------=_Part_2273_1707767265.1677337268308-- ------=_Part_2272_1970621178.1677337268308--