wiki.page() appears to strip top-level <ul> from lists

NEW
Unassigned

Status

developer.mozilla.org
API
--
minor
2 years ago
2 years ago

People

(Reporter: wbamberg, Unassigned)

Tracking

({in-triage})

Details

(Whiteboard: [workaround-in-comment-2])

(Reporter)

Description

2 years ago
Here's a test page: https://developer.mozilla.org/en-US/docs/User%3Awbamberg/testing_page_macro.

* The first section shows what a normal <ul><li>... structure looks like.

* The second section transcludes a <ul><li>... structure from another page. You can see that it's missing the left padding.

If you look at the markup in the devtools, you'll see why: the transcluded <ul> is omitting the <ul> element.

The page is actually using the Template:Page macro[1], but that macro is almost a straight call into wiki.page.

The place I'm trying to use this is here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions#API_Reference.
The odd thing is that the ID api-list is on the <div> and not the <ul> element, so pulling the contents of the api-list <div> should return the entire list including its surrounding <ul> element. This isn't what should happen.

Now, I've done this by hand using the API, like this:

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API?raw=1&section=api-list&include=1&macros=1

The result is the same as we see when using the wiki.page macro. The problem appears to be in the ContentSectionTool class's extractSection() function (and probably in the SectionFilter class), but that's as far as I've been able to get into it since I'm not a Python expert.
(Reporter)

Comment 2

2 years ago
Workaround: wrap the <ul> in an extra <div>. The macro strips out the <div>, but leaves the <ul> intact. See "transcluded content, with workaround": https://developer.mozilla.org/en-US/docs/User%3Awbamberg/testing_page_macro.
Severity: normal → minor
Keywords: in-triage
Whiteboard: [workaround-in-comment-2]
You need to log in before you can comment on or make changes to this bug.