Module:Vital article: Difference between revisions

Content deleted Content added
rename another
no cat class
 
(13 intermediate revisions by 3 users not shown)
Line 15:
end
local data_page = 'Wikipedia:Vital articles/data/' .. subpage .. '.json'
local page2 = tostring(tonumber(page))==page and tonumber(page) or page --convert to number if page is numerical, otherwise loadJsonData does not work
local data = mw.loadJsonData(data_page)[pagepage2]
if data then
local level = tostring(data.level)
if level then
local link = 'Wikipedia:Vital articles/Level/' .. trimmed_linklevel
local trimmed_link = data.trimmed_link
if (level=='4' or level=='5') and data.topic then
local link
link = link .. '/' .. data.topic
if trimmed_link then
end
link = 'Wikipedia:Vital articles' .. trimmed_link
if trimmed_linkdata.sublist then
else
link = 'Wikipedia:Vitallink articles/Level.. '/' .. leveldata.sublist
end
if (level=='4' or level=='5') and data.topic then
if data.sublistsection then
link = link .. '/' .. data.topic
-- link = link .. '#' .. data.section
end
if data.sublist then
link = link .. '/' .. data.sublist
end
--if data.section then -- not used until we have stable section anchors to link to
-- link = link .. '#' .. data.section
--end
end
return link, level
Line 44 ⟶ 39:
local link, level = getLink(page)
return '[[' .. page .. ']]' .. (link and ' [[File:Círculos Concéntricos.svg|11px]] [[' .. link .. '|' .. level .. ']]' or '')
end
 
p.isVital = function(frame)
local page = frame.args.page~='' and frame.args.page or mw.title.getCurrentTitle().subjectPageTitle.text
local _, level = getLink(page)
return level or ''
end
 
Line 94 ⟶ 95:
topic = cat:match('^Wikipedia vital articles in ([%a ]+)$')
if topic then -- Category:Wikipedia vital articles in TOPIC
return top(truefalse, frame)
.. '[[Category:Wikipedia vital articles by topic|' .. (topic=='an unknown topic' and 'Unknown' or topic) .. ']]'
end
Line 112 ⟶ 113:
class = class:match('(%a+)-Class') or class
return top(true, frame)
.. frame:expandTemplate{title = 'cat class', args = {topic = 'vital', class = class}}
end
level, topic = cat:match('^Wikipedia level%-(%w+) vital articles in ([%a ]+)$')