|
|
Line 1: |
Line 1: |
- | <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en"> | + | <span class="nowrap" title="{{#if:{{{popup|}}}||Great stuff}}" style="padding:.2em .6em; border:1px solid; border-color:#aaa #555 #555 #aaa; border-radius:3px; background-color:#ff3300; {{linear-gradient|top|#fcfcfc, #e0e0e0}} {{#ifeq:{{{format|}}}|bold|font-weight:bold;}} {{{style|}}}">{{{text|{{{1|Bad Ability}}}}}}</span><noinclude> |
- | <siteinfo>
| + | |
- | <sitename>Wikimedia Commons</sitename>
| + | |
- | <dbname>commonswiki</dbname>
| + | |
- | <base>https://commons.wikimedia.org/wiki/Main_Page</base>
| + | |
- | <generator>MediaWiki 1.40.0-wmf.22</generator>
| + | |
- | <case>first-letter</case>
| + | |
- | <namespaces>
| + | |
- | <namespace key="-2" case="first-letter">Media</namespace>
| + | |
- | <namespace key="-1" case="first-letter">Special</namespace>
| + | |
- | <namespace key="0" case="first-letter" />
| + | |
- | <namespace key="1" case="first-letter">Talk</namespace>
| + | |
- | <namespace key="2" case="first-letter">User</namespace>
| + | |
- | <namespace key="3" case="first-letter">User talk</namespace>
| + | |
- | <namespace key="4" case="first-letter">Commons</namespace>
| + | |
- | <namespace key="5" case="first-letter">Commons talk</namespace>
| + | |
- | <namespace key="6" case="first-letter">File</namespace>
| + | |
- | <namespace key="7" case="first-letter">File talk</namespace>
| + | |
- | <namespace key="8" case="first-letter">MediaWiki</namespace>
| + | |
- | <namespace key="9" case="first-letter">MediaWiki talk</namespace>
| + | |
- | <namespace key="10" case="first-letter">Template</namespace>
| + | |
- | <namespace key="11" case="first-letter">Template talk</namespace>
| + | |
- | <namespace key="12" case="first-letter">Help</namespace>
| + | |
- | <namespace key="13" case="first-letter">Help talk</namespace>
| + | |
- | <namespace key="14" case="first-letter">Category</namespace>
| + | |
- | <namespace key="15" case="first-letter">Category talk</namespace>
| + | |
- | <namespace key="100" case="first-letter">Creator</namespace>
| + | |
- | <namespace key="101" case="first-letter">Creator talk</namespace>
| + | |
- | <namespace key="102" case="first-letter">TimedText</namespace>
| + | |
- | <namespace key="103" case="first-letter">TimedText talk</namespace>
| + | |
- | <namespace key="104" case="first-letter">Sequence</namespace>
| + | |
- | <namespace key="105" case="first-letter">Sequence talk</namespace>
| + | |
- | <namespace key="106" case="first-letter">Institution</namespace>
| + | |
- | <namespace key="107" case="first-letter">Institution talk</namespace>
| + | |
- | <namespace key="460" case="case-sensitive">Campaign</namespace>
| + | |
- | <namespace key="461" case="case-sensitive">Campaign talk</namespace>
| + | |
- | <namespace key="486" case="first-letter">Data</namespace>
| + | |
- | <namespace key="487" case="first-letter">Data talk</namespace>
| + | |
- | <namespace key="490" case="first-letter">GWToolset</namespace>
| + | |
- | <namespace key="491" case="first-letter">GWToolset talk</namespace>
| + | |
- | <namespace key="828" case="first-letter">Module</namespace>
| + | |
- | <namespace key="829" case="first-letter">Module talk</namespace>
| + | |
- | <namespace key="1198" case="first-letter">Translations</namespace>
| + | |
- | <namespace key="1199" case="first-letter">Translations talk</namespace>
| + | |
- | <namespace key="2300" case="case-sensitive">Gadget</namespace>
| + | |
- | <namespace key="2301" case="case-sensitive">Gadget talk</namespace>
| + | |
- | <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
| + | |
- | <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
| + | |
- | <namespace key="2600" case="first-letter">Topic</namespace>
| + | |
- | </namespaces>
| + | |
- | </siteinfo>
| + | |
- | <page>
| + | |
- | <title>Template:Button</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>21197917</id>
| + | |
- | <revision>
| + | |
- | <id>433785053</id>
| + | |
- | <parentid>228419836</parentid>
| + | |
- | <timestamp>2020-07-18T21:58:28Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>WOSlinker</username>
| + | |
- | <id>528685</id>
| + | |
- | </contributor>
| + | |
- | <comment>radius direct</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="424" xml:space="preserve"><span class="nowrap" title="{{#if:{{{popup|}}}||this is not a clickable button, it illustrates the button to look for}}" style="padding:.2em .6em; border:1px solid; border-color:#aaa #555 #555 #aaa; border-radius:3px; background-color:#f2f2f2; {{linear-gradient|top|#fcfcfc, #e0e0e0}} {{#ifeq:{{{format|}}}|bold|font-weight:bold;}} {{{style|}}}">{{{text|{{{1|the button}}}}}}</span><noinclude>
| + | |
- | {{documentation}}
| + | |
- | </noinclude></text>
| + | |
- | <sha1>2zxdsb5o5crv7s9fxlrrfbii2u8hsnp</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Dir</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>4508797</id>
| + | |
- | <revision>
| + | |
- | <id>699751876</id>
| + | |
- | <parentid>570967563</parentid>
| + | |
- | <timestamp>2022-10-27T23:32:02Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Magog the Ogre</username>
| + | |
- | <id>338609</id>
| + | |
- | </contributor>
| + | |
- | <comment>additions requested by [[User:Verdy_p|Verdy_p]] ([[Special:Permalink/699751110#Updating Module:Dir/RTL overrides and Template:Dir]])</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="1195" xml:space="preserve">{{#switch:{{{1}}}|aaf-arab|aao|abh|abq-arab|abv|ace-arab|acm|acq|acw|acx|acy-arab|adf|ady-arab|aeb|aeb-arab|aec|afb|aic|ajp|apc|apd|ar|ara|arb|arc|arq|ars|ary|arz|auz|avl|ayh|ayl|ayn|ayp|az-arab|azb|bal|bbz|bcc|bej-arab|ber-arab|bft|bgn|bgp|bjm|bjn-arab|bms-arab|bqi|bqp|brh-arab|bsk|cja-arab|cjm-arab|ckb|ckb-arab|crh-arab|deh|dgo-arab|dng-arab|doi-arab|dv|dyu-arab|en-rtl|fa|fa-af|ff-arab|ffm-arab|fub-arab|fuc-arab|fuf-arab|fuh-arab|fui-arab|fuv-arab|gbz-arab|gda|gju-arab|glk|gwc|ha-arab|hac|haz|he|hnd|hno|jat|kbd-arab|kbl-arab|kby-arab|kcn|kfr|khw|kk-arab|kk-cn|kls-arab|kmr-arab|knc-arab|kr-arab|krt-arab|ks|ks-arab|ktl|ku-arab|ky-arab|lad-hebr|lah|lki|lrc|lrk|luz|mad-arab|man-arab|mge-arab|mhj|mki-arab|mne-arab|mnk-arab|mrt-arab|ms-arab|mve|mvy|mwr-arab|mzb|mzn|nqo|ota|pa-arab|pbt|pbu|pga|phl|phn|phr|phv|pnb|prd|prs|ps|pst|raj-arab|rif-arab|rmt-arab|scl|sd|sdb|sdf|sdh|shi-arab|shu|shy-arab|skr|skr-arab|sqr|ssh|su-arab|sw-arab|swh|tg-arab|tig-arab|tk-arab|tly|tly-arab|trw|tt-arab|txj-arab|ug|ug-arab|ur|uz-arab|uzs|wbl|wlc-arab|wne|wni-arab|wo-arab|xhe|xng-arab|xpu|ydd|ydg|yhd|yhd-arab|yhd-hebr|yi|yih|zdj-arab={{{2|rtl}}}|{{{3|ltr}}}}}<noinclude>
| + | |
- | | + | |
- | {{Documentation}}
| + | |
- | | + | |
- | </noinclude></text>
| + | |
- | <sha1>d6bxtsty698mvohoku22d5itays5h7n</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Module:Autotranslate</title>
| + | |
- | <ns>828</ns>
| + | |
- | <id>69441814</id>
| + | |
- | <revision>
| + | |
- | <id>326929091</id>
| + | |
- | <parentid>302995700</parentid>
| + | |
- | <timestamp>2018-11-07T19:35:28Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Jarekt</username>
| + | |
- | <id>164349</id>
| + | |
- | </contributor>
| + | |
- | <minor/>
| + | |
- | <comment>bad instructions in comment</comment>
| + | |
- | <model>Scribunto</model>
| + | |
- | <format>text/plain</format>
| + | |
- | <text bytes="2688" xml:space="preserve"> --[[
| + | |
- | __ __ _ _ _ _ _ _ _
| + | |
- | | \/ | ___ __| |_ _| | ___ _ / \ _ _| |_ ___ | |_ _ __ __ _ _ __ ___| | __ _| |_ ___
| + | |
- | | |\/| |/ _ \ / _` | | | | |/ _ (_) / _ \| | | | __/ _ \| __| '__/ _` | '_ \/ __| |/ _` | __/ _ \
| + | |
- | | | | | (_) | (_| | |_| | | __/_ / ___ \ |_| | || (_) | |_| | | (_| | | | \__ \ | (_| | || __/
| + | |
- | |_| |_|\___/ \__,_|\__,_|_|\___(_)_/ \_\__,_|\__\___/ \__|_| \__,_|_| |_|___/_|\__,_|\__\___|
| + | |
- |
| + | |
- | Authors and maintainers:
| + | |
- | * User:Zolo - original version
| + | |
- | * User:Jarekt
| + | |
- | ]]
| + | |
- | | + | |
- | -- local function to help normalize input arguments
| + | |
- | local function normalize_input_args(input_args, output_args)
| + | |
- | for name, value in pairs( input_args ) do
| + | |
- | if value ~= '' then -- nuke empty strings
| + | |
- | if type(name)=='string' then name=string.lower(name) end -- convert to lower case
| + | |
- | output_args[name] = value
| + | |
- | end
| + | |
- | end
| + | |
- | return output_args
| + | |
- | end
| + | |
- | | + | |
- | -- initialize object to be returned
| + | |
- | local p = {}
| + | |
- | | + | |
- | --[[
| + | |
- | autotranslate
| + | |
- |
| + | |
- | This function is the core part of the Autotranslate template.
| + | |
- |
| + | |
- | Usage from a template:
| + | |
- | {{#invoke:autotranslate|autotranslate|base=|lang= }} | + | |
- |
| + | |
- | Parameters:
| + | |
- | frame.args.base - base page name
| + | |
- | frame.args.lang - desired language (often user's native language)
| + | |
- | | + | |
- | Error Handling:
| + | |
- | | + | |
- | ]]
| + | |
- | function p.autotranslate(frame)
| + | |
- | | + | |
- | -- switch to lowercase parameters to make them case independent
| + | |
- | local args = {}
| + | |
- | args = normalize_input_args(frame:getParent().args, args)
| + | |
- | args = normalize_input_args(frame.args, args)
| + | |
- | | + | |
- | -- get language fallback list
| + | |
- | if not args.lang or not mw.language.isSupportedLanguage(args.lang) then
| + | |
- | args.lang = frame:callParserFunction( "int", "lang" ) -- get user's chosen language
| + | |
- | end
| + | |
- | local langList = mw.language.getFallbacksFor(args.lang)
| + | |
- | table.insert(langList,1,args.lang)
| + | |
- | | + | |
- | -- find base page
| + | |
- | local base = args.base
| + | |
- | args.base = nil
| + | |
- | assert(base and #base>0, 'Base page not provided for autotranslate' )
| + | |
- | if not mw.ustring.find(base,':') then -- if base page does not indicate namespace
| + | |
- | base = 'Template:' .. base -- than assume it is a template
| + | |
- | end
| + | |
- |
| + | |
- | -- find base template language subpage
| + | |
- | local page = args.default -- default page if provided or nil otherwise
| + | |
- | for _, language in ipairs(langList) do
| + | |
- | if mw.title.new(base .. '/' .. language).exists then
| + | |
- | page = base .. '/' .. language -- returns only the page
| + | |
- | break
| + | |
- | end
| + | |
- | end
| + | |
- | assert(page, string.format('No fallback page found for autotranslate (base=[[%s]], lang=%s)', base, args.lang))
| + | |
- |
| + | |
- | -- Transclude {{page |....}} with template arguments the same as the ones passed to {{autotranslate}} template.
| + | |
- | return frame:expandTemplate{ title = page, args = args}
| + | |
- | end
| + | |
- | | + | |
- | return p</text>
| + | |
- | <sha1>s8od7zfrj3v3cz5lt1l0kbteodckiag</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Tlx</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>1062268</id>
| + | |
- | <revision>
| + | |
- | <id>191835619</id>
| + | |
- | <parentid>191820407</parentid>
| + | |
- | <timestamp>2016-04-01T06:12:09Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Logan</username>
| + | |
- | <id>575979</id>
| + | |
- | </contributor>
| + | |
- | <comment>reverting, as this broke the template</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="475" xml:space="preserve">{{[[{{#if:{{{SISTER|}}}|{{{SISTER}}}Template|{{ns:Template}}}}:{{{1|Tlx}}}|{{{1|Tlx}}}]]<!--
| + | |
- | -->{{#if:{{{2|}}}|&#124;{{{2}}}}}<!--
| + | |
- | -->{{#if:{{{3|}}}|&#124;{{{3}}}}}<!--
| + | |
- | -->{{#if:{{{4|}}}|&#124;{{{4}}}}}<!--
| + | |
- | -->{{#if:{{{5|}}}|&#124;{{{5}}}}}<!--
| + | |
- | -->{{#if:{{{6|}}}|&#124;{{{6}}}}}<!--
| + | |
- | -->{{#if:{{{7|}}}|&#124;{{{7}}}}}<!--
| + | |
- | -->{{#if:{{{8|}}}|&#124;{{{8}}}}}<!--
| + | |
- | -->{{#if:{{{9|}}}|&#124;{{{9}}}}}<!--
| + | |
- | -->{{#if:{{{10|}}}|&#124;''...''}}}}<noinclude>
| + | |
- | {{documentation}}
| + | |
- | </noinclude></text>
| + | |
- | <sha1>dkyuacf9wzm1r5s8aabv2b15p4crsez</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Linear-gradient</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>18008944</id>
| + | |
- | <revision>
| + | |
- | <id>355861126</id>
| + | |
- | <parentid>355857104</parentid>
| + | |
- | <timestamp>2019-06-24T00:12:14Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Verdy p</username>
| + | |
- | <id>13466</id>
| + | |
- | </contributor>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="1610" xml:space="preserve"><noinclude> &lt;div style="
| + | |
- | </noinclude>background-image:-moz-linear-gradient({{{1|<noinclude>''start-position''</noinclude>}}},{{{2|<noinclude>''color [stop],...''</noinclude>}}});<noinclude>
| + | |
- | </noinclude>background-image:o-linear-gradient({{{1|<noinclude>''start-position''</noinclude>}}},{{{2|<noinclude>''color [stop],...''</noinclude>}}});<noinclude>
| + | |
- | </noinclude>background-image:-webkit-linear-gradient({{{1|<noinclude>''start-position''</noinclude>}}},{{{2|<noinclude>''color [stop],...''</noinclude>}}});<noinclude>
| + | |
- | </noinclude>background-image:linear-gradient({{#switch:{{{1|<noinclude>''start-position''</noinclude>}}}
| + | |
- | | 360deg| 400grad| 1turn|0rad|
| + | |
- | |-360deg| 0deg|-400grad| 0grad| -1turn| 0turn| bottom = to top
| + | |
- | |-315deg| 45deg|-350grad| 50grad|-.875turn|.125turn|bottom left | left bottom = to top right
| + | |
- | |-270deg| 90deg|-300grad|100grad| -.75turn| .25turn| left = to right
| + | |
- | |-225deg|135deg|-250grad|150grad|-.675turn|.375turn| top left | left top = to bottom right
| + | |
- | |-180deg|180deg|-200grad|200grad| -.5turn| .5turn| top = to bottom
| + | |
- | |-135deg|225deg|-150grad|250grad|-.375turn|.675turn| top right|right top = to bottom left
| + | |
- | | -90deg|270deg|-100grad|300grad| -.25turn| .75turn| right = to left
| + | |
- | | -45deg|315deg| -50grad|350grad|-.125turn|.875turn|bottom right|right bottom = to top left
| + | |
- | |#default={{{1|<noinclude>''start-position''</noinclude>}}}
| + | |
- | }},{{{2|<noinclude>''color [stop],...''</noinclude>}}});<noinclude>
| + | |
- | "&gt;Lorem ipsum...&lt;/div&gt;
| + | |
- | {{Documentation}}</noinclude></text>
| + | |
- | <sha1>cw1va0mnzv2vi50nd5aw8vhg9rhiy9x</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Transclude</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>9456560</id>
| + | |
- | <revision>
| + | |
- | <id>358320724</id>
| + | |
- | <parentid>35437021</parentid>
| + | |
- | <timestamp>2019-07-16T10:41:02Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>4nn1l2</username>
| + | |
- | <id>2002620</id>
| + | |
- | </contributor>
| + | |
- | <minor/>
| + | |
- | <comment>Changed protection level for "[[Template:Transclude]]": downgraded protection level per [[Special:Permalink/357548402|consensus]] ([Move=Allow only template editors and administrators] (indefinite) [Edit=Allow only template editors and administrators] (indefinite))</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="400" xml:space="preserve">{{#switch: {{NAMESPACE: {{{1}}} }}
| + | |
- | |#default = {{FULLPAGENAME: {{{1}}} }} <!-- eg "User:Foo" -->
| + | |
- | |{{ns:0}} =
| + | |
- | {{#ifeq: {{NAMESPACE: {{{1}}} }} | {{NAMESPACE: Template{{{1}}} }}
| + | |
- | | Template:{{{1}}} <!-- no leading colon, eg "Foo" -->
| + | |
- | | {{PAGENAME: {{{1}}} }} <!-- leading colon, eg ":Foo", so we want the article -->
| + | |
- | }}
| + | |
- | }}<noinclude>
| + | |
- | {{documentation}}
| + | |
- | </noinclude></text>
| + | |
- | <sha1>ob9m2b913drxlie5tgekieudupfrl9n</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Tmpl</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>106527425</id>
| + | |
- | <revision>
| + | |
- | <id>578776649</id>
| + | |
- | <parentid>568786754</parentid>
| + | |
- | <timestamp>2021-08-06T17:03:07Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>CptViraj</username>
| + | |
- | <id>7799326</id>
| + | |
- | </contributor>
| + | |
- | <minor/>
| + | |
- | <comment>Protected "[[Template:Tmpl]]": [[Commons:Protection policy|Widely used template]]: [[Special:PermaLink/578762431#Template:Tmpl and Module:Tmpl|Request at COM:ANB]] ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="99" xml:space="preserve"><onlyinclude><includeonly>{{#invoke:Tmpl|renderTmpl}}</includeonly></onlyinclude>
| + | |
- | {{Documentation}}</text>
| + | |
- | <sha1>pd3axhqea7nbo7qxiyq3aicgysk00ym</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Module:Tmpl</title>
| + | |
- | <ns>828</ns>
| + | |
- | <id>106527281</id>
| + | |
- | <revision>
| + | |
- | <id>578776736</id>
| + | |
- | <parentid>568784752</parentid>
| + | |
- | <timestamp>2021-08-06T17:03:50Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>CptViraj</username>
| + | |
- | <id>7799326</id>
| + | |
- | </contributor>
| + | |
- | <minor/>
| + | |
- | <comment>Protected "[[Module:Tmpl]]": [[Commons:Protection policy|High-risk Lua module]]: [[Special:PermaLink/578762431#Template:Tmpl and Module:Tmpl|Request at COM:ANB]] ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))</comment>
| + | |
- | <model>Scribunto</model>
| + | |
- | <format>text/plain</format>
| + | |
- | <text bytes="437" xml:space="preserve">-- This is a helper module for Template:tmpl
| + | |
- | local this = {}
| + | |
- | | + | |
- | function this.renderTmpl(frame)
| + | |
- | local args = frame.args
| + | |
- | local pargs = (frame:getParent() or {}).args
| + | |
- | local result = pargs[0] or ''
| + | |
- | for k, v in pairs(pargs) do
| + | |
- | local n = tonumber(k) or -1
| + | |
- | if (n >= 1 and n <= 9) then
| + | |
- | result = mw.ustring.gsub( result, '$' .. n, mw.text.trim(v) )
| + | |
- | end
| + | |
- | end
| + | |
- | return result
| + | |
- | end
| + | |
- | | + | |
- | return this</text>
| + | |
- | <sha1>ep2bcs460ax2usm6nvg7v90dlm9e09v</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Documentation</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>26353596</id>
| + | |
- | <revision>
| + | |
- | <id>710268397</id>
| + | |
- | <parentid>710061475</parentid>
| + | |
- | <timestamp>2022-11-27T20:49:57Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Tacsipacsi</username>
| + | |
- | <id>1998184</id>
| + | |
- | </contributor>
| + | |
- | <comment>Undo revision 710061475 by [[Special:Contributions/Sarang|Sarang]] ([[User talk:Sarang|talk]]): undocumented, unused parameter. This is not a sandbox, this is the LIVE template.</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="726" xml:space="preserve"><!-- {{#invoke:Autotranslate|autotranslate}} is used to avoid "Warning: This page calls Template:Autotranslate which causes a template loop (an infinite recursive call). "-->
| + | |
- | <onlyinclude>{{#invoke:Autotranslate|autotranslate
| + | |
- | | base = Template:Documentation/i18n
| + | |
- | |lang = {{{lang|{{int:Lang}} }}}
| + | |
- | |1 = {{#if:{{{1|}}}
| + | |
- | |{{{1}}}
| + | |
- | |{{#ifexist:{{SUBJECTPAGENAME}}/doc
| + | |
- | |{{SUBJECTPAGENAME}}/doc
| + | |
- | |{{#ifexist:{{#titleparts:{{SUBJECTPAGENAME}}|-1}}/doc
| + | |
- | |{{#titleparts:{{SUBJECTPAGENAME}}|-1}}/doc
| + | |
- | |{{SUBJECTPAGENAME}}/doc
| + | |
- | }}
| + | |
- | }}
| + | |
- | }}
| + | |
- | |2 = {{{heading|{{{2|}}} }}}
| + | |
- | |content = {{{content|}}}
| + | |
- | }}</onlyinclude></text>
| + | |
- | <sha1>eci5tevagu64g1pdamaseb2nj1i28lz</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Documentation/i18n/en</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>6324044</id>
| + | |
- | <revision>
| + | |
- | <id>595568821</id>
| + | |
- | <parentid>592024682</parentid>
| + | |
- | <timestamp>2021-10-04T12:10:56Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>ExE Boss</username>
| + | |
- | <id>2717823</id>
| + | |
- | </contributor>
| + | |
- | <comment>Updating to match new version of source page: Use <[[mw:Special:MyLanguage/Help:Transclusion#<onlyinclude>|onlyinclude]]> and {{[[Template:tmpl|tmpl]]}}</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="624" xml:space="preserve"><languages/>
| + | |
- | <onlyinclude>{{Documentation/layout
| + | |
- | | lang = {{{lang|{{#invoke:Caller title|lang|base=Template:Documentation/i18n}}}}}
| + | |
- | <!-- {{Documentation}} parameters: -->
| + | |
- | |1={{{1|}}}
| + | |
- | |heading={{{heading|{{{2|}}}}}}
| + | |
- | |content={{{content|}}}
| + | |
- | <!-- $1 is automatically replaced by [[Template:Documentation/layout]] using {{tmpl}} -->
| + | |
- | | text = This documentation is [[w:Wikipedia:Transclusion|transcluded]] from $1.
| + | |
- | <!-- DEPRECATED - New translations for these messages go in [[Data:I18n/Documentation.tab]]: -->
| + | |
- | |edit=edit
| + | |
- | |history=history
| + | |
- | |view=view
| + | |
- | |documentation=Documentation
| + | |
- | }}</onlyinclude>
| + | |
- | {{translated tag|documentation}}</text>
| + | |
- | <sha1>69h44ltg592l5fip020y33w80i9cu1v</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Documentation/layout</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>6324034</id>
| + | |
- | <revision>
| + | |
- | <id>595566422</id>
| + | |
- | <parentid>583896810</parentid>
| + | |
- | <timestamp>2021-10-04T11:56:10Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>ExE Boss</username>
| + | |
- | <id>2717823</id>
| + | |
- | </contributor>
| + | |
- | <comment>Use [[Module:TNTFallback]]</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="3117" xml:space="preserve"><div id="template-documentation" class="template-documentation"><templatestyles src="Template:Documentation/styles.css" /><!--
| + | |
- | -->{{#if: {{PROTECTIONLEVEL:edit}} | {{Protected}} }}<!--
| + | |
- | -->{{#ifeq: {{{heading|}}} | false |
| + | |
- | | <div class="template-documentation-heading mw-content-{{dir|{{{lang|}}}}}" lang="{{{lang|}}}" dir="{{dir|{{{lang|}}}}}"><!--
| + | |
- | --><span class="template-documentation-title">{{#if: {{{heading|}}}
| + | |
- | | {{{heading|}}}
| + | |
- | | [[File:Test Template Info-Icon.svg|50px|link=|alt=]] {{#switch:{{NAMESPACENUMBER}}
| + | |
- | | 6 = {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|file-namespace-heading|fallback={{{documentation|}}}}}
| + | |
- | | 10 = {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|template-namespace-heading|fallback={{{documentation|}}}}}
| + | |
- | | 828 = {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|module-namespace-heading|fallback={{{documentation|}}}}}
| + | |
- | | #default = {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|other-namespaces-heading|fallback={{{documentation|}}}}}
| + | |
- | }}
| + | |
- | }}</span><span class="mw-editsection-like plainlinks" id="doc_editlinks"><!--
| + | |
- | -->&#91;&nbsp;{{#if:{{{content|}}}||{{#ifexist:{{transclude|{{{1|{{DocPageName}}}}}}}|<!--
| + | |
- | -->[{{fullurl:{{transclude|{{{1|{{DocPageName}}}}}}}}} {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|view-link-display|fallback={{{view|}}}}}]&nbsp;'''·''' <!--
| + | |
- | -->[{{fullurl:{{transclude|{{{1|{{DocPageName}}}}}}}|action=edit}} {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|edit-link-display|fallback={{{edit|}}}}}]&nbsp;'''·''' <!--
| + | |
- | -->[{{fullurl:{{transclude|{{{1|{{DocPageName}}}}}}}|action=history}} {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|history-link-display|fallback={{{history|}}}}}]&nbsp;'''·''' <!--
| + | |
- | --><nowiki/>|<!--
| + | |
- | -->[{{fullurl:{{transclude|{{{1|{{DocPageName}}}}}}}|action=edit&preload=Template:Documentation/preload}} {{#invoke:TNT|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|create-link-display}}]&nbsp;'''·''' <!--
| + | |
- | --><nowiki/>}}}}<!--
| + | |
- | -->[{{fullurl:{{FULLPAGENAME}}|action=purge}} {{#invoke:TNTFallback|msg|lang={{{lang|{{int:lang}}}}}|I18n/Documentation.tab|purge-link-display|fallback={{{purge|}}}}}]<!--
| + | |
- | -->&nbsp;&#93;</span></div>
| + | |
- | }}
| + | |
- | {{#if: {{{content|}}}
| + | |
- | | <!-- do not show notice when /doc is not transcluded-->
| + | |
- | <div class="template-documentation-content" lang="" dir="auto">
| + | |
- | {{{content|}}}
| + | |
- | </div>
| + | |
- | | <div class="template-documentation-transcludedfrom mw-content-{{dir|{{{lang|}}}}}" lang="{{{lang|}}}" dir="{{dir|{{{lang|}}}}}">{{tmpl<!--
| + | |
- | -->|0={{{text|(text: $1) &mdash; {{error|parameter text is not translated in [[Template:Documentation]]}}}}}<!--
| + | |
- | -->|1=[[{{transclude|{{{1|{{DocPageName}}}}}}}]]<!--
| + | |
- | -->}}</div>
| + | |
- | <div class="template-documentation-content" lang="" dir="auto">
| + | |
- | {{ {{{1|{{DocPageName}}}}} }}
| + | |
- | </div>
| + | |
- | }}
| + | |
- | </div><noinclude>
| + | |
- | {{#ifeq: {{SUBPAGENAME}} | sandbox | [[Category:Sandbox templates]] }}
| + | |
- | [[Category:Layout templates]]
| + | |
- | </noinclude></text>
| + | |
- | <sha1>osks67b6xf43g1w9fxcjodnhi4f7w2j</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Documentation/styles.css</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>79561144</id>
| + | |
- | <revision>
| + | |
- | <id>362247927</id>
| + | |
- | <parentid>360699817</parentid>
| + | |
- | <timestamp>2019-08-16T10:34:50Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Kwj2772</username>
| + | |
- | <id>190102</id>
| + | |
- | </contributor>
| + | |
- | <minor/>
| + | |
- | <comment>Protected "[[Template:Documentation/styles.css]]": [[Commons:Protection policy|Widely used template]] ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))</comment>
| + | |
- | <model>sanitized-css</model>
| + | |
- | <format>text/css</format>
| + | |
- | <text bytes="461" xml:space="preserve">.template-documentation {
| + | |
- | margin-top: 1em;
| + | |
- | clear: both;
| + | |
- | border: 2px dotted #666;
| + | |
- | padding: 0.6em;
| + | |
- | background-color: #ecfcf4;
| + | |
- | }
| + | |
- | .template-documentation:after {
| + | |
- | content: "";
| + | |
- | display: block;
| + | |
- | clear: both;
| + | |
- | }
| + | |
- | .template-documentation-heading {
| + | |
- | padding-bottom: 3px;
| + | |
- | border-bottom: 1px solid #a2a9b1;
| + | |
- | margin-bottom: 1ex;
| + | |
- | }
| + | |
- | .template-documentation-title {
| + | |
- | font-size: 150%;
| + | |
- | }
| + | |
- | .template-documentation-transcludedfrom {
| + | |
- | font-size: smaller;
| + | |
- | font-style: italic;
| + | |
- | }</text>
| + | |
- | <sha1>h868x8ure6yjgqibg8igavya6ijo6tm</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Documentation subpage</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>26352739</id>
| + | |
- | <revision>
| + | |
- | <id>591762713</id>
| + | |
- | <parentid>587685640</parentid>
| + | |
- | <timestamp>2021-09-17T09:03:17Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>ExE Boss</username>
| + | |
- | <id>2717823</id>
| + | |
- | </contributor>
| + | |
- | <comment>Fullfilling my [[c:Template talk:Documentation subpage#Use namespaced categories|edit request]]: Use namespaced categories ([[:Category:Template documentation]], [[:Category:Module documentation]], and [[:Category:User documentation]])</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="707" xml:space="preserve"><includeonly><!--
| + | |
- | -->{{#ifeq:{{SUBPAGENAME}}|{{#ifeq:{{{1|}}}|override|{{SUBPAGENAME}}|doc}}|</includeonly><!-- show on doc pages only
| + | |
- | -->{{#invoke:Autotranslate | autotranslate
| + | |
- | |base = Documentation subpage
| + | |
- | |lang = {{{lang|}}}
| + | |
- | |page = {{#if:{{{page|}}}|{{{page|}}}|{{SUBJECTSPACE}}:{{BASEPAGENAME}}}}
| + | |
- | }}<!--
| + | |
- | --><includeonly>{{{category|[[Category:{{#switch:{{SUBJECTSPACE}}
| + | |
- | | Template = Template
| + | |
- | | Module = Module
| + | |
- | | User = User
| + | |
- | | #default = Template
| + | |
- | }} documentation|{{PAGENAME}}]]__EXPECTED_UNCONNECTED_PAGE__}}}</includeonly><!--
| + | |
- | --><includeonly>}}</includeonly><!-- show on doc pages only
| + | |
- | --><noinclude>{{documentation}}</noinclude></text>
| + | |
- | <sha1>e1m6vc2tdw71dgnw3k58bhv9fdxxadi</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Module:TNTFallback</title>
| + | |
- | <ns>828</ns>
| + | |
- | <id>110706998</id>
| + | |
- | <revision>
| + | |
- | <id>699362934</id>
| + | |
- | <parentid>597010902</parentid>
| + | |
- | <timestamp>2022-10-26T16:11:23Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Jonesey95</username>
| + | |
- | <id>2266634</id>
| + | |
- | </contributor>
| + | |
- | <comment>require strict per TPER</comment>
| + | |
- | <model>Scribunto</model>
| + | |
- | <format>text/plain</format>
| + | |
- | <text bytes="1909" xml:space="preserve">--------------------------------------------------------------------------------
| + | |
- | -- This module implements a wrapper for [[Module:TNT]] that allows returning
| + | |
- | -- a fallback message; used by {{Documentation}}.
| + | |
- | --
| + | |
- | -- @module TNTFallback
| + | |
- | -- @alias p
| + | |
- | -- @author [[User:ExE Boss]]
| + | |
- | -- @require [[Module:No globals]]
| + | |
- | -- @require [[Module:TNT]]
| + | |
- | --------------------------------------------------------------------------------
| + | |
- | | + | |
- | require("strict");
| + | |
- | local TNT = require("Module:TNT");
| + | |
- | | + | |
- | local p = {};
| + | |
- | | + | |
- | --------------------------------------------------------------------------------
| + | |
- | -- Based on [[Module:TNT]]'s `msg` function,
| + | |
- | -- but takes an optional `fallback` parameter.
| + | |
- | --------------------------------------------------------------------------------
| + | |
- | function p.msg(frame)
| + | |
- | local dataset, key;
| + | |
- | local params = { n = 0 };
| + | |
- | local lang = nil;
| + | |
- | local fallback = nil;
| + | |
- | | + | |
- | for k, v in pairs(frame.args) do
| + | |
- | if (k == 1) then
| + | |
- | dataset = v;
| + | |
- | elseif (k == 2) then
| + | |
- | key = v;
| + | |
- | elseif (type(k) == "number" and k > 2) then
| + | |
- | local i = k - 2;
| + | |
- | params[i] = v;
| + | |
- | params.n = math.max(params.n, i);
| + | |
- | elseif ((k == "lang") and (v ~= "_")) then
| + | |
- | lang = v;
| + | |
- | elseif ((k == "fallback") and (v ~= "")) then
| + | |
- | fallback = v;
| + | |
- | end
| + | |
- | end
| + | |
- | | + | |
- | local result;
| + | |
- | if (lang) then
| + | |
- | result = TNT.formatInLanguage(lang, dataset, key, unpack(params, 1, params.n));
| + | |
- | else
| + | |
- | result = TNT.format(dataset, key, unpack(params, 1, params.n));
| + | |
- | end
| + | |
- | | + | |
- | if (fallback and (
| + | |
- | -- not translated
| + | |
- | (result and result == TNT.formatInLanguage("en", dataset, key, unpack(params, 1, params.n)))
| + | |
- | -- no message
| + | |
- | or (not result)
| + | |
- | )) then
| + | |
- | if (not lang) then
| + | |
- | if (frame:callParserFunction("int:lang") ~= "en") then
| + | |
- | return mw.message.newRawMessage(fallback, unpack(params, 1, params.n)):plain();
| + | |
- | end
| + | |
- | elseif (lang ~= "en") then
| + | |
- | return mw.message.newRawMessage(fallback, unpack(params, 1, params.n)):plain();
| + | |
- | end
| + | |
- | end
| + | |
- | | + | |
- | return result;
| + | |
- | end
| + | |
- | | + | |
- | return p;</text>
| + | |
- | <sha1>izvc5dfq9gm4cs3usy8e4s3mli1hhiu</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Module:TNT</title>
| + | |
- | <ns>828</ns>
| + | |
- | <id>54808843</id>
| + | |
- | <revision>
| + | |
- | <id>439418106</id>
| + | |
- | <parentid>415588695</parentid>
| + | |
- | <timestamp>2020-08-14T13:52:16Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Jarekt</username>
| + | |
- | <id>164349</id>
| + | |
- | </contributor>
| + | |
- | <minor/>
| + | |
- | <comment>Protected "[[Module:TNT]]": [[Commons:Protection policy|High-risk Lua module]] ([Edit=Allow only template editors and administrators] (indefinite) [Move=Allow only template editors and administrators] (indefinite))</comment>
| + | |
- | <model>Scribunto</model>
| + | |
- | <format>text/plain</format>
| + | |
- | <text bytes="6220" xml:space="preserve">--
| + | |
- | -- INTRO: (!!! DO NOT RENAME THIS PAGE !!!)
| + | |
- | -- This module allows any template or module to be copy/pasted between
| + | |
- | -- wikis without any translation changes. All translation text is stored
| + | |
- | -- in the global Data:*.tab pages on Commons, and used everywhere.
| + | |
- | --
| + | |
- | -- SEE: https://www.mediawiki.org/wiki/Multilingual_Templates_and_Modules
| + | |
- | --
| + | |
- | -- ATTENTION:
| + | |
- | -- Please do NOT rename this module - it has to be identical on all wikis.
| + | |
- | -- This code is maintained at https://www.mediawiki.org/wiki/Module:TNT
| + | |
- | -- Please do not modify it anywhere else, as it may get copied and override your changes.
| + | |
- | -- Suggestions can be made at https://www.mediawiki.org/wiki/Module_talk:TNT
| + | |
- | --
| + | |
- | -- DESCRIPTION:
| + | |
- | -- The "msg" function uses a Commons dataset to translate a message
| + | |
- | -- with a given key (e.g. source-table), plus optional arguments
| + | |
- | -- to the wiki markup in the current content language.
| + | |
- | -- Use lang=xx to set language. Example:
| + | |
- | --
| + | |
- | -- {{#invoke:TNT | msg
| + | |
- | -- | I18n/Template:Graphs.tab <!-- https://commons.wikimedia.org/wiki/Data:I18n/Template:Graphs.tab -->
| + | |
- | -- | source-table <!-- uses a translation message with id = "source-table" -->
| + | |
- | -- | param1 }} <!-- optional parameter -->
| + | |
- | --
| + | |
- | --
| + | |
- | -- The "doc" function will generate the <templatedata> parameter documentation for templates.
| + | |
- | -- This way all template parameters can be stored and localized in a single Commons dataset.
| + | |
- | -- NOTE: "doc" assumes that all documentation is located in Data:Templatedata/* on Commons.
| + | |
- | --
| + | |
- | -- {{#invoke:TNT | doc | Graph:Lines }}
| + | |
- | -- uses https://commons.wikimedia.org/wiki/Data:Templatedata/Graph:Lines.tab
| + | |
- | -- if the current page is Template:Graph:Lines/doc
| + | |
- | --
| + | |
- | | + | |
- | local p = {}
| + | |
- | local i18nDataset = 'I18n/Module:TNT.tab'
| + | |
- | | + | |
- | -- Forward declaration of the local functions
| + | |
- | local sanitizeDataset, loadData, link, formatMessage
| + | |
- | | + | |
- | function p.msg(frame)
| + | |
- | local dataset, id
| + | |
- | local params = {}
| + | |
- | local lang = nil
| + | |
- | for k, v in pairs(frame.args) do
| + | |
- | if k == 1 then
| + | |
- | dataset = mw.text.trim(v)
| + | |
- | elseif k == 2 then
| + | |
- | id = mw.text.trim(v)
| + | |
- | elseif type(k) == 'number' then
| + | |
- | table.insert(params, mw.text.trim(v))
| + | |
- | elseif k == 'lang' and v ~= '_' then
| + | |
- | lang = mw.text.trim(v)
| + | |
- | end
| + | |
- | end
| + | |
- | return formatMessage(dataset, id, params, lang)
| + | |
- | end
| + | |
- | | + | |
- | -- Identical to p.msg() above, but used from other lua modules
| + | |
- | -- Parameters: name of dataset, message key, optional arguments
| + | |
- | -- Example with 2 params: format('I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
| + | |
- | function p.format(dataset, key, ...)
| + | |
- | local checkType = require('libraryUtil').checkType
| + | |
- | checkType('format', 1, dataset, 'string')
| + | |
- | checkType('format', 2, key, 'string')
| + | |
- | return formatMessage(dataset, key, {...})
| + | |
- | end
| + | |
- | | + | |
- | | + | |
- | -- Identical to p.msg() above, but used from other lua modules with the language param
| + | |
- | -- Parameters: language code, name of dataset, message key, optional arguments
| + | |
- | -- Example with 2 params: formatInLanguage('es', I18n/Module:TNT', 'error_bad_msgkey', 'my-key', 'my-dataset')
| + | |
- | function p.formatInLanguage(lang, dataset, key, ...)
| + | |
- | local checkType = require('libraryUtil').checkType
| + | |
- | checkType('formatInLanguage', 1, lang, 'string')
| + | |
- | checkType('formatInLanguage', 2, dataset, 'string')
| + | |
- | checkType('formatInLanguage', 3, key, 'string')
| + | |
- | return formatMessage(dataset, key, {...}, lang)
| + | |
- | end
| + | |
- | | + | |
- | -- Obsolete function that adds a 'c:' prefix to the first param.
| + | |
- | -- "Sandbox/Sample.tab" -> 'c:Data:Sandbox/Sample.tab'
| + | |
- | function p.link(frame)
| + | |
- | return link(frame.args[1])
| + | |
- | end
| + | |
- | | + | |
- | function p.doc(frame)
| + | |
- | local dataset = 'Templatedata/' .. sanitizeDataset(frame.args[1])
| + | |
- | return frame:extensionTag('templatedata', p.getTemplateData(dataset)) ..
| + | |
- | formatMessage(i18nDataset, 'edit_doc', {link(dataset)})
| + | |
- | end
| + | |
- | | + | |
- | function p.getTemplateData(dataset)
| + | |
- | -- TODO: add '_' parameter once lua starts reindexing properly for "all" languages
| + | |
- | local data = loadData(dataset)
| + | |
- | local names = {}
| + | |
- | for _, field in pairs(data.schema.fields) do
| + | |
- | table.insert(names, field.name)
| + | |
- | end
| + | |
- | | + | |
- | local params = {}
| + | |
- | local paramOrder = {}
| + | |
- | for _, row in pairs(data.data) do
| + | |
- | local newVal = {}
| + | |
- | local name = nil
| + | |
- | for pos, val in pairs(row) do
| + | |
- | local columnName = names[pos]
| + | |
- | if columnName == 'name' then
| + | |
- | name = val
| + | |
- | else
| + | |
- | newVal[columnName] = val
| + | |
- | end
| + | |
- | end
| + | |
- | if name then
| + | |
- | params[name] = newVal
| + | |
- | table.insert(paramOrder, name)
| + | |
- | end
| + | |
- | end
| + | |
- | | + | |
- | -- Work around json encoding treating {"1":{...}} as an [{...}]
| + | |
- | params['zzz123']=''
| + | |
- | | + | |
- | local json = mw.text.jsonEncode({
| + | |
- | params=params,
| + | |
- | paramOrder=paramOrder,
| + | |
- | description=data.description
| + | |
- | })
| + | |
- | | + | |
- | json = string.gsub(json,'"zzz123":"",?', "")
| + | |
- | | + | |
- | return json
| + | |
- | end
| + | |
- | | + | |
- | -- Local functions
| + | |
- | | + | |
- | sanitizeDataset = function(dataset)
| + | |
- | if not dataset then
| + | |
- | return nil
| + | |
- | end
| + | |
- | dataset = mw.text.trim(dataset)
| + | |
- | if dataset == '' then
| + | |
- | return nil
| + | |
- | elseif string.sub(dataset,-4) ~= '.tab' then
| + | |
- | return dataset .. '.tab'
| + | |
- | else
| + | |
- | return dataset
| + | |
- | end
| + | |
- | end
| + | |
- | | + | |
- | loadData = function(dataset, lang)
| + | |
- | dataset = sanitizeDataset(dataset)
| + | |
- | if not dataset then
| + | |
- | error(formatMessage(i18nDataset, 'error_no_dataset', {}))
| + | |
- | end
| + | |
- | | + | |
- | -- Give helpful error to thirdparties who try and copy this module.
| + | |
- | if not mw.ext or not mw.ext.data or not mw.ext.data.get then
| + | |
- | error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset)
| + | |
- | end
| + | |
- | | + | |
- | local data = mw.ext.data.get(dataset, lang)
| + | |
- | | + | |
- | if data == false then
| + | |
- | if dataset == i18nDataset then
| + | |
- | -- Prevent cyclical calls
| + | |
- | error('Missing Commons dataset ' .. i18nDataset)
| + | |
- | else
| + | |
- | error(formatMessage(i18nDataset, 'error_bad_dataset', {link(dataset)}))
| + | |
- | end
| + | |
- | end
| + | |
- | return data
| + | |
- | end
| + | |
- | | + | |
- | -- Given a dataset name, convert it to a title with the 'commons:data:' prefix
| + | |
- | link = function(dataset)
| + | |
- | return 'c:Data:' .. mw.text.trim(dataset or '')
| + | |
- | end
| + | |
- | | + | |
- | formatMessage = function(dataset, key, params, lang)
| + | |
- | for _, row in pairs(loadData(dataset, lang).data) do
| + | |
- | local id, msg = unpack(row)
| + | |
- | if id == key then
| + | |
- | local result = mw.message.newRawMessage(msg, unpack(params or {}))
| + | |
- | return result:plain()
| + | |
- | end
| + | |
- | end
| + | |
- | if dataset == i18nDataset then
| + | |
- | -- Prevent cyclical calls
| + | |
- | error('Invalid message key "' .. key .. '"')
| + | |
- | else
| + | |
- | error(formatMessage(i18nDataset, 'error_bad_msgkey', {key, link(dataset)}))
| + | |
- | end
| + | |
- | end
| + | |
- | | + | |
- | return p</text>
| + | |
- | <sha1>icfixo3zxiew6gqg3s5h19xr03x3wkh</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | <page>
| + | |
- | <title>Template:Button/doc</title>
| + | |
- | <ns>10</ns>
| + | |
- | <id>21197931</id>
| + | |
- | <revision>
| + | |
- | <id>570832290</id>
| + | |
- | <parentid>115777626</parentid>
| + | |
- | <timestamp>2021-06-23T11:46:24Z</timestamp>
| + | |
- | <contributor>
| + | |
- | <username>Vis M</username>
| + | |
- | <id>1738683</id>
| + | |
- | </contributor>
| + | |
- | <comment>/* See also */</comment>
| + | |
- | <model>wikitext</model>
| + | |
- | <format>text/x-wiki</format>
| + | |
- | <text bytes="1187" xml:space="preserve">{{Documentation subpage}}
| + | |
- | <!-- Categories and interwikis go at the bottom of this page. -->
| + | |
- | | + | |
- | This template provides a "clickable button" formatting style for text. It is '''''not''''' clickable, and care should be taken when using it to avoid readers thinking the result may be. (It has an explanatory [[:en:tooltip|tooltip]] for users hovering over it, but that may not always be displayed, or only displayed after too long a delay, so that it may not show up to people trying to click it.)
| + | |
- | | + | |
- | === Usage ===
| + | |
- | * {{tlx|1=Button|2=text=button&nbsp;text}} produces {{Button|text=button text}}
| + | |
- | * {{tlx|1=Button|2=text=button&nbsp;text|3=format=bold}} produces {{Button|text=button text|format=bold}}
| + | |
- | Alternatively, {{tlx|1=Button|2=button&nbsp;text}} also produces {{Button|button text}}
| + | |
- | | + | |
- | === See also ===
| + | |
- | *{{tlx|key press}} – used to illustrate keystrokes
| + | |
- | *{{tlx|clickable button}} – a button that '''''is''''' clickable
| + | |
- | *{{tlx|clickable button 2}} – a button that '''''is''''' clickable (de.wikipedia imported)
| + | |
- | *{{tlx|clickable button 3}} - mw.ui.buttons
| + | |
- | | + | |
- | <includeonly>
| + | |
- | <!-- Interwikis go on Wikidata, please add only Categories here -->
| + | |
- | [[Category:Formatting templates]]
| + | |
- | </includeonly></text>
| + | |
- | <sha1>77zminfnl63ksjm32e5o0lhr9eryutu</sha1>
| + | |
- | </revision>
| + | |
- | </page>
| + | |
- | </mediawiki>
| + | |