Module:documentation
Documentation for this module may be created at Module:documentation/documentation
local export = {}
function export.show(frame)
local source = frame.args[1] or frame.args["source"]
local title = mw.title.getCurrentTitle().fullText
local doc = ((type(source) == "string" and source ~= "") and mw.title.new(source))
or mw.title.new(title .. "/documentation")
if not doc.exists then
local ret = '\n<div class="documentation">'
ret = ret .. "\n'''This page has no documentation.'''"
ret = ret .. '\nPlease <span class="plainlinks">[' .. doc:fullUrl{action="edit"} .. ' create it]</span>.'
return ret .. '\n</div>\n'
end
local doc_content = frame:expandTemplate{title=doc.fullText}
local ret = '\n<div class="documentation" style="margin:1em 0 0; padding: 1em; border:1px solid #a8a8a8; background-color:#ecfcf4; clear:both;">'
ret = ret .. '\n<div style="padding-bottom:3px; border-bottom:1px solid #bfbfbf; margin-bottom:1ex;">'
ret = ret .. '\n<span style="font-size:125%; font-weight:bold;">[[File:TemplateDocumentation.svg|50px]] Template documentation</span>'
ret = ret .. ' <span class="mw-editsection-like plainlinks">'
ret = ret .. ' <nowiki>[</nowiki>[[' .. doc.fullText .. ' view]]<nowiki>]</nowiki>'
ret = ret .. ' <nowiki>[</nowiki>[[' .. doc:fullUrl{action="edit"} .. ' edit]]<nowiki>]</nowiki>'
ret = ret .. ' <nowiki>[</nowiki>[[Special:Purge/' .. title .. ' purge]]<nowiki>]</nowiki>'
ret = ret .. '</span>'
ret = ret .. '\n</div></div>'
return ret
end
return export