Module:Citation/CS1/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 3,981:
local tcommon2; -- used for book cite when |contributor= is set
if utilities.in_array (config.CitationClass, {"journalbook", "citation"}) and not utilities.is_set (Periodical) then -- special cases for book cites
if not (utilities.is_set (Authors) or utilities.is_set (Editors)) then
Others = Others:gsub ('^' .. sepc .. ' ', ''); -- when no authors and no editors, strip leading sepc and space
end
if utilities.is_set (Others) then Others = safe_join ({Others, sepc .. " "}, sepc) end -- add terminal punctuation & space; check for dup sepc; TODO why do we need to do this here?
tcommon = safe_join( {Others, Title, TitleNote, Periodical, TitleType, Series, Language, Edition, Publisher, Volume}, sepc );
elseif utilities.in_array (config.CitationClass, {"book", "citation"}) and not utilities.is_set (Periodical) then -- special cases for book cites
if utilities.is_set (Contributors) then -- when we are citing foreword, preface, introduction, etc.
tcommon = safe_join ( {Title, TitleNote}, sepc ); -- author and other stuff will come after this and before tcommon2
tcommon2 = safe_join( ({TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc );
else
tcommon = safe_join( ({Title, TitleNote, TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc );
end
 
elseif 'map' == config.CitationClass then -- special cases for cite map
if utilities.is_set (Chapter) then -- map in a book; TitleType is part of Chapter
tcommon = safe_join( ({Title, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
elseif utilities.is_set (Periodical) then -- map in a periodical
tcommon = safe_join( ({Title, TitleType, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc );
else -- a sheet or stand-alone map
tcommon = safe_join( ({Title, TitleType, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc );
end
elseif 'episode' == config.CitationClass then -- special case for cite episode
tcommon = safe_join( ({Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc );
 
elseif utilities.in_array (config.CitationClass, {"booknews", "citation"}) and not utilities.is_setin_array (PeriodicalPeriodical_origin, {"newspaper", "work"}) then -- special casescase for booknews citations; only template supporting cites|agency=
tcommon = safe_join ( {Others, Title, TitleNote, Conference, Periodical, TitleType, Series, Language, Volume, Others, Edition, Publisher, VolumeAgency}, sepc );
 
else -- all other CS1 templates
tcommon = safe_join( ({Title, TitleNote, Conference, Periodical, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc );
end