Content deleted Content added
|last-author-amp=yes → |name-list-style=amp; |
replace target_check() with call to target_check() in Module:Footnotes, which has full wrapper/whitelist functionality |
||
(10 intermediate revisions by 6 users not shown) | |||
Line 1:
require('
local code_open_tag = '<code class="cs1-code">'; -- cs1-code class defined in Module:Citation/CS1/styles.css
local lock_icons = { --icon classes are defined in Module:Citation/CS1/styles.css
['registration'] = {'
['limited'] = {'
['subscription'] = {'
}
Line 12 ⟶ 11:
--[[--------------------------< T A R G E T _ C H E C K >------------------------------------------------------
check to see if target of harvc exists in the page somewhere. Uses the target check mechanism from Module:Footnotes
setting |ignore-errors=yes in {{harvc}} will override this check
]]
local function target_check (anchor_id, ignore)
local whitelist_check = require('Module:Footnotes').target_check
local args = {ignore=ignore, template='Harvc', show=true}
return whitelist_check(anchor_id, args)
end▼
end▼
end
Line 44 ⟶ 26:
--[[--------------------------< I S _ S E T >------------------------------------------------------------------
Whether variable is set or not. A
]]
Line 168 ⟶ 150:
local source = ''; -- editor/author date list that forms a CITEREF link to a full citation
local in_text = ' In ';
local result; -- the assemby of the above output▼
-- form the CITEREF anchor
Line 211 ⟶ 192:
count = #args.last; -- set count to display all of the authors
end
while i <= count do
if is_set (contributors) then
Line 266 ⟶ 247:
target_err_msg = target_check (anchor_id, args.ignore); -- see if there is a target for this anchor_id
source = '[[#' .. anchor_id .. "|" .. source .. "]]";
-- special case for afterword, foreword, introduction, preface
local no_quotes = ({['afterword']=true, ['foreword']=true, ['introduction']=true, ['preface']=true})[args.contribution:lower()];
--combine contribution with url to make external link
Line 313 ⟶ 297:
-- and put it all together
table.insert (result, span_open_tag);
table.insert (result, contributors);
table.insert (result, no_quotes and ' ' or ' "'); -- foreword, afterword, introduction, preface contributions are not quoted; all other contributions are
table.insert (result, args.contribution);
table.insert (result, no_quotes and '' or '"'); -- foreword, afterword, introduction, preface contributions are not quoted; all other contributions are
table.insert (result, args.sepc);
table.insert (result, in_text);
table.insert (result, source);
table.insert (result, args.p);
table.insert (result, args.ps);
table.insert (result, args.err_msg);
if not is_set(args.err_msg) then
table.insert (result, target_err_msg)
table.insert (result, '</span>');
return table.concat (result); -- make a string and done
end
Line 355 ⟶ 354:
args.display_authors = pframe.args['display-authors']; -- the number of contributor names to display; cs1|2 format includes first names
args.name_list_style = pframe.args['name-list-style'] or ''; -- when set to 'harv' display contributor list in sfn or harv style
args.name_list_style = args.name_list_style:lower(); -- make it case agnostic
Line 380 ⟶ 378:
end
args.p = pframe.args.p or pframe.args.page or ''; -- source page number(s) or ___location
args.pp = pframe.args.pp or pframe.args.pages or '';
args.loc = pframe.args.loc or '';
args.ref = pframe.args.ref or pframe.args.Ref or ''; -- used to match |ref=<text> in cs1|2 source template
Line 430 ⟶ 432:
end
return table.concat ({
end
|