Fandom Developers Wiki

This is the talk page for discussing improvements to the Lua reference manual/Scribunto libraries page.

Non-breaking spaces are unsupported by default in mw.text.decode[]

Contrary to what the documentation currently says, you need to set the second argument of mw.text.decode to true in order to correctly parse  . Here's proof:

Default character entity support in mw.text.decode
Input Output
for _, entity in ipairs{"<", ">", "&", """, " "} do
    local decoded_false = mw.text.decode(entity)
    local decoded_true = mw.text.decode(entity, true)

    mw.log(entity)
    mw.log("", "decoded_false:", decoded_false)
    mw.log("", "decoded_true:", decoded_true)
end
<
	decoded_false:	<
	decoded_true:	<
&gt;
	decoded_false:	>
	decoded_true:	>
&amp;
	decoded_false:	&
	decoded_true:	&
&quot;
	decoded_false:	"
	decoded_true:	"
&nbsp;
	decoded_false:	&nbsp;
	decoded_true:	 

I will update the docs accordingly, with a link to this comment. DarthKitty (talk) 17:45, July 14, 2018 (UTC)

That'd be a bug - the code uses the incorrect &#nbsp;. It was fixed almost 4 years ago in upstream Scribunto… - OneTwoThreeFall talk 12:39, July 15, 2018 (UTC)
I applied Wikimedia's patch and will submit a bug report to fix this. -- Cube-shaped garbage can 16:22, July 15, 2018 (UTC)

frame:callParserFunction is absent from the doc[]

Hi,

Do you know if there's a reason for frame:callParserFunction not to be described in this page? I'm using it with DPL successfully, here's an example:

-- With this function, pipes don't need to be escaped but backslashes do
frame:callParserFunction{name = "#dpl:", args = {
	titlematch    = "Page One|Page Two|Page Three|Page Etc",
	include       = "{Some template}:param_name",
	includematch  = "/\\|\\s*param_name\\s*=\\s*\\d+\\s*(?:\\||\\Z)/m",
	secseparators = "%TITLE%: ,.",
	format        = "{,,,}"
}}

Is it like, deprecated/unsupported on Fandom or just missing from the doc? Is it future proof to rely on it instead of frame:preprocess to use DPL from Lua? — Haximus Thunderburp (talk), 20 December 2022

It's just missing from our docs. We're mostly on the same version as MediaWiki. If you can use it and it's not marked as unsupported/deprecated on MediaWiki, that implies it's supported here on Fandom. --BryghtShadow (talk) 05:35, 21 December 2022 (UTC)
Thanks for the reply! I added frame:callParserFunction to the Fandom doc then. Sorry I forgot to answer for a whole month ^_^' — Haximus Thunderburp (talk), 25 January 2023