Template talk:Infobox Game Fancy

From IcehouseOrg
Jump to: navigation, search

Really like the look of the new infobox

The new infobox looks really nice! Much more elegant and compact than the old one.

Thinking about how we'd want to handle the designer field, I think we may want to look into either using ParserFunctions (already enabled on the wiki) or Lua (https://www.mediawiki.org/wiki/Extension:Scribunto, which appears to be used these days by many of the larger wikis) to be able to handle comma delimited lists of designers and possibly links to their user pages. I think that would also help it integrate better with Semantic MediaWiki, as Semantic MediaWiki allows you to have multiple values for the same property; it would work a lot better to have multiple different designer relations on the same page, than have one big designer property that sometimes has multiple people. — λ (talk | contribs) 10:59, 7 November 2016 (PST)


Thanks! It was not nearly as hard as it seemed at first.

Very good point. The Other Equipment and Mechanics properties would also benefit from multiple values. I was trying to hack together a quick and dirty list comprehension for the Other Equipment by using the "#set:" semantic function in conjunction with the "+sep=" option but it did not seem to work. Using a more complete programing language sounds much cleaner and easier. I have never used Lua before but I am sure it can't be too difficult for what we need. Umjahwa (talk) 13:33, 7 November 2016 (PST)


Alright, I have done a little reading / experimenting. Managed to get list comprehension for the "#set" parser function to work correctly (was just missing some "|" pipes). Multiple semantic value assignment is a go! All that is needed to apply this the "designer" field is to run a one-line string parser function to clean the input. Unfortunately, however, all of the string functions are disabled by default. Would you be so kind as to enable them? From the ParserFunction docs it sounds like you just need to include $wgPFEnableStringFunctions = true; in LocalSettings.php somewhere after actually loading the extension. [note: flagging with the "admin" template mostly to see what it actually does].

The Lua extension might still be worth looking into in the future but is apparently overkill here since we just need two simple function calls. Once the string functions are enabled, I will get the new infobox semi-finalized and then people for input on what other information they would like us to track. We might not show them all in the infobox but it would be an easy place to collect the data for new semantic properties. Umjahwa (talk) 06:40, 8 November 2016 (PST)

I have enabled string functions in LocalSettings.php. Give that a try. It looks like Wikipedia doesn't do this, though, as they prefer Lua as it's faster and a real language, so if the string functions are at all too slow or limited, I'll just install the Lua extension.
As far as the admin bat-signal goes, you did manage to get my attention, but I think only because I was watching this page already as I'd edited it in the past. I don't recall how we had it set up on the old wiki so that admins would get notified when someone added this. I've tried watching the category, but I think that only helps if someone edits the category description, not if they add a new page to the category. Maybe just need to make sure to check the category every once in a while. — λ (talk | contribs) 07:43, 8 November 2016 (PST)
Ah, I see. I was under the impression that initializing and calling a external programming language would be slower for short functions. I just ran some tests; turns out the culprit of all the broken property assignments is the pipe character (|). As one might expect, there is no good way to search and replace a pipe from within a function call. I have figured out a workaround, but it would only work if all of the designer fields were edited to replace "|" with {{!}}. Obviously this is not ideal (and would be a pain). Looks like the Lua method is the only programmatic way. Sorry for the back and forth. Still learning the quirks and tricks of mediawiki syntax... Umjahwa (talk) 10:33, 8 November 2016 (PST)

Oh, I just realized that having access to a proper programing language would allow us to do intelligently calculate the range of Trios needed from input such as "4 Trios per player" and the like. Could be handy for searching! Umjahwa (talk) 15:11, 8 November 2016 (PST)

OK, I believe I have installed Scribunto, along with the code editor and syntax highlighter. Let's see if it works: Hello, World!
Yay, it works! Alright, have fun! See the docs at mw:Extension:Scribunto, mw:Extension:Scribunto/Example modules, and mw:Special:PrefixIndex/Module:λ (talk | contribs) 16:38, 8 November 2016 (PST)
Haha! After a good bit of trial and error I managed to get the Lua scripting to work (although the code is a bit messy). Wiki markup can be displayed in the infobox but is completely scrubbed when mapping to properties. Note: if someone has a redirect to their user page in the designer field, the script will tag their username as well as their print name. I have some quality-of-life options I would like to add but it should be good to go in its current state. I will clean up the documentation and start a wider discussion on desired additions or modifications later, now it is sleep time. Thanks for all of your help! Umjahwa (talk) 20:41, 8 November 2016 (PST)