Module:HPB-SB authors: Difference between revisions

no edit summary
(Created page with "local p = {} -- Separators matching Template:HPB-SB authors raw row local FS = mw.ustring.char(0x2063) -- field separator (INVISIBLE SEPARATOR) local RS = mw.ustring.char(0x2064) -- record terminator (INVISIBLE PLUS) local AS = mw.ustring.char(0x2062) -- author-value separator (INVISIBLE TIMES) local function isempty(s) return s == nil or s == '' end -- plain-text split, no Lua pattern magic involved local function split_plain(str, sep) local parts = {} local start...")
 
No edit summary
 
Line 165: Line 165:
table.insert(out, 'Has "Kislingbury, Emily": ' .. tostring(map['Kislingbury, Emily'] ~= nil))
table.insert(out, 'Has "Kislingbury, Emily": ' .. tostring(map['Kislingbury, Emily'] ~= nil))
return table.concat(out, '<br>\n')
return table.concat(out, '<br>\n')
end
-- TEMPORARY diagnostic helper for the author-name cleanup project: dumps every
-- unique raw author string with the wiki pages it appears on, tab/semicolon
-- separated, for offline analysis. Safe to remove once that project is done.
function p.rawnames(frame)
local rows = fetchAllRows(frame)
local map, order = groupByAuthor(rows)
table.sort(order)
local out = {}
for _, name in ipairs(order) do
local pages = {}
local seen = {}
for _, r in ipairs(map[name]) do
if not seen[r.page] then
seen[r.page] = true
table.insert(pages, r.page)
end
end
table.insert(out, name .. '\t' .. table.concat(pages, ';'))
end
return '<pre>' .. table.concat(out, '\n') .. '</pre>'
end
end


return p
return p