Module:Find sources: Difference between revisions
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 34: | Line 34: | ||
end | end | ||
-- Build the search query | |||
local query = table.concat(args, '+') | local query = table.concat(args, '+') | ||
local url = string.gsub(linkCfg.url, '{{{1}}}', query) | local url = string.gsub(linkCfg.url, '{{{1}}}', query) | ||
url = string.gsub(url, '{{{q}}}', query) | url = string.gsub(url, '{{{q}}}', query) | ||
return string.format('[%s %s]', url, | -- Use only the display text from the config, not the search term | ||
local display = linkCfg.display | |||
return string.format('[%s %s]', url, display) | |||
end | end | ||
| Line 53: | Line 57: | ||
{code = 'jstor'}, | {code = 'jstor'}, | ||
}, | }, | ||
separator = ' · ', | separator = ' · ', | ||
}, | }, | ||
} | } | ||
| Line 61: | Line 65: | ||
-- Add the intro text "Find sources:" | -- Add the intro text "Find sources:" | ||
local | local searchTerm = table.concat(args, ' ') | ||
links_output[#links_output + 1] = string.format("'''Find sources:''' \"%s\"", searchTerm) | |||
-- Add the links | -- Add the links (just the display text, no search term repeated) | ||
for i, linkCfg in ipairs(templateCfg.links) do | for i, linkCfg in ipairs(templateCfg.links) do | ||
links_output[#links_output + 1] = p._renderLink(linkCfg.code, args) | links_output[#links_output + 1] = p._renderLink(linkCfg.code, args) | ||