Module:Citation/CS1: Difference between revisions
make encoding optional and cut down on pointless / broken encoding
m>Dragons flight (wrong default behavior) |
m>Dragons flight (make encoding optional and cut down on pointless / broken encoding) |
||
Line 25: | Line 25: | ||
local sep = args.separator or " " | local sep = args.separator or " " | ||
args.suffix = args.suffix or "" | args.suffix = args.suffix or "" | ||
local url_string = args.id | |||
if args.encode == true or args.encode == nil then | |||
url_string = z.mw.url.encode( url_string ); | |||
end | |||
local t0 = onlyinprint(args.label .. sep .. args.id) | local t0 = onlyinprint(args.label .. sep .. args.id) | ||
local t1 = hideinprint("[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" .. args.prefix .. | local t1 = hideinprint("[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" .. args.prefix .. url_string .. args.suffix .. " " .. nowiki(frame, args.id) .. "]") | ||
return t0 .. t1 | return t0 .. t1 | ||
end | end | ||
Line 672: | Line 678: | ||
end | end | ||
if ( ARXIV ~= nil and ARXIV ~= "" ) then | if ( ARXIV ~= nil and ARXIV ~= "" ) then | ||
ARXIV = sepc .. " " .. externallinkid(frame, {label="arXiv",link="arXiv",prefix="http://arxiv.org/abs/",id=ARXIV,separator=":"}) else ARXIV = "" end | ARXIV = sepc .. " " .. externallinkid(frame, {label="arXiv",link="arXiv",prefix="http://arxiv.org/abs/",id=ARXIV,separator=":",encode=false}) else ARXIV = "" end | ||
if ( ASIN ~= nil and ASIN ~= "" ) then | if ( ASIN ~= nil and ASIN ~= "" ) then | ||
ASIN = sepc .. " " .. amazon(frame, ASIN, ASINTLD) else ASIN = "" end | ASIN = sepc .. " " .. amazon(frame, ASIN, ASINTLD) else ASIN = "" end | ||
Line 681: | Line 687: | ||
if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end | if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end | ||
if ( ISBN ~= nil and ISBN ~= "") then | if ( ISBN ~= nil and ISBN ~= "") then | ||
ISBN = sepc .. " " .. internallinkid(frame, {label="ISBN",link="International Standard Book Number",prefix="Special:BookSources/",id=ISBN}) else ISBN = "" end | ISBN = sepc .. " " .. internallinkid(frame, {label="ISBN",link="International Standard Book Number",prefix="Special:BookSources/",id=ISBN,encode=false}) else ISBN = "" end | ||
if ( ISSN ~= nil and ISSN ~="" ) then | if ( ISSN ~= nil and ISSN ~="" ) then | ||
ISSN = sepc .. " " .. externallinkid(frame, {label="ISSN",link="International Standard Serial Number",prefix="//www.worldcat.org/issn/",id=ISSN}) else ISSN = "" end | ISSN = sepc .. " " .. externallinkid(frame, {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 | if ( JFM ~= nil and JFM ~="" ) then | ||
JFM = sepc .." " .. externallinkid(frame, {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 | JFM = sepc .." " .. externallinkid(frame, {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 | ||
Line 689: | Line 695: | ||
JSTOR = sepc .." " .. externallinkid(frame, {label="JSTOR",link="JSTOR",prefix="http://www.jstor.org/stable/",id=JSTOR}) else JSTOR = "" end | JSTOR = sepc .." " .. externallinkid(frame, {label="JSTOR",link="JSTOR",prefix="http://www.jstor.org/stable/",id=JSTOR}) else JSTOR = "" end | ||
if ( LCCN ~= nil and LCCN ~="" ) then | if ( LCCN ~= nil and LCCN ~="" ) then | ||
LCCN = sepc .." " .. externallinkid(frame, {label="LCCN",link="Library of Congress Control Number",prefix="http://lccn.loc.gov/",id=LCCN}) else LCCN = "" end | LCCN = sepc .." " .. externallinkid(frame, {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 | if ( MR ~= nil and MR ~="" ) then | ||
MR = sepc .." " .. externallinkid(frame, {label="MR",link="Mathematical Reviews",prefix="http://www.ams.org/mathscinet-getitem?mr=",id=MR}) else MR = "" end | MR = sepc .." " .. externallinkid(frame, {label="MR",link="Mathematical Reviews",prefix="http://www.ams.org/mathscinet-getitem?mr=",id=MR}) else MR = "" end | ||
Line 701: | Line 707: | ||
PMC = sepc .." " .. externallinkid(frame, {label="PMC",link="PubMed Central",prefix="//www.ncbi.nlm.nih.gov/pmc/articles/PMC",suffix=" ",id=PMC}) else PMC = "" end | PMC = sepc .." " .. externallinkid(frame, {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 | if ( PMID ~= nil and PMID ~="") then | ||
PMID = sepc .." " .. externallinkid(frame, {label="PMID",link="PubMed Identifier",prefix="//www.ncbi.nlm.nih.gov/pubmed/",id=PMID}) else PMID = "" end | PMID = sepc .." " .. externallinkid(frame, {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 | if ( RFC ~= nil and RFC ~="") then | ||
RFC = sepc .." " .. externallinkid(frame, {label="RFC",link="Request for Comments",prefix="//tools.ietf.org/html/rfc",id=RFC}) else RFC = "" end | RFC = sepc .." " .. externallinkid(frame, {label="RFC",link="Request for Comments",prefix="//tools.ietf.org/html/rfc",id=RFC}) else RFC = "" end |