Module:Hatnote list: Difference between revisions
Content added Content deleted
(Updated from sandbox) |
(Removed options.disambiguator and moved its uses to new mHatnote.disambiguate()) |
||
Line 76: | Line 76: | ||
--default options table used across the forSee family of functions |
--default options table used across the forSee family of functions |
||
local forSeeDefaultOptions = { |
local forSeeDefaultOptions = { |
||
disambiguator = ' (disambiguation)', |
|||
title = mw.title.getCurrentTitle().text, |
title = mw.title.getCurrentTitle().text, |
||
otherText = 'other uses', |
otherText = 'other uses', |
||
Line 123: | Line 122: | ||
forRow.pages = {} |
forRow.pages = {} |
||
-- If there's not at least one page listed, use the default. |
-- If there's not at least one page listed, use the default. |
||
table.insert(forRow.pages, args[i + 1] or (options.title |
table.insert(forRow.pages, args[i + 1] or mHatnote.disambiguate(options.title)) |
||
-- If the option after next is "and", do an inner loop where we collect |
-- 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 |
-- items following "and"'s until the "and"'s stop. If there's a blank |
||
Line 157: | Line 156: | ||
local useStr = v.use or options.otherText |
local useStr = v.use or options.otherText |
||
local pagesStr = p.andList(mHatnote.formatPages(unpack(v.pages))) or |
local pagesStr = p.andList(mHatnote.formatPages(unpack(v.pages))) or |
||
mHatnote._formatLink(options.title |
mHatnote._formatLink(mHatnote.disambiguate(options.title)) |
||
local forSeeStr = string.format(options.forseeForm, useStr, pagesStr) |
local forSeeStr = string.format(options.forseeForm, useStr, pagesStr) |
||
for k, v in pairs(options.punctuationCollapseReplacements) do |
for k, v in pairs(options.punctuationCollapseReplacements) do |