模块:Documentation:修订间差异

删除489字节 、​ 2023年9月30日 (星期六)
//Edit via InPageEdit
(// Edit via InPageEdit)
(//Edit via InPageEdit)
第44行:
local out
if not args.content and tostring( page ) == docPage then
local pageType = mw.ustring.lower( args.type or getType( page.nsText, page ) )
local pageTypeDisplay = getTypeDisplay( pageType )
out = f:preprocess( '{{subst:模板:Documentation/preload}}' )
out = out:gsub( '$1' , pageTypeDisplay )
else
local templateArgs = {}
第78行 ⟶ 第81行:
local args = require( 'Module:ProcessArgs' ).merge( true )
local badDoc = args.baddoc
if f:callParserFunction( '#dplvar', '$doc noheader' ) == '1' then
if badDoc then
f:callParserFunction( '#dplvar:set', '$doc bad', '1' )
end
return
end
local page = mw.title.getCurrentTitle()
第92行 ⟶ 第89行:
local body = mw.html.create( 'div' )
body
:css{
['margin-bottom'] = '0.8em',
padding = '0.8em 1em 0.7em',
}
:attr( 'class', 'documentation-header documentation-docpage' .. ( badDoc and ' documentation-baddoc' or '' ) )
:tag( 'div' )
:cssaddClass( 'float', 'rightlinks' )
:wikitext( '[[', page:fullUrl( 'action=purge' ), ' 清除缓存]]' )
:done()
第105行 ⟶ 第98行:
pageType == 'module' and '将' or '应该',
'被放置到[[', namespace, ':',page.baseText,
']]查看[[模板:Documentation]]以获取更多信息。'
)
if badDoc then
第142行 ⟶ 第135行:
if not docText and not noDoc then
docText = trim( f:expandTemplate{ title = ':' .. docPage.fullText } )
f:callParserFunction( '#dplvar:set', '$doc noheader', '1' )
 
docText = trim( f:expandTemplate{ title = ':' .. docPage.fullText } )
docText = string.gsub( docText, '<div class="documentation%-header.-</div>\n' , '' )
if f:callParserFunction( '#dplvar', '$doc bad' ) == '1' then
badDoc = 1
end
if docText == '' then
第164行 ⟶ 第155行:
if noDoc then
action = '创建'
preload = '&preload=模板:Documentation/preload&preloadparams%5b%5d=' .. pageTypeDisplay
classes = ' documentation-nodoc'
message = "'''此" .. pageTypeDisplay .. "没有文档页面。" ..
"如果你知道如何使用" .. pageTypeDisplay .. "的使用方法,请帮助为其创建文档页面。'''"
if not ( args.nocat or namespace == 'User' ) then
category = '没有文档的' .. pageTypeDisplay
第194行 ⟶ 第185行:
end
links = mw.html.create( 'span' )
:cssaddClass( 'float', 'rightlinks' )
:wikitext( mw.text.nowiki( '[' ), table.concat( links, ' | ' ), mw.text.nowiki( ']' ) )
local body = mw.html.create( 'div' )
body:attr( 'class', 'documentation' .. classes )
body:css{
padding = '0.8em 1em 0.7em',
['margin-top'] = '1em'
}
:attr( 'class', 'documentation' .. classes )
local header = mw.html.create( 'div' ):addClass( 'documentation-header' )
header:css{
margin = '-0.8em -1em 0.8em',
padding = '0.8em 1em 0.7em',
['border-bottom'] = 'inherit'
}
header
:node( links )
:tag( 'span' )
:addClass( 'title' )
:css{
['font-weight'] = 'bold',
['font-size'] = '130%',
['margin-right'] = '1em',
['line-height'] = '1'
}
:wikitext( '文档页面' )
第238行 ⟶ 第215行:
:tag( 'div' )
:addClass( 'documentation-footer' )
:css{
margin = '0.7em -1em -0.7em',
['border-top'] = 'inherit',
padding = '0.8em 1em 0.7em',
clear = 'both'
}
:node( links )
:wikitext( '上述文档是从引用自[[', docPage.fullText, ']]引用的。' )
end
2,007

个编辑