Module:Handbook: Difference between revisions

Kuhlau (talk | contribs)
No edit summary
Kuhlau (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 13: Line 13:
if args[1] and type(args[1]) == 'string' then
if args[1] and type(args[1]) == 'string' then
for page in lib.gsplit(args[1], ';', { removeEmpty = true }) do
for page in lib.gsplit(args[1], ';', { removeEmpty = true }) do
local handbookArgs = getTemplateArgs('Handbook Entry/' .. page, { only = 'Handbook Entry' })
local handbookArgs = getTemplateArgs('Handbook/' .. page, { only = 'Handbook Entry' })
if lib.isEmpty(handbookArgs) then
if lib.isEmpty(handbookArgs) then
html:tag('strong'):addClass('error'):wikitext('The page [[Handbook Entry/', page, ']] is not a valid Handbook Entry.')
html:tag('strong'):addClass('error'):wikitext('The page [[Handbook/', page, ']] is not a valid Handbook Entry.')
else
else
html
html
:tag('div'):addClass('Handbook Entry')
:tag('div'):addClass('handbook')
:tag('dl')
:tag('dl')
:tag('dt'):wikitext(handbookArgs.title or page)
:tag('dt'):wikitext(handbookArgs.title or page)
Line 27: Line 27:
html
html
:tag('div'):addClass('Handbook Entry')
:tag('div'):addClass('Handbook Entry')
:node(p._HhandbookFormat(args))
:node(p._handbookFormat(args))
end
end
return frame:preprocess(tostring(html))
return frame:preprocess(tostring(html))
Line 37: Line 37:
if args.about then
if args.about then
args.about = lib.split(args.about, ';')
args.about = lib.split(args.about, ';')
if title.rootText == 'Handbook Entry' then
if title.rootText == 'Handbook' then
out:tag('i'):wikitext(require('Module:Hatnote').main(args.about))
out:tag('i'):wikitext(require('Module:Hatnote').main(args.about))
end
end
Line 43: Line 43:
local size = args.size or '200px'
local size = args.size or '200px'
if (title.rootText == 'Handbook Entry') then
if (title.rootText == 'Handbook') then
size = '400px'
size = '400px'
end
end
Line 65: Line 65:
-- add categories if correct page
-- add categories if correct page
local subpage = args.title or title.subpageText
local subpage = args.title or title.subpageText
if (not args['table'] and title.baseText == 'Handbook Entry' and (subpage ~= nil and not lib.inArray({ 'Planar Travel', 'Nexus Battle' }, subpage))) then
if (not args['table'] and title.baseText == 'Handbook' and (subpage ~= nil and not lib.inArray({ 'Planar Travel', 'Nexus Battle', 'Uncategorized' }, subpage))) then
local cat = mw.html.create()
local cat = mw.html.create()
cat:wikitext('[[Category:Handbook Entries|', subpage, ']]')
cat:wikitext('[[Category:Handbook Entries|', subpage, ']]')
Line 140: Line 140:
count,
count,
"'''",
"'''",
(count == 1 and '[[Handbook Entry]] ' or '[[Handbook Entries]] '),
(count == 1 and ' [[Handbook Entry]] ' or ' [[Handbook Entries]] '),
(args[1] and ('that match' .. (count == 1 and 'es' or '') .. ' the category selection:') or ' are in ' .. title)
(args[1] and ('that match' .. (count == 1 and 'es' or '') .. ' the category selection:') or ' are in ' .. title)
)
)