"साचा:TemplateBox" च्या विविध आवृत्यांमधील फरक

Content deleted Content added
छो Protected Module:TemplateBox: Sensitive module used on Template:Navbox ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
छो Documentation
ओळ १:
local p = {}
 
-- Helper function, not exposed
function tobool(st)
if type( st ) == 'string' then
Line ९ ⟶ १०:
end
 
 
-- InterfaceText:
 
-- A free-form string (no wikitext) in the content-language of the wiki, or, an object containing those strings keyed by language code.
 
------------------------------------------------------
----------------- TEMPLATEDATA PART ------------------
------------------------------------------------------
 
-- A "hash" / table of everything TemplateData takes
-- to ease maintenance.
 
-- The type is automatically determined if t is omitted.
-- If the type does not match or can't be converted, an error will be thrown!
-- Available types (LUA-Types with exceptions):
-- InterfaceText, boolean, number, selection, table, string
-- selection*: - requires a selection-string of pipe-separated possibilities to be supplied
-- InterfaceText*: A free-form string (no wikitext) in the content-language of the wiki, or, an object containing those strings keyed by language code.
-- an object containing those strings keyed by language code.
local paraminfoTemplate = {
description = {
Line ८२ ⟶ ९८:
 
-- Initialize param info
-- Avoids having to add redundant information to the preceding tables
function init( which )
local setDefault = function(v)
Line ९८ ⟶ ११५:
init( paraminfoTLParams )
 
-- A real parser/transformer would look differently but it would likely be much more complex
-- The TemplateData-portion for [[Template:TemplateBox]]
function p.templatedata(frame)
-- Load the JSON-Module which will convert LUA tables into valid JSON
-- A real parser would look differently but it would likely be much more complex
local JSON = require('Module:JSON')
-- All kind of strange stuff with the arguments is done, so play safe and make a copy
local pargs = mw.clone( ( frame:getParent() or {} ).args or {} )
-- Array-like table containing all parameter-numbers that were passed
local templateArgs = {}
-- Arguments that are localized (i.e. the user passed 1desc-en=English description of parameter one)
local templateArgsCount = 0
local i18nTemplateArgs = {}
-- Required to determine in which languages the interface texts without langcode are
JSON.strictTypes = true
local contentLangcode = mw.language.getContentLanguage():getCode()
-- Ensure that tables end up as array/object (esp. when they are empty)
JSON.strictTypes = true
local tdata = JSON:decode('{"description":"","params":{},"sets":[]}')
local extractData = function( pi, number )
local prefix = number or ''
Line २१७ ⟶ २४१:
if type( a ) == 'number' then
table.insert( templateArgs, a )
templateArgsCount = templateArgsCount + 1
else
local argSplit = mw.text.split( a, '-', true )
"https://mr.wikipedia.org/wiki/साचा:TemplateBox" पासून हुडकले