Module:Citation/CS1: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
sync to sandbox, addresses handling of trans-title with no title. Also fixes to COinS for encyclopedia mode. |
sync with sandbox. Mostly prep work for dealing with {citation} (e.g. Place=), also code formatting, and wikilinks in urls |
||
வரிசை 1:
local z = {
error_categories = {};
message_tail = {};
}
வரி 81 ⟶ 82:
end
return "[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" ..
args.prefix .. url_string .. args.suffix .. " " .. nowiki(args.id) .. "]"
end
வரி 88 ⟶ 90:
local sep = args.separator or " "
args.suffix = args.suffix or ""
return "[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[[" ..
args.prefix .. args.id .. args.suffix .. "|" .. nowiki(args.id) .. "]]"
end
வரி 98 ⟶ 101:
domain = "co." .. domain
end
return externallinkid({link="Amazon Standard Identification Number",
label="ASIN",prefix="//www.amazon."..domain.."/dp/",id=id,encode=false})
end
வரி 111 ⟶ 115:
inactive = " (inactive " .. inactive .. ")"
else
text = externallinkid({link="Digital object identifier",label="doi",
prefix="http://dx.doi.org/",id=id,separator=":"})
inactive = ""
end
வரி 123 ⟶ 128:
-- Escape sequences for content that will be used for URL descriptions
function safeforurl( str )
if str:match( "%[%[.-%]%]" ) ~= nil then
table.insert( z.error_categories, "Pages with citations having wikilinks embedded in URL titles" );
table.insert( z.message_tail, "Wikilink embedded in URL title" );
end
return str:gsub( '[%[%]\n]', {
['['] = '[',
வரி 240 ⟶ 250:
local code = id:sub(-1,-1)
if ( code == "A" ) then
return externallinkid({link="Open Library",label="OL",
prefix="http://openlibrary.org/authors/OL",id=id})
elseif ( code == "M" ) then
return externallinkid({link="Open Library",label="OL",
prefix="http://openlibrary.org/books/OL",id=id})
elseif ( code == "W" ) then
return externallinkid({link="Open Library",label="OL",
prefix= "http://openlibrary.org/works/OL",id=id})
else
table.insert( z.error_categories, "Pages with OL errors" );
return externallinkid({link="Open Library",label="OL",
prefix= "http://openlibrary.org/OL",id=id}) ..
' <span class="error">Bad OL specified</span>';
end
வரி 309 ⟶ 323:
end
if ( "scap" == format ) then result= createTag({name="span", contents=result,
params={class="smallcaps", style="font-variant:small-caps;"}}) end
return result, count
end
வரி 337 ⟶ 353:
while true do
last = args["author" .. i .. "-last"] or args["author-last" .. i] or
args["last" .. i] or args["surname" .. i] or args["Author" .. i] or args["author" .. i]
if ( last and "" < last ) then -- just in case someone passed in an empty parameter
authors[i] = {
last = last,
first = args["author" .. i .. "-first"] or args["author-first" .. i] or
args["author" .. i .. "link"] or args["authorlink" .. i],
mask = args["author" .. i .. "-mask"] or args["author-mask" .. i] or
args["author" .. i .. "mask"] or args["authormask" .. i]
}
else
வரி 360 ⟶ 380:
while true do
last = args["editor" .. i .. "-last"] or args["editor-last" .. i] or
args["EditorSurname" .. i] or args["Editor" .. i] or args["editor" .. i]
if ( last and "" < last ) then -- just in case someone passed in an empty parameter
editors[i] = {
last = last,
first = args["editor" .. i .. "-first"] or args["editor-first" .. i] or args["EditorGiven" .. i],
link = args["editor" .. i .. "-link"] or args["editor-link" .. i] or
mask = args["editor" .. i .. "-mask"] or args["editor-mask" .. i] or
args["editor" .. i .. "mask"] or args["editormask" .. i]
}
else
வரி 402 ⟶ 425:
args["editor1link"] = args["editor1link"] or args["editorlink"]
-- Pick out the relevant fields from the arguments. Different citation templates
-- define different field names for the same underlying things.
local Authors = args.authors
local i
வரி 434 ⟶ 458:
local ChapterURL = args["chapter-url"] or args.chapterurl
local ConferenceURL = args["conference-url"] or args.conferenceurl
local Periodical = args.journal or args.newspaper or args.magazine or args.work
or args.periodical or args.encyclopedia or args.encyclopaedia
if ( config.CitationClass == "encyclopaedia" ) then
if ( args.article and args.article ~= "") then
வரி 477 ⟶ 503:
local Edition = args.edition
local PublicationPlace = args["publication-place"] or args.publicationplace
or args.place or args.location
local Place = args.place or args.location
if PublicationPlace == Place then Place = nil; end
local Location = PublicationPlace
local PublisherName = args.publisher
வரி 518 ⟶ 548:
local sepc = args.separator or "."
local LastAuthorAmp = args.lastauthoramp
local no_tracking_cats = args["template doc demo"] or args.nocat or
args.notracking or args["no-tracking"] or "";
if ( config.CitationClass == "journal" ) then
வரி 528 ⟶ 558:
end
end
elseif ( config.CitationClass == "citation" ) then▼
▲ sepc = ","
if ( Ref == nil ) then Ref = "harv" end▼
end
வரி 571 ⟶ 598:
end
-- These data form a COinS tag (see <http://ocoins.info/>) which allows
-- automated tools to parse the citation information.
local OCinSdata = {} -- COinS metadata excluding id, bibcode, doi, etc.
local ctx_ver = "Z39.88-2004"
வரி 653 ⟶ 681:
-- Now perform various field substitutions.
-- We also add leading spaces and surrounding markup and punctuation to the
-- various parts of the citation, but only when they are non-nil.
if ( Authors == nil ) then
local Maximum = tonumber(args["display-authors"] or args.displayauthors);
வரி 661 ⟶ 690:
Maximum = 8;
table.insert( z.error_categories, 'Pages using citations with old-style implicit et al.' );
table.insert(
elseif Maximum == nil then
Maximum = #a + 1;
வரி 690 ⟶ 719:
Maximum = 3;
table.insert( z.error_categories, 'Pages using citations with old-style implicit et al.' );
table.insert(
elseif Maximum == nil then
Maximum = #e + 1;
வரி 756 ⟶ 785:
if ( config.CitationClass == "web" ) then
table.insert( z.error_categories, 'Pages using web citations with no URL' );
table.insert(
end
வரி 762 ⟶ 791:
if ( AccessDate ~= nil and AccessDate ~= '' ) then
table.insert( z.error_categories, 'Pages using citations with accessdate and no URL' );
table.insert(
AccessDate = nil;
end
வரி 781 ⟶ 810:
( TransChapter == nil or TransChapter == "" ) then
table.insert( z.error_categories, 'Pages with citations lacking titles' );
table.insert(
end
வரி 835 ⟶ 864:
Title = "\"" .. Title .. "\""
elseif ( config.CitationClass == "web"
or config.CitationClass == "news"
Chapter == "" then
Title = "\"" .. Title .. "\""
வரி 857 ⟶ 887:
end
if ( Place ~= nil and Place ~= "" ) then
Place = " Written at " .. Place .. sepc .. " ";
else
Place = " written at " .. Place .. sepc .. " ";
end
else
Place = "";
end
if ( Conference ~= nil and Conference ~="" ) then
if ( ConferenceURL ~= nil ) then
வரி 954 ⟶ 993:
if ( SubscriptionRequired ~= nil and
SubscriptionRequired ~= "" ) then
SubscriptionRequired = sepc .. " " .. createTag({name="span", contents="(subscription required)",
params={style="font-size:0.95em; font-size: 90%; color: #555"}})
else
SubscriptionRequired = ""
end
if ( ARXIV ~= nil and ARXIV ~= "" ) then
ARXIV = sepc .. " " .. externallinkid({label="arXiv",link="arXiv",
prefix="http://arxiv.org/abs/",id=ARXIV,separator=":",encode=false}) else ARXIV = "" end
if ( ASIN ~= nil and ASIN ~= "" ) then
ASIN = sepc .. " " .. amazon(ASIN, ASINTLD) else ASIN = "" end
if ( BIBCODE ~= nil and BIBCODE ~= "" ) then
BIBCODE = sepc .. " " .. externallinkid({label="Bibcode",link="Bibcode",
prefix="http://adsabs.harvard.edu/abs/",id=BIBCODE,separator=":"}) else BIBCODE = "" end
if ( DOI ~= nil and DOI ~= "" ) then
DOI = sepc .. " " .. doi(DOI, DoiBroken) else DOI = "" end
if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end
if ( ISBN ~= nil and ISBN ~= "") then
ISBN = sepc .. " " .. internallinkid({label="ISBN",link="International Standard Book Number",
prefix="Special:BookSources/",id=ISBN}) else ISBN = "" end
if ( ISSN ~= nil and ISSN ~="" ) then
ISSN = sepc .. " " .. externallinkid({label="ISSN",link="International Standard Serial Number",
prefix="//www.worldcat.org/issn/",id=ISSN,encode=false}) else ISSN = "" end
if ( JFM ~= nil and JFM ~="" ) then
JFM = sepc .." " .. externallinkid({label="JFM",link="Jahrbuch über die Fortschritte der Mathematik",
prefix="http://www.zentralblatt-math.org/zmath/en/search/?format=complete&q=an:",id=JFM}) else JFM = "" end
if ( JSTOR ~= nil and JSTOR ~="") then
JSTOR = sepc .." " .. externallinkid({label="JSTOR",link="JSTOR",
prefix="http://www.jstor.org/stable/",id=JSTOR}) else JSTOR = "" end
if ( LCCN ~= nil and LCCN ~="" ) then
LCCN = sepc .." " .. externallinkid({label="LCCN",link="Library of Congress Control Number",
prefix="http://lccn.loc.gov/",id=LCCN,encode=false}) else LCCN = "" end
if ( MR ~= nil and MR ~="" ) then
MR = sepc .." " .. externallinkid({label="MR",link="Mathematical Reviews",
prefix="http://www.ams.org/mathscinet-getitem?mr=",id=MR}) else MR = "" end
if ( OCLC ~= nil and OCLC ~="") then
OCLC = sepc .." " .. externallinkid({label="OCLC",link="OCLC",
prefix="//www.worldcat.org/oclc/",id=OCLC}) else OCLC = "" end
if ( OL ~= nil and OL ~="") then
OL = sepc .. " " .. openlibrary(OL) else OL = "" end
if ( OSTI ~= nil and OSTI ~="") then
OSTI = sepc .." " .. externallinkid({label="OSTI",link="Office of Scientific and Technical Information",
prefix="http://www.osti.gov/energycitations/product.biblio.jsp?osti_id=",id=OSTI}) else OSTI = "" end
if ( PMC ~= nil and PMC ~="") then
PMC = sepc .." " .. externallinkid({label="PMC",link="PubMed Central"
,prefix="//www.ncbi.nlm.nih.gov/pmc/articles/PMC",suffix=" ",id=PMC}) else PMC = "" end
if ( PMID ~= nil and PMID ~="") then
PMID = sepc .." " .. externallinkid({label="PMID",link="PubMed Identifier",
prefix="//www.ncbi.nlm.nih.gov/pubmed/",id=PMID,encode=false}) else PMID = "" end
if ( RFC ~= nil and RFC ~="") then
RFC = sepc .." " .. externallinkid({label="RFC",link="Request for Comments",
prefix="//tools.ietf.org/html/rfc",id=RFC,encode=false}) else RFC = "" end
if ( SSRN ~= nil and SSRN ~="") then
SSRN = sepc .." " .. externallinkid({label="SSRN",link="Social Science Research Network",
prefix="http://ssrn.com/abstract=",id=SSRN}) else SSRN = "" end
if ( ZBL ~= nil and ZBL ~="") then
ZBL = sepc .." " .. externallinkid({label="Zbl",link="Zentralblatt MATH",
prefix="http://www.zentralblatt-math.org/zmath/en/search/?format=complete&q=an:",id=ZBL}) else ZBL = "" end
if ( URL ~= nil and URL ~="") then
வரி 1,026 ⟶ 1,081:
ArchiveDate = " " .. ArchiveDate
else
ArchiveDate = " <span class='error'>If you specify <code>archiveurl=</code>,
"you must also specify <code>archivedate=</code></span> "
table.insert( z.error_categories, 'Pages with archiveurl citation errors' );
end
வரி 1,062 ⟶ 1,118:
LaySource = ""
end
Lay = sepc .. " [" .. LaySummary .. " Lay summary]" .. LaySource .. LayDate
else
Lay = sepc .. " [" .. LaySummary .. " lay summary]" .. LaySource .. LayDate
end
else
Lay = ""
வரி 1,109 ⟶ 1,169:
local tcommon
if ( ( (config.CitationClass == "journal") or (config.CitationClass == "citation") ) and
Periodical ~= "" ) then
if (Others ~= "") then Others = Others .. sepc .. " " end
tcommon = safejoin( {Others, Title, TitleNote, Conference, Periodical, Format, TitleType, Series,
Language, Edition, Publisher, Agency, Volume, Issue, Position}, sepc );
else
tcommon = safejoin( {Title, TitleNote, Conference, Periodical, Format, TitleType, Series, Language,
Volume, Issue, Others, Edition, Publisher, Agency, Position}, sepc );
end
local idcommon = safejoin( { ARXIV, ASIN, BIBCODE, DOI, ISBN, ISSN, JFM, JSTOR, LCCN, MR, OCLC, OL, OSTI,
PMC, PMID, RFC, SSRN, URL, ZBL, ID, Archived, AccessDate, Via, SubscriptionRequired, Lay, Quote }, sepc );
local text
வரி 1,148 ⟶ 1,209:
end
end
text = safejoin( {Authors, Date, Chapter, Place, Editors, tcommon }, sepc );
text = safejoin( {text, pgtext, idcommon}, sepc );
elseif ( "" ~= Editors) then
வரி 1,165 ⟶ 1,226:
end
end
text = safejoin( {Editors, Date, Chapter, Place, tcommon}, sepc );
text = safejoin( {text, pgtext, idcommon}, sepc );
else
வரி 1,175 ⟶ 1,236:
end -- endif ""~=Date
if ( config.CitationClass=="journal" and Periodical ) then
text = safejoin( {Chapter, Place, tcommon}, sepc );
text = safejoin( {text, pgtext, Date, idcommon}, sepc );
else
text = safejoin( {Chapter, Place, tcommon, Date}, sepc );
text = safejoin( {text, pgtext, idcommon}, sepc );
end
end
if PostScript ~= '' and PostScript ~= nil and PostScript ~= sepc then
text = safejoin( {text, sepc}, sepc ); --Deals with italics, spaces, etc.
வரி 1,233 ⟶ 1,293:
z.error_categories = { 'Pages with empty citations' };
text = '<span class="error">Citation is empty</span>';
end
வரி 1,244 ⟶ 1,304:
text = text .. OCinS;
if #
text = text .. hiddencomment( table.concat(
end
வரி 1,273 ⟶ 1,333:
for k, v in pairs( frame.args ) do
config[k] = v;
if args[k] == nil and (v ~= '' or k == 'postscript') then
args[k] = v;
end
end
| |||