Difference between revisions of "Module:Plain text"
From Nookipedia, the Animal Crossing wiki
(fix) |
(fix) |
||
Line 3: | Line 3: | ||
function p.main(frame) | function p.main(frame) | ||
text = frame.args[1] | text = frame.args[1] | ||
− | text = mw.ustring.gsub('%[%[.*|', '') --strip out piped link text | + | text = mw.ustring.gsub(text, '%[%[.*|', '') --strip out piped link text |
− | text = mw.ustring.gsub ('%[', '') --then strip out remaining [ and ] | + | text = mw.ustring.gsub (text, '%[', '') --then strip out remaining [ and ] |
− | text = mw.ustring.gsub ('%]', '') | + | text = mw.ustring.gsub (text, '%]', '') |
return text | return text | ||
end | end | ||
return p | return p |
Revision as of 10:15, April 13, 2018
Module documentation (view)
Usage
Developed for producing short descriptions from text that may have markup, or other stuff that needs removing from short descriptions.
Example
- Code
'''[[foo|hah]]''' <span style="color:red">is</span> '''''[[gah]]'''''<nowiki>?</nowiki>
→- hah is gah?
- Using module
{{#invoke:Plain text|main|1='''[[foo|hah]]''' <span style="color:red">is</span> '''''[[gah]]'''''<nowiki>?}}</nowiki>
→- hah is gah?
This page uses content from Wikipedia (en). The original article was at Module:Plain text. The list of authors can be seen in the page history. As with Nookipedia, the text of Wikipedia is available under the Creative Commons Attribution-ShareAlike 3.0 Unported license. |
--converts text with wikilinks, e.g "[[foo|gah]] is [[bar]]" to "gah is bar"
local p = {}
function p.main(frame)
text = frame.args[1]
text = mw.ustring.gsub(text, '%[%[.*|', '') --strip out piped link text
text = mw.ustring.gsub (text, '%[', '') --then strip out remaining [ and ]
text = mw.ustring.gsub (text, '%]', '')
return text
end
return p