Module talk:WikidataIB/Archive 7: Difference between revisions

Content deleted Content added
m Archiving 1 discussion(s) from Module talk:WikidataIB) (bot
m Replaced deprecated <source> tags with <syntaxhighlight> (via WP:JWB)
Line 8:
Since the function already references [[Module:URL]], a much better way to do it would be to just reuse what the Module exports. The block starting with {{code|p.url2}} should be rewritten as:
 
<sourcesyntaxhighlight lang=lua>
local fmt_url = require([[Module:URL]])._url -- put this near the top
 
Line 28:
return fmt_url(url or txt) .. (icon and '&nbsp;' .. icon or "")
end
</sourcesyntaxhighlight> [[User:Artoria2e5|Artoria]][[User talk:Artoria2e5|2e5]] <small style="font-weight:lighter">[[Special:Contributions/Artoria2e5|🌉]]</small> 12:37, 15 July 2020 (UTC)
:
: The module doesn't currently reference [[Module:URL]] and it's preferable to reduce the number of external dependencies, rather than increase them unnecessarily. One of the issues with using {{tl|URL}} which prompted the fork to {{tl|URL2}} was that passing a blank url causes an error message by default in URL, but not in URL2: