2,788
edits
No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
local doc = ((type(source) == "string" and source ~= "") and mw.title.new(source)) | local doc = ((type(source) == "string" and source ~= "") and mw.title.new(source)) | ||
or mw.title.new(mw.title.getCurrentTitle().fullText .. "/documentation") | or mw.title.new(mw.title.getCurrentTitle().fullText .. "/documentation") | ||
return '<div class="documentation">\n | if not doc.exists then | ||
return '<div style="margin-left:1em;"><i>This page has no documentation. [[' .. doc:fullUrl{action="edit"} .. '|Create it]].</div>' | |||
end | |||
local doc_content = doc:getContent() | |||
if doc_content == nil then | |||
error("Documentation page exists but content is nil") | |||
end | |||
return '<div class="documentation">\nThe following documentation is located at [[' .. doc.fullText .. "]]. <sup>[[" .. doc:fullUrl{action="edit"} .. "|edit]]</sup>\n\n" .. doc:getContent() .. "\n</div>" | |||
end | end | ||
return export | return export |