Module:Citation/CS1: Difference between revisions
sync to sandbox, fixes problem with broken span in association with double "..", also publisher layout for pressrelease mode
m>Dragons flight (sync to sandbox. Fixes publication-date issues, repeated "." in wikilink, and format on chapterurl.) |
m>Dragons flight (sync to sandbox, fixes problem with broken span in association with double "..", also publisher layout for pressrelease mode) |
||
Line 182: | Line 182: | ||
local comp = ''; | local comp = ''; | ||
local end_chr = ''; | local end_chr = ''; | ||
local trim; | |||
for _, value in ipairs( tbl ) do | for _, value in ipairs( tbl ) do | ||
if value == nil then value = ''; end | if value == nil then value = ''; end | ||
Line 196: | Line 197: | ||
if comp:sub(1,1) == duplicate_char then | if comp:sub(1,1) == duplicate_char then | ||
trim = false; | |||
end_chr = str:sub(-1,-1); | end_chr = str:sub(-1,-1); | ||
-- str = str .. "<HERE(enchr=" .. end_chr.. ")" | -- str = str .. "<HERE(enchr=" .. end_chr.. ")" | ||
if end_chr == duplicate_char then | if end_chr == duplicate_char then | ||
str = str:sub(1,-2) | str = str:sub(1,-2); | ||
elseif end_chr == "'" then | elseif end_chr == "'" then | ||
if str:sub(-3,-1) == duplicate_char .. "''" then | if str:sub(-3,-1) == duplicate_char .. "''" then | ||
str = str:sub(1, -4) .. "''" | str = str:sub(1, -4) .. "''"; | ||
elseif str:sub(-5,-1) == duplicate_char .. "]]''" then | elseif str:sub(-5,-1) == duplicate_char .. "]]''" then | ||
trim = true; | |||
elseif str:sub(-4,-1) == duplicate_char .. "]''" then | elseif str:sub(-4,-1) == duplicate_char .. "]''" then | ||
trim = true; | |||
end | end | ||
elseif end_chr == "]" then | elseif end_chr == "]" then | ||
if str:sub(-3,-1) == duplicate_char .. "]]" then | if str:sub(-3,-1) == duplicate_char .. "]]" then | ||
trim = true; | |||
elseif str:sub(-2,-1) == duplicate_char .. "]" then | elseif str:sub(-2,-1) == duplicate_char .. "]" then | ||
trim = true; | |||
end | end | ||
elseif end_chr == " " then | elseif end_chr == " " then | ||
if str:sub(-2,-1) == duplicate_char .. " " then | if str:sub(-2,-1) == duplicate_char .. " " then | ||
str = str:sub(1,-3) .. value | str = str:sub(1,-3); | ||
end | |||
end | |||
if trim then | |||
if value ~= comp then | |||
local dup2 = duplicate_char; | |||
if dup2:match( "%A" ) then dup2 = "%" .. dup2; end | |||
value = value:gsub( "(%b<>)" .. dup2, "%1", 1 ) | |||
else | else | ||
value = value:sub( 2, -1 ); | |||
end | end | ||
end | end | ||
end | end | ||
str = str .. value; | |||
end | end | ||
end | end | ||
Line 1,001: | Line 1,005: | ||
then local retrv_text = " retrieved " | then local retrv_text = " retrieved " | ||
if (sepc == ".") then retrv_text = " Retrieved " end | if (sepc == ".") then retrv_text = " Retrieved " end | ||
AccessDate = '<span class="reference-accessdate">' | AccessDate = '<span class="reference-accessdate">' .. sepc | ||
.. retrv_text .. AccessDate .. '</span>' | |||
else AccessDate = "" end | else AccessDate = "" end | ||
if ( SubscriptionRequired ~= nil and | if ( SubscriptionRequired ~= nil and | ||
Line 1,147: | Line 1,151: | ||
if ( Periodical and Periodical ~= "" and | if ( Periodical and Periodical ~= "" and | ||
config.CitationClass ~= "encyclopaedia" and | config.CitationClass ~= "encyclopaedia" and | ||
config.CitationClass ~= "web" ) then | config.CitationClass ~= "web" and | ||
config.CitationClass ~= "pressrelease" ) then | |||
if ( PublisherName ~= nil and PublisherName ~="" ) then | if ( PublisherName ~= nil and PublisherName ~="" ) then | ||
if (PublicationPlace ~= nil and PublicationPlace ~= '') then | if (PublicationPlace ~= nil and PublicationPlace ~= '') then | ||
Line 1,480: | Line 1,485: | ||
--03Apr2013 Changed safejoin() to omit "." at italic wikilink ".]]" end. | --03Apr2013 Changed safejoin() to omit "." at italic wikilink ".]]" end. | ||
--03Apr2013 Changed safejoin() to omit "." at italic external ".]" end. | --03Apr2013 Changed safejoin() to omit "." at italic external ".]" end. | ||
--04Apr2013 Moved sepc before <span class="reference-accessdate"> for "..". | |||
-- | -- | ||
--End | --End |