Difference between revisions 51774 and 51775 on wikimaniawiki-- This module implements {{documentation}}. -- Get required modules. local getArgs = require('Module:Arguments').getArgs local htmlBuilder = require('Module:HtmlBuilder') local messageBox = require('Module:Message box') local libraryUtil = require('libraryUtil') -- Get the config table. local cfg = mw.loadData('Module:Documentation/config') local p = {} -- Constants. local currentTitle = mw.title.getCurrentTitle() local subjectSpace = mw.site.namespaces[currentTitle.namespace].subject.id -- The number of the current subject namespace. -- Often-used functions. local gsub = mw.ustring.gsub local checkType = libraryUtil.checkType ---------------------------------------------------------------------------- -- Helper functions ---------------------------------------------------------------------------- local function formatMessage(msg, valArray) --[[ -- Formats a message, usually from the cfg table. -- Values from valArray can be specified in the message by using $1 for [1], $2 for [2], etc. -- So formatMessage('Foo $2 bar $1.', {'baz', 'qux'}) will return "Foo qux bar baz." --]] checkType('formatMessage', 1, msg, 'string') checkType('formatMessage', 2, valArray, 'table') local function getMessageVal(match) match = tonumber(match) return valArray[match] or error('formatMessage: No value found for key $' .. match .. '. Message was "' .. msg .. '"', 24) end local ret = gsub(msg, '$([1-9][0-9]*)', getMessageVal) return ret end local function makeWikilink(page, display) (contracted; show full) if subpage == cfg.sandboxSubpage or subpage == cfg.testcasesSubpage then return currentTitle.baseText else return currentTitle.text end end return p All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://wikimania.wikimedia.org/w/index.php?diff=prev&oldid=51775.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|