Open BryghtShadow opened 2 years ago
Thanks for the bug report! (At the very least we should add a distinct node type for module invocations, in the same vein as parser functions, c.f. #10.)
To clarify, the expectation is that both of these would return True? Or only the second one?
code = mwparserfromhell.parse("{{#invoke:Foo}}")
t = code.filter_templates()[0]
t.name.matches("#invoke:Foo")
t.name.matches("Module:Foo")
The distinct node type would allow differentiation between {{Module:Foo}}
and {{#invoke:Foo}}
, I presume?
I'd expect just the second option to return True
. It makes sense in terms of valid namespaces (#invoke:
is not valid) and orthodox module usage (transclusions are unorthodox, and the node type should hopefully cover such use cases).
Would it be possible to add support for matching Scribunto modules that are invoked on a page?
{{#invoke:Foo|bar}}
, which executes the function of the module (currently only Lua); rather than{{Module:Foo}}
, which would transclude the content of the module as wikitext.The current workaround I'm using is to
copy.deepcopy
the name and replace the namespace in the copy: