Module:Citation/CS1: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
fix |
performance related hacking. Remove all references to Module:Mw by incorporating relevant parts of its code, also quit passing the frame around unnecessarily. |
||
வரிசை 7:
local z = {
wikitext = require("Module:Wikitext"),
extensiontags = {
ref = true,
gallery = true,
pre = true,
source = true,
categorytree = true,
charinsert = true,
hiero = true,
imagemap = true,
inputbox = true,
math = true,
poem = true,
ref = true,
references = true,
syntaxhighlight = true,
timeline = true,
}
வரி 18 ⟶ 35:
end
-- This returns a string with HTML character entities for wikitext markup characters.
function nowiki(frame, content)▼
function wikiescape(text)
return z.mw.text.tag({name="nowiki",contents=content,params={}}, frame)▼
text = text:gsub( '[&\'%[%]{|}]', {
['&'] = '&',
["'"] = ''',
['['] = '[',
[']'] = ']',
['{'] = '{',
['|'] = '|',
['}'] = '}' } );
return text;
end
function
local name = t.name or "!-- --"
local content = t.contents or ""
if ( z.extensiontags[name] ) then
-- We have to preprocess these, so that they are properly turned into so-called "strip markers" in the generated wikitext.
if ( not frame ) then error ("Please supply an extra frame argument to the createTag() function.") end
local params = {}
for n,v in pairs(t.params) do
table.insert(params, "|" .. n .. "=" .. v)
end
return frame:preprocess("{{#tag:" .. name .. "|" .. content .. table.concat(params) .. "}}")
else
for n,v in pairs(t.params) do
if (v) then
table.insert(attrs, n .. "=\"" .. wikiescape(v) .. "\"")
else
table.insert(attrs, n)
end
end
if ("" == content) then
return "<" .. name .. " " .. table.concat(attrs, " ") .. "/>"
else
return "<" .. name .. " " .. table.concat(attrs, " ") .. ">" .. content .. "</" .. name .. ">"
end
end
end
end
function externallinkid(args)
local sep = args.separator or " "
args.suffix = args.suffix or ""
வரி 31 ⟶ 89:
local t0 = onlyinprint(args.label .. sep .. args.id)
local t1 = hideinprint("[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[" .. args.prefix .. url_string .. args.suffix .. " " .. nowiki(
return t0 .. t1
end
function internallinkid(
local sep = args.separator or " "
args.suffix = args.suffix or ""
local t0 = onlyinprint(args.label .. sep .. args.id)
local t1 = hideinprint("[[" .. args.link .. "|" .. args.label .. "]]" .. sep .. "[[" .. args.prefix .. args.id .. args.suffix .. "|" .. nowiki(
return t0 .. t1
end
function amazon(
if ( nil == domain ) then
domain = "com"
வரி 50 ⟶ 108:
domain = "co." .. domain
end
return externallinkid(
end
function doi(
local cat = ""
local text;
வரி 61 ⟶ 119:
inactive = " (inactive " .. inactive .. ")"
else
text = externallinkid(
inactive = ""
end
வரி 71 ⟶ 129:
end
function url(
local t0 = onlyinprint(id)
local t1 = hideinprint("[" .. id .. " " .. nowiki(
return t0 .. t1
end
வரி 166 ⟶ 224:
end
function openlibrary(
local cat = ""
local prefix = ""
வரி 180 ⟶ 238:
cat = cat .. "[[Category:Pages with OL errors]]"
end
local text = externallinkid(
return text .. cat
end
வரி 234 ⟶ 292:
end
if ( "scap" == format ) then result=
return result, count
end
வரி 346 ⟶ 404:
end
function citation0(
▲ local config = {};
▲ config[k] = v;
▲ end
--------------------------------------------------- Get parameters
local PPrefix = config.PPrefix or "p. "
வரி 807 ⟶ 861:
if ( SubscriptionRequired ~= nil and
SubscriptionRequired ~= "" ) then
SubscriptionRequired = sepc .. " " ..
else
SubscriptionRequired = ""
end
if ( ARXIV ~= nil and ARXIV ~= "" ) then
ARXIV = sepc .. " " .. externallinkid(
if ( ASIN ~= nil and ASIN ~= "" ) then
ASIN = sepc .. " " .. amazon(
if ( BIBCODE ~= nil and BIBCODE ~= "" ) then
BIBCODE = sepc .. " " .. externallinkid(
if ( DOI ~= nil and DOI ~= "" ) then
DOI = sepc .. " " .. doi(
if ( ID ~= nil and ID ~="") then ID = sepc .." ".. ID else ID="" end
if ( ISBN ~= nil and ISBN ~= "") then
ISBN = sepc .. " " .. internallinkid(
if ( ISSN ~= nil and ISSN ~="" ) then
ISSN = sepc .. " " .. externallinkid(
if ( JFM ~= nil and JFM ~="" ) then
JFM = sepc .." " .. externallinkid(
if ( JSTOR ~= nil and JSTOR ~="") then
JSTOR = sepc .." " .. externallinkid(
if ( LCCN ~= nil and LCCN ~="" ) then
LCCN = sepc .." " .. externallinkid(
if ( MR ~= nil and MR ~="" ) then
MR = sepc .." " .. externallinkid(
if ( OCLC ~= nil and OCLC ~="") then
OCLC = sepc .." " .. externallinkid(
if ( OL ~= nil and OL ~="") then
OL = sepc .." " .. openlibrary(
if ( OSTI ~= nil and OSTI ~="") then
OSTI = sepc .." " .. externallinkid(
if ( PMC ~= nil and PMC ~="") then
PMC = sepc .." " .. externallinkid(
if ( PMID ~= nil and PMID ~="") then
PMID = sepc .." " .. externallinkid(
if ( RFC ~= nil and RFC ~="") then
RFC = sepc .." " .. externallinkid(
if ( SSRN ~= nil and SSRN ~="") then
SSRN = sepc .." " .. externallinkid(
if ( URL ~= nil and URL ~="") then
URL = " " .. url(
else
URL = ""
end
if ( ZBL ~= nil and ZBL ~="") then
ZBL = sepc .." " .. externallinkid(
if ( Quote and Quote ~="" ) then
if Quote:sub(1,1) == '"' and Quote:sub(-1,-1) == '"' then
வரி 1,050 ⟶ 1,104:
end
text =
local empty_span =
-- Note: Using display: none on then COinS span breaks some clients.
local OCinS =
return text .. OCinS
வரி 1,066 ⟶ 1,120:
if ( page ~= nil ) then
local contents = ":" .. page
p =
end
return
end
வரி 1,099 ⟶ 1,153:
params.style = params.style .. " " .. z.wikitext.columnwidthstyle(width)
end
local references =
return
end
வரி 1,155 ⟶ 1,209:
local pframe = frame:getParent()
local id = pframe.args.id or pframe.args[1] or ""
return doi(
end
வரி 1,162 ⟶ 1,216:
local pframe = frame:getParent()
local Name = pframe.args[1] or ""
return hideinprint(
end
வரி 1,185 ⟶ 1,239:
args[k] = v;
end
return citation0(frame, args)▼
local config = {};
for k, v in pairs( frame.args ) do
config[k] = v;
end
end
வரி 1,193 ⟶ 1,253:
local content = crossref(frame, pframe.args)
local args = { name = refid(pframe.args) }
return
end
வரி 1,227 ⟶ 1,287:
params.class="reference"
if ( args.noid == nil or args.noid == "" ) then params.id = "ref_" .. P1 .. P3 end
return
end
வரி 1,240 ⟶ 1,300:
local contents
if arrow ~= "" then
local sup_arrow =
contents = "[[#ref_" .. id .. arrow .. "|<b>" .. sup_arrow .. "</b>]]" .. postscript
if "none" == arrow then arrow = "^" end -- Change this AFTER using it in the ID parameter and the contents.
வரி 1,250 ⟶ 1,310:
params.id = mw.uri.anchorEncode("endnote_" .. id .. arrow)
end
return
end
வரி 1,282 ⟶ 1,342:
local config = frame.args -- the arguments passed BY the template, in the wikitext of the template itself
local args = pframe.args -- the arguments passed TO the template, in the wikitext that instantiates the template
return
end
| |||