Module:Glossary: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
Line 3:
function p.generate(frame)
local maxEntries = tonumber(frame.args[1]) or 30
local current = mw.title.getCurrentTitle()
local content = current:getContent() or ""
local seen = {}
local entries = {}
local count = 0
for link in content:gmatch("%[%[([^%]|]+)") do
if count >= maxEntries then
end
local title = link:match("^(.-)#") or link
title = mw.text.trim(title)
Line 17 ⟶ 22:
seen[title] = true
else
defTitle = "Definition:" .. title
end
text = text:gsub("
})
count = count + 1
end
end
end
Line 37 ⟶ 48:
end
table.sort(entries, function(a, b)
return a.title < b.title
end)
local out = {}
for _, e in ipairs(entries) do
table.insert(out,
▲ ))
end
| |||