Module:Citation/CS1: Difference between revisions
sync to sandbox. Fixes publication-date issues, repeated "." in wikilink, and format on chapterurl.
m>Dragons flight (sync with sandbox. Mostly prep work for dealing with {citation} (e.g. Place=), also code formatting, and wikilinks in urls) |
m>Dragons flight (sync to sandbox. Fixes publication-date issues, repeated "." in wikilink, and format on chapterurl.) |
||
Line 167: | Line 167: | ||
--[[ | --[[ | ||
Joins a sequence of | Joins a sequence of strings together while checking for duplicate separation | ||
characters. | characters. | ||
]] | ]] | ||
Line 197: | Line 197: | ||
if comp:sub(1,1) == duplicate_char then | if comp:sub(1,1) == duplicate_char then | ||
end_chr = str:sub(-1,-1); | end_chr = str:sub(-1,-1); | ||
-- str = str .. "<HERE(enchr=" .. end_chr.. ")" | |||
if end_chr == duplicate_char then | if end_chr == duplicate_char then | ||
str = str:sub(1,-2) .. value; | str = str:sub(1,-2) .. value; | ||
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) .. "''" .. value; | str = str:sub(1, -4) .. "''" .. value; | ||
elseif str:sub(-5,-1) == duplicate_char .. "]]''" then | |||
str = str .. value:sub(2,-1) | |||
elseif str:sub(-4,-1) == duplicate_char .. "]''" then | |||
str = str .. value:sub(2,-1) | |||
else | |||
str = str .. value; | |||
end | |||
elseif end_chr == "]" then | |||
if str:sub(-3,-1) == duplicate_char .. "]]" then | |||
str = str .. value:sub(2,-1) | |||
elseif str:sub(-2,-1) == duplicate_char .. "]" then | |||
str = str .. value:sub(2,-1) | |||
else | else | ||
str = str .. value; | str = str .. value; | ||
Line 508: | Line 521: | ||
if PublicationPlace == Place then Place = nil; end | if PublicationPlace == Place then Place = nil; end | ||
local PublisherName = args.publisher | local PublisherName = args.publisher | ||
local SubscriptionRequired = args.subscription | local SubscriptionRequired = args.subscription | ||
Line 848: | Line 860: | ||
if ( ChapterURL and "" < ChapterURL ) then | if ( ChapterURL and "" < ChapterURL ) then | ||
Chapter = "[" .. ChapterURL .. " " .. safeforurl( Chapter ) .. "]" | Chapter = "[" .. ChapterURL .. " " .. safeforurl( Chapter ) .. "]" | ||
if URL == nil or URL == "" then | |||
Chapter = Chapter .. Format; | |||
Format = ""; | |||
end | |||
elseif ( URL and "" < URL ) then | elseif ( URL and "" < URL ) then | ||
Chapter = "[" .. URL .. " " .. safeforurl( Chapter ) .. "]" .. Format | Chapter = "[" .. URL .. " " .. safeforurl( Chapter ) .. "]" .. Format | ||
Line 959: | Line 975: | ||
if ( TitleNote ~= nil and TitleNote ~="" ) then | if ( TitleNote ~= nil and TitleNote ~="" ) then | ||
TitleNote = sepc .. " " .. TitleNote else TitleNote = "" end | TitleNote = sepc .. " " .. TitleNote else TitleNote = "" end | ||
if ( Language ~= nil and Language ~="" ) then | if ( Language ~= nil and Language ~="" ) then | ||
Language = " (in " .. Language .. ")" else Language = "" end | Language = " (in " .. Language .. ")" else Language = "" end | ||
Line 1,135: | Line 1,148: | ||
config.CitationClass ~= "encyclopaedia" and | config.CitationClass ~= "encyclopaedia" and | ||
config.CitationClass ~= "web" ) then | config.CitationClass ~= "web" ) then | ||
if ( | if ( PublisherName ~= nil and PublisherName ~="" ) then | ||
then | if (PublicationPlace ~= nil and PublicationPlace ~= '') then | ||
else | Publisher = PublicationPlace .. ": " .. PublisherName; | ||
if ( | else | ||
Publisher = " | Publisher = PublisherName; | ||
end | |||
if | elseif (PublicationPlace ~= nil and PublicationPlace ~= '') then | ||
Publisher= PublicationPlace; | |||
else | |||
Publisher = ""; | |||
end | |||
if ( PublicationDate and PublicationDate ~="" ) then | |||
if Publisher ~= '' then | |||
Publisher = Publisher .. ", published " .. PublicationDate; | |||
else | |||
Publisher = PublicationDate; | |||
end | |||
end | |||
if Publisher ~= "" then | |||
Publisher = " (" .. Publisher .. ")"; | |||
end | end | ||
else | else | ||
if ( PublicationDate and PublicationDate ~="" ) then | if ( PublicationDate and PublicationDate ~="" ) then | ||
PublicationDate = " (published " .. PublicationDate .. ")" | PublicationDate = " (published " .. PublicationDate .. ")" | ||
else | |||
if ( PublisherName and PublisherName ~="" ) then | PublicationDate = "" | ||
Publisher = sepc .. " " .. PublicationPlace .. PublisherName .. PublicationDate | end | ||
if ( PublisherName ~= nil and PublisherName ~="" ) then | |||
if (PublicationPlace ~= nil and PublicationPlace ~= '') then | |||
Publisher = sepc .. " " .. PublicationPlace .. ": " .. PublisherName .. PublicationDate; | |||
else | |||
Publisher = sepc .. " " .. PublisherName .. PublicationDate; | |||
end | |||
elseif (PublicationPlace ~= nil and PublicationPlace ~= '') then | |||
Publisher= sepc .. " " .. PublicationPlace .. PublicationDate; | |||
else | |||
Publisher = PublicationDate; | |||
end | end | ||
end | end | ||
Line 1,444: | Line 1,476: | ||
--20Mar2013 If CitationClass is journal, adjust "others=" to have sepc. | --20Mar2013 If CitationClass is journal, adjust "others=" to have sepc. | ||
--20Mar2013 For class "journal", use book format unless Periodical set. | --20Mar2013 For class "journal", use book format unless Periodical set. | ||
--03Apr2013 Changed safejoin() to omit "." after wikilink ".]]" end dot. | |||
--03Apr2013 Changed safejoin() to omit "." after external ".]" end dot. | |||
--03Apr2013 Changed safejoin() to omit "." at italic wikilink ".]]" end. | |||
--03Apr2013 Changed safejoin() to omit "." at italic external ".]" end. | |||
-- | -- | ||
--End | --End |