Module:Hatnote list: Difference between revisions
Jump to navigation
Jump to search
Update with new _formatLink syntax for Module:Hatnote; using the Module:Hatnote/sandbox for now, but will switch back to Module:Hatnote in a short while. Also make "searchDisp" a local variable instead of a global.
>Galobtter (fix) |
>Mr. Stradivarius (Update with new _formatLink syntax for Module:Hatnote; using the Module:Hatnote/sandbox for now, but will switch back to Module:Hatnote in a short while. Also make "searchDisp" a local variable instead of a global.) |
||
Line 9: | Line 9: | ||
local mArguments --initialize lazily | local mArguments --initialize lazily | ||
local mHatnote = require('Module:Hatnote') | local mHatnote = require('Module:Hatnote/sandbox') | ||
local libraryUtil = require('libraryUtil') | local libraryUtil = require('libraryUtil') | ||
local checkType = libraryUtil.checkType | local checkType = libraryUtil.checkType | ||
Line 46: | Line 46: | ||
local separator = options.separator | local separator = options.separator | ||
--searches display text only | --searches display text only | ||
function searchDisp(t, f) | local function searchDisp(t, f) | ||
return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) | return string.find(string.sub(t, (string.find(t, '|') or 0) + 1), f) | ||
end | end | ||
Line 171: | Line 171: | ||
for k, v in pairs(forSeeTable) do | for k, v in pairs(forSeeTable) do | ||
local useStr = v.use or options.otherText | local useStr = v.use or options.otherText | ||
local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink | local pagesStr = p.andList(v.pages, true) or mHatnote._formatLink{link = mHatnote.disambiguate(options.title)} | ||
local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) | local forSeeStr = string.format(options.forSeeForm, useStr, pagesStr) | ||
forSeeStr = punctuationCollapse(forSeeStr) | forSeeStr = punctuationCollapse(forSeeStr) |