0

I have a Scribunto module that is supposed to format sub pages using more indented bullets:

local p = {} --p stands for package

function p.subpage_bullets( frame )
    local page = frame.args.page
    local parts = mw.text.split( page, "/", true )
    return string.rep("*", #parts) .. " " ..  parts[#parts] 
end

return p

This works as expected in the debug console.

=p.subpage_bullets(mw.getCurrentFrame():newChild{title="whatever",args={["page"]="Foo/Bar"}}) 
** Bar

I'm using it from DPL like so:

{{#dpl:
format=,{{#invoke:Helpers|subpage_bullets|page=%PAGE%}},<br />
|ordermethod=none
|namespace= {{NAMESPACE}}
}}

The result is that the pages are not indented. So a page Foo/Bar returns * Foo/Bar instead of the expected ** Bar.

Why is it not working? I tried replacing "/" in the split with "%2f"/"%2F", which didn't change the result.

Another related question is that the bullets are rendered as * and not interpreted as wikitext so not rendered as an actual bullet.

IttayD
  • 28,271
  • 28
  • 124
  • 178
  • Invoking this module on MediaWiki 1.36 with `page=Foo/Bar` gives me the expected `** Bar` (parsed as well). What version are you running? Does it work if you try the invocation outside of DPL? – Xxmarijnw Oct 25 '21 at 09:28
  • @Xxmarijnw Thanks for trying it! I have Mediawiki 1.36, The extension is from https://github.com/Universal-Omega/DynamicPageList3/archive/refs/tags/3.3.7.tar.gz and Scribunto is the one that comes with MW with no additional settings. It works if I invoke it like so: {{#invoke:Helpers|subpage_bullets|page={{FULLPAGENAME}}}} – IttayD Oct 25 '21 at 10:36
  • To be more exact, MW is 1.36.2 – IttayD Oct 25 '21 at 10:44
  • @Xxmarijnw, I just realized you may have passed it the Foo/Bar literal. This works for me as well, but is not parsed (I see `**` and not an indented bullet). Which is why I thought there is something funky with what is the value of %PAGE%, but I tried to convert to string (e.g. if it is an object) and it seems like a regular string – IttayD Oct 25 '21 at 10:45

0 Answers0