From WikiChip
Difference between revisions of "Module:title"
(5 intermediate revisions by the same user not shown) | |||
Line 30: | Line 30: | ||
if has_arg('subject') then | if has_arg('subject') then | ||
− | |||
− | |||
− | |||
− | |||
− | + | title = arg('page') | |
+ | |||
+ | if has_arg('topic') then | ||
+ | local t = arg('topic') | ||
+ | if t == 'arch' then t = 'Microarchitectures' end | ||
+ | if t == 'wire' then t = 'Interconnects' end | ||
+ | title = title .. ' - ' .. t | ||
+ | end | ||
− | end | + | if arg('subject') == 'cray' then title = title .. ' - Cray' end |
+ | if arg('subject') == 'eta compute' then title = title .. ' - Eta Compute' end | ||
+ | if arg('subject') == 'cea leti' then title = title .. ' - CEA Leti' end | ||
+ | if arg('subject') == 'groq' then title = title .. ' - Groq' end | ||
+ | |||
end | end | ||
Latest revision as of 19:48, 11 April 2020
Documentation for this module may be created at Module:title/doc
local p = {}
local origArgs
function has_arg(name)
-- The argument can exist and be empty or not exist at all
return string.len(origArgs[name] or '') > 0
end
function arg(name)
if has_arg(name) then
return origArgs[name]
end
return ''
end
function p.title(frame)
p.frame = frame
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame.args
end
local title = ''
if has_arg('title') then
title = arg('title')
end
if has_arg('subject') then
title = arg('page')
if has_arg('topic') then
local t = arg('topic')
if t == 'arch' then t = 'Microarchitectures' end
if t == 'wire' then t = 'Interconnects' end
title = title .. ' - ' .. t
end
if arg('subject') == 'cray' then title = title .. ' - Cray' end
if arg('subject') == 'eta compute' then title = title .. ' - Eta Compute' end
if arg('subject') == 'cea leti' then title = title .. ' - CEA Leti' end
if arg('subject') == 'groq' then title = title .. ' - Groq' end
end
p.frame:preprocess('{{DISPLAYTITLE: ' .. title .. ' }}')
end
return p