Module:Glossary: Difference between revisions
Content deleted Content added
No edit summary |
No edit summary |
||
Line 6:
local content = current:getContent() or ""
local seen = {}
local entries = {}
local debug = {}
for link in content:gmatch("%[%[([^%]|]+)") do
Line 17:
seen[title] = true
local defTitle = "Definition:" .. title
local page = mw.title.new(defTitle)
if
elseif not page.exists
local
if
table.insert(
text = text:gsub("%b{}",
local sentence = text:match("^(.-%.)")
if not sentence then
table.insert(debug, "NO SENTENCE: " .. defTitle)
else
table.insert(debug, "OK: " .. defTitle)
table.insert(entries, {
title = title,
summary = sentence
})
end
end
end
Line 37 ⟶ 46:
end
table.sort(entries, function(a, b)
return a.title < b.title
end)
local out = {}
-- debug output (remove once working)
table.insert(out, "=== DEBUG ===")
for _, d in ipairs(debug) do
table.insert(out, d)
end
table.insert(out, "=== END DEBUG ===")
for _, e in ipairs(entries) do
table.insert(out, string.format(
| |||