Module:Plain text and Template:Resloc: Difference between pages

From ZeldaMods (Breath of the Wild)
(Difference between pages)
Jump to navigation Jump to search
(gah fix)
 
imported>Leoetlino
(Created page with "{{Ambox | name = Resloc | subst = <includeonly>{{subst:substcheck}}</includeonly> | small = {{{small|}}} | type = info | image = none | text = This {{{type|resource}}} can...")
 
Line 1: Line 1:
--converts text with wikilinks to plain text, e.g "[[foo|gah]] is [[bar]]" to "gah is bar"
{{Ambox
--removes anything enclosed in tags that isn't nested, mediawiki strip markers (references etc), files, italic and bold markup
| name  = Resloc
local p = {}
| subst = <includeonly>{{subst:substcheck}}</includeonly>
| small = {{{small|}}}
| type  = info
| image = none
| text  = This {{{type|resource}}} can be found at {{{parentpath}}} in version {{{version|1.5.0}}}.
}}


function p.main(frame)
<noinclude>
local text = frame.args[1]
<templatedata>
return p._main(text)
{
end
"params": {
 
"small": {},
function p._main(text)
"type": {
if not text then return end
"type": "string",
text = mw.text.killMarkers(text)
"default": "resource"
:gsub('<span class="nowrap">(.+)</span>', '%1') --remove nowrap while keeping text inside
},
:gsub('<br ?/?>', ', ') --replace br with commas
"parentpath": {
:gsub('<.->.-<.->', '') --strip out tags
"type": "string",
:gsub('%[%[%s*[Ff]ile%s*:.-%]%]', '') --strip out files
"required": true
:gsub('%[%[%s*[Ii]mage%s*:.-%]%]', '') --strip out use of image:
},
:gsub('%[%[%s*[Cc]ategory%s*:.-%]%]', '') --strip out categories
"version": {
:gsub('%[%[[^%]]-|', '') --strip out piped link text
"type": "string"
:gsub('[%[%]]', '') --then strip out remaining [ and ]
}
:gsub("'''''", "") --strip out bold italic markup
},
:gsub("'''?", "") --not stripping out '''' gives correct output for bolded text in quotes
"description": "Notice template that shows the location of a resource",
return text
"format": "inline"
end
}
 
</templatedata>
return p
</noinclude>

Revision as of 13:21, 3 September 2018


Notice template that shows the location of a resource

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
smallsmall

no description

Unknownoptional
typetype

no description

Default
resource
Stringoptional
parentpathparentpath

no description

Stringrequired
versionversion

no description

Stringoptional