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 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 PM 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.  It should be positioned within the <li> Level 1 element 1 item, ala:

<ul>

<li>Level 1 element 1

    <ul>

    <li>Level 2 element 1</li>

    <li>Level 2 element 2</li>

    </ul>

</li>

<li>Level 1 element 2</li>

</ul>


Is there a straightforward way with Lua filters to fix this at the AST level, for arbitrary-depth sublist nesting?

--
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-/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.