Module:Hatnote list: Difference between revisions

m
Changed some variable and structure names: forRow's second item is a table called "pages" instead of a table called "see" now; more logical naming
(Moved form of for-see statement into options)
m (Changed some variable and structure names: forRow's second item is a table called "pages" instead of a table called "see" now; more logical naming)
Line 78:
if not args[i] then terminated = true end
-- New empty list of pages
forRow.seepages = {}
-- If there's not at least one page listed, assume the list's ended, use
-- the default, and break at end of this loop-through.
table.insert(forRow.seepages, args[i + 1] or (options.title .. options.disambiguator))
-- If the option after next is "and", do an inner loop where we collect
-- items following "and"'s until the "and"'s stop. If there's a blank
Line 87:
while args[i + 2] == 'and' do
if args[i + 3] then
table.insert(forRow.seepages, args[i + 3])
end
-- Increment to the next "and"
Line 102:
for k, v in pairs(forTable) do
local useStr = v.use
local seeStrpagesStr = p.andList(mHatnote.formatPages(unpack(v.seepages)))
table.insert(strList, string.format(options.forseeForm, useStr, seeStrpagesStr))
end
return mw.text.listToText(strList, ' ', ' ')
Anonymous user