Module:quote: Difference between revisions
Created page with "--[=[ This module contains functions to implement quote-* templates. Author: Benwing2; conversion into Lua of {{quote-meta/source}} template, written by Sgconlaw with some help from Erutuon and Benwing2. The main interface is quote_t(). Note that the source display is handled by source(), which reads both the arguments passed to it *and* the arguments passed to the parent template, with the former overriding the latter. ]=] local export = {} --[=[ FIXME: 1. Date..." |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 19: | Line 19: | ||
-- Named constants for all modules used, to make it easier to swap out sandbox versions. | -- Named constants for all modules used, to make it easier to swap out sandbox versions. | ||
local check_isxn_module = "Module:check isxn" | local check_isxn_module = "Module:check isxn" | ||
local en_utilities_module = "Module:en-utilities" | local en_utilities_module = "Module:en-utilities" | ||
local italics_module = "Module:italics" | local italics_module = "Module:italics" | ||
| Line 79: | Line 78: | ||
check_issn = require(check_isxn_module).check_issn | check_issn = require(check_isxn_module).check_issn | ||
return check_issn(...) | return check_issn(...) | ||
end | end | ||
| Line 279: | Line 273: | ||
yesno = require(yesno_module) | yesno = require(yesno_module) | ||
return yesno(...) | return yesno(...) | ||
end | end | ||
| Line 1,358: | Line 1,348: | ||
-- module (formerly contained in {{quote-meta/source}}). | -- module (formerly contained in {{quote-meta/source}}). | ||
function export.source(args, alias_map, format_as_cite, other_controls) | function export.source(args, alias_map, format_as_cite, other_controls) | ||
local argslang = args[1] or args.lang | local argslang = args[1] or args.lang | ||
if not argslang then | if not argslang then | ||
| Line 2,276: | Line 2,264: | ||
if quoted_in then | if quoted_in then | ||
add_with_sep("quoted in " .. quoted_in) | add_with_sep("quoted in " .. quoted_in) | ||
end | end | ||
| Line 2,715: | Line 2,702: | ||
if args.nocat then | if args.nocat then | ||
else | else | ||
-- don't create language tracking categories for citations | -- don't create language tracking categories for citations | ||
| Line 2,754: | Line 2,736: | ||
return output_text .. ( | return output_text .. ( | ||
not lang and "" or | not lang and "" or | ||
(#categories > 0 and format_categories(categories, lang, args.sort) or "" | (#categories > 0 and format_categories(categories, lang, args.sort) or "") | ||
) | ) | ||
end | end | ||
| Line 2,887: | Line 2,859: | ||
-- specified but is blank, it will still override the parent arg (with nil). | -- specified but is blank, it will still override the parent arg (with nil). | ||
for pname, param in pairs(parent_args) do | for pname, param in pairs(parent_args) do | ||
args[pname] = ine(param) | args[pname] = ine(param) | ||
end | end | ||
| Line 3,533: | Line 3,503: | ||
params[scribunto_parameter_key(param)] = list | params[scribunto_parameter_key(param)] = list | ||
elseif allow == "*" then | elseif allow == "*" then | ||
allow_all = true | allow_all = true | ||
else | else | ||