|
|
| 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
| |
|
| |
|
|
| |
|