Module:Documentation: Difference between revisionsGive feedback
osrsw>Jayden m 1 revision imported: Merging |
osrsw>IN008 mNo edit summary |
||
| Line 1: | Line 1: | ||
-- <nowiki> | -- <nowiki> | ||
local p = {} | local p = {} | ||
| Line 8: | Line 6: | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local args = frame:getParent().args | local args = frame:getParent().args | ||
local | local page = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' ) | ||
local ret, cats, ret1, ret2 | local ret, cats, ret1, ret2 | ||
local onModule = title.namespace == 828 | |||
-- subpage header | -- subpage header | ||
| Line 18: | Line 17: | ||
:tag( 'tr' ) | :tag( 'tr' ) | ||
:tag( 'td' ) | :tag( 'td' ) | ||
:wikitext( '[[File:Information icon-grey.svg| | :css( 'width', '40px' ) | ||
:wikitext( '[[File:Information icon-grey.svg|35px|center|link=]]' ) | |||
:done() | :done() | ||
:tag( 'td' ) | :tag( 'td' ) | ||
:tag( 'b' ) | :tag( 'b' ) | ||
:wikitext( 'This is a documentation subpage for [[' .. | :wikitext( 'This is a documentation subpage for [[' .. page .. ']].' ) | ||
:done() | :done() | ||
:tag( 'div' ) | :tag( 'div' ) | ||
:css( 'font-size' | :css({ ['font-size'] = '0.85em', ['line-height'] = '1.4em' }) | ||
:wikitext( 'It contains usage information, categories, and other content that is not part of the original | :wikitext( | ||
string.format( | |||
'It contains usage information, categories, and other content that is not part of the original %s page.', | |||
onModule and 'module' or 'template' | |||
) | |||
) | |||
:done() | :done() | ||
:done() | :done() | ||
:done() | :done() | ||
:done() | :done() | ||
if title. | if title.namespace == 10 then | ||
cats = '[[Category:Template documentation|' .. title.baseText .. ']]' | cats = '[[Category:Template documentation|' .. title.baseText .. ']]' | ||
elseif title.namespace == 828 then | |||
cats = '[[Category:Module documentation|' .. title.baseText .. ']]' | |||
else | |||
cats = '' | |||
end | end | ||
| Line 43: | Line 50: | ||
-- template header | -- template header | ||
-- don't use mw.html as we aren't closing the main div tag | -- don't use mw.html as we aren't closing the main div tag | ||
ret1 = '<div class="documentation">' | ret1 = '<div class="documentation">' | ||
ret2 = mw.html.create( 'div' ) | ret2 = mw.html.create( nil ) | ||
:tag('div') | |||
:addClass( 'doc-header' ) | |||
:tag( 'span' ) | |||
:wikitext( ' | :addClass( 'doc-title' ) | ||
:wikitext( string.format('%s documentation', onModule and 'Module' or 'Template') ) | |||
:done() | |||
:tag( 'span' ) | |||
:addClass( 'doc-editlinks' ) | |||
:addClass( 'plainlinks' ) | |||
:wikitext( | |||
'[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='edit'} ) ) .. ' edit]] ' .. | |||
'[<span class="jsPurgeLink">[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]</span>]' | |||
) | |||
:done() | |||
:done() | :done() | ||
:tag( ' | :tag( 'div' ) | ||
:addClass( 'doc- | :addClass( 'doc-transclusion' ) | ||
:wikitext( 'This documentation is transcluded from [[' .. page .. '/doc]].' ) | |||
:wikitext( | |||
:done() | :done() | ||
return ret1 .. tostring( ret2 ) | |||
return ret1 .. tostring( ret2 | |||
end | end | ||
return p | return p | ||
-- </nowiki> | |||