Create a new article
Write your page title here:
We currently have 223 articles on Farthest Frontier. Type your article name above or create one of the articles listed here!

    Farthest Frontier

    This is the documentation page for Module:WLink

    WLink – Module with functions for strings in context of wikilinks and external links (URL). This module was imported from de:Module:WLink.

    Usage[edit source]

    All functions expect exactly one unnamed parameter (which should be provided to get a meaningful answer). Whitespace ahead and after content is ignored. HTML Entities would not disturb syntax and might be resolved. The parameter might contain single or double bracketed links which would be extracted if appropriate.

    The return value is an empty string (“nothing”), if the parameter value does not fulfil the expectations. If there is a result or the query condition is true, at least one visible character will be returned. The result does not begin or end with a space.

    Convert string by ANSI encoding rather than UTF-8 encoding
    Required for some 20th century servers
    Optional parameter space – encoding of spaces:
    • space=+ – common for query components
    • space=_ – as for Wikis
    • Default: %20
    Create bracketed link, if not yet, from URL or domain
    • [http://example.org/about Homepage] yields [http://example.org/about Homepage]
    • http://example.org/about yields [http://example.org/about example.org/about]
    • example.org yields [http://example.org/ example.org]
    Retrieve generic page title, no fragment nor brackets
    Use current page title, if omitted.
    Retrieve last segment in subpage, no fragment
    Retrieve media extension
    Result is downcased (without leading dot).
    Retrieve media page identifier
    Retrieve original (not decoded) fragment string after #
    Retrieve language identifier
    Retrieve namespace number
    Retrieve text with all links replaced by link titles
    Retrieve project identifier within wikifarm (recommendable brief notation)
    Retrieve first target (wikilink or URL)
    Retrieve first target page (page name or URL of page)
    Same as getTarget if no fragment.
    Retrieve first link title (wikilink or URL), or wikilink target
    Does attempt match a bracketed link?
    Does attempt match a bracketed URL?
    Does attempt match a categorization?
    Does attempt match an external link?
    Does attempt match an interlanguage link?
    Does attempt match an interwiki link?
    Does attempt match a media translusion?
    Does attempt match a titled link?
    Does attempt match a link?
    Does attempt match an external link?
    Does attempt match a wikilink?
    Version ID: 2016-10-05
    optional parameter 1 – required version
    result: empty, if requirement not met

    Examples (test page)[edit source]

    A test page illustrates practical use.

    Functions for Lua modules (API)[edit source]

    All functions described above can be used by other modules:

    local lucky, WLink = pcall( require, "Module:WLink" )
    if type( WLink ) == "table" then
        WLink = WLink.WLink()
        -- failure; WLink is the error message
        return "<span class=\"error\">" .. WLink .. "</span>"

    Subsequently there are available:

    • WLink.ansiPercent(story, space)
    • WLink.formatURL()
    • WLink.getArticleBase()
    • WLink.getBaseTitle()
    • WLink.getExtension()
    • WLink.getFile()
    • WLink.getFragment()
      false, if not found; but empty string if empty fragment.
      No leading # 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 false.
      Components might be, if provided:
      • lead – leading colon : present and required, if true
      • project – project interwiki within wikifarm (recommendable brief notation)
      • lang – known language version (downcased)
      • ns – number of namespace
      • space – local canonical name of namespace
      • title – page title as provided; at least empty string
    • WLink.failsafe(atleast)
      1. atleast
        nil or required version
      returns: string or false

    If succeeding, the WLink.get*() return a string, the WLink.is*() true (if no exception mentioned); on failure always false.

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.