Module talk:WikiProject banner: Difference between revisions

Content deleted Content added
WikiProject Higher education: misuse of syntaxhighlight - only the opening tag may be indented, on other lines the colons are taken literally; also, Lua is not Wikitext
Line 80:
::Please can you explain what you mean by "be passed the list of args, and return a modified list of args", preferably with an example? &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 09:23, 18 June 2025 (UTC)
:::Absolutely. If you took a look at my hokey lua module, you might see what I mean. But something like:
:::<syntaxhighlight lang="wikitextlua">
::: if(args["ProjectArgs"]=="Higher Education") then
::: args=HigherEducationArgParser(args)
::: end
:::</syntaxhighlight>
:::or, even better (if possible)
:::<syntaxhighlight lang="wikitextlua">
::: if(args["ProjectArgs"]!=nil) then
::: args=_G[args["ProjectArgs"]](args) -- or some other way to define the function name in the template
::: end
:::</syntaxhighlight>
:::placed somewhere appropriate in Wikiproject_banner, and written a bit more maintainably...
:::called like this:
:::<syntaxhighlight lang="wikitext">
:::{{#invoke:WikiProject banner|main|ProjectArgs=HigherEducationArgParser}}
:::</syntaxhighlight>
:::If you wanted, this could be collapsed into how you were calling it:
:::<syntaxhighlight lang="wikitext">
:::{{#invoke:WikiProject banner|main|project=Higher Education}}
:::</syntaxhighlight>
:::and the pseudocode might look like:
:::<syntaxhighlight lang="wikitext">
::: local ProjectFunc=string.gsub(args["project"]," ","_") .. "_Argument_Function"
::: if(ProjectFunc]!=nil) then
::: args=_G[ProjectFunc](args) -- not sure this works in our framework
::: end
:::</syntaxhighlight>
:::Apologies if there are errors, I never saw a line of lua until a few weeks ago, but I'd love to help in any way I can. Does this help explain what I mean? [[User:Tduk|Tduk]] ([[User talk:Tduk|talk]]) 13:51, 18 June 2025 (UTC)