Modul:Citation: Redaktələr arasındakı fərq
Redaktənin izahı yoxdur |
Redaktənin izahı yoxdur |
||
| (Eyni redaktor tərəfindən edilmiş 6 ara dəyişiklik göstərilmir) | |||
| Sətir 56: | Sətir 56: | ||
end | end | ||
function createTag(t, frame) | |||
local name = t.name or "!-- --" | |||
local content = t.contents or "" | |||
local attrs = {} | |||
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 | |||
--[[ | |||
This is a clone of mw.text.nowiki. When the mw.text library is installed, | |||
this can be replaced by a call to that library. ]] | |||
function nowiki( s ) | |||
-- string.gsub is safe here, because we're only caring about ASCII chars | |||
s = string.gsub( s, '["&\'<=>%[%]{|}]', { | |||
['"'] = '"', | |||
['&'] = '&', | |||
["'"] = ''', | |||
['<'] = '<', | |||
['='] = '=', | |||
['>'] = '>', | |||
['['] = '[', | |||
[']'] = ']', | |||
['{'] = '{', | |||
['|'] = '|', | |||
['}'] = '}', | |||
} ) | |||
s = string.sub( string.gsub( '\n' .. s, '\n[#*:;]', { | |||
["\n#"] = "\n#", | |||
["\n*"] = "\n*", | |||
["\n:"] = "\n:", | |||
["\n;"] = "\n;", | |||
} ), 2 ) | |||
s = string.gsub( s, '://', '://' ) | |||
s = string.gsub( s, 'ISBN ', 'ISBN ' ) | |||
s = string.gsub( s, 'RFC ', 'RFC ' ) | |||
return s | |||
end | |||
function externallinkid(args) | function externallinkid(args) | ||