Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:WLink/doc
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Functions for Lua modules (API) == {{anchor|Lua}} All functions described above can be used by other modules: <syntaxhighlight lang="lua"> local lucky, WLink = pcall( require, "Module:WLink" ) if type( WLink ) == "table" then WLink = WLink.WLink() else -- failure; WLink is the error message return "<span class=\"error\">" .. WLink .. "</span>" end </syntaxhighlight> Subsequently there are available: * WLink.ansiPercent(story, space) * WLink.formatURL() * WLink.getArticleBase() * WLink.getBaseTitle() * WLink.getExtension() * WLink.getFile() * WLink.getFragment() *: <code>false</code>, if not found; but empty string if empty fragment. *: No leading <code>#</code> in result. * WLink.getLanguage() * WLink.getNamespace() * WLink.getPlain() * WLink.getProject() * WLink.getTarget() * WLink.getTargetPage() * WLink.getTitle() * WLink.isBracketedLink() * WLink.isBracketedURL() * WLink.isCategorization() * WLink.isExternalLink() * WLink.isInterlanguage() * WLink.isInterwiki() * WLink.isMedia() * WLink.isTitledLink() * WLink.isValidLink() * WLink.isWeblink() * WLink.isWikilink() * WLink.wikilink() *: Yields ''table'' with wikilink components, else <code>false</code>. *: Components might be, if provided: *:* <code>lead</code> β leading colon <code>:</code> present and required, if <code>true</code> *:* <code>project</code> β project interwiki within wikifarm (recommendable brief notation) *:* <code>lang</code> β known language version (downcased) *:* <code>ns</code> β number of namespace *:* <code>space</code> β local canonical name of namespace *:* <code>title</code> β page title as provided; at least empty string * WLink.failsafe(atleast) *:# atleast<br />''optional''<br />''nil'' or required version *: returns: ''string'' or ''false'' If succeeding, the ''WLink.get*()'' return a string, the ''WLink.is*()'' <code>true</code> (if no exception mentioned); on failure always <code>false</code>.
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)