Module talk:OSM
Appearance
Error with no linktext
@Polyglot: Nice module! This is a really interesting idea. I just noticed that the module will produce an error if you don't supply frame.args.linktext
and the page also has a Wikidata entry. Should there be a default display value instead of a red error message? (Also, maybe "display" or something would be a more elegant parameter name than "linktext"?) Best — Mr. Stradivarius ♪ talk ♪ 06:27, 5 August 2015 (UTC)
- I just saw the error appearing myself. Yesterday all tests were fine, because the Module was only present on nl.WP. I'll have to find a better way to simulate a page with no link to a wikidata entry.
- Oops, you're talking about something else. I considered the linktext parameter as mandatory. This means it can't be used in templates for references though. I guess I'll have some more coding to do... Maybe simply text? I'll add a parameter to have it return simply text without link as well. --Polyglot (talk) 08:59, 5 August 2015 (UTC)
- @Polyglot: If
linktext
is really compulsory, then you could output a more informative error message, e.g.:
- @Polyglot: If
if not frame.args.linktext then
error('No "linktext" argument provided', 2)
end
- Or if you would rather that the error didn't show up in Category:Pages with script errors then you could do the same thing with wikitext:
if not frame.args.linktext then
return '<strong class="wikitext">No "linktext" argument provided</strong>'
end
- Or alternatively you could make the subpage name the default display text:
local display = frame.args.linktext or mw.title.getCurrentTitle().subpageText
- Whichever you think works the best. :) — Mr. Stradivarius ♪ talk ♪ 09:14, 5 August 2015 (UTC)
- Also, I like "linktext" better than "text", although I think "display" is better than both. (That's just my personal preference, though.) — Mr. Stradivarius ♪ talk ♪ 09:24, 5 August 2015 (UTC)