Jump to content

Module:Citation/CS1: Difference between revisions

1,036 bytes removed ,  11 years ago
remove Module:Wikitext requirement no longer used here, and remove parts of createTag no longer needed
m>Dragons flight
(All the functions not directly associated with {cite} moved to Module:Citation)
m>Dragons flight
(remove Module:Wikitext requirement no longer used here, and remove parts of createTag no longer needed)
Line 5: Line 5:
--require "mw.text"
--require "mw.text"


local z = {
local z = {}
    wikitext = require("Module:Wikitext"),
    extensiontags = {
        nowiki = true,
        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,
    }
}


function hideinprint(content)
function hideinprint(content)
Line 52: Line 32:
     local content = t.contents or ""
     local content = t.contents or ""
     local attrs = {}
     local attrs = {}
     if ( z.extensiontags[name] ) then
     for n,v in pairs(t.params) do
        -- We have to preprocess these, so that they are properly turned into so-called "strip markers" in the generated wikitext.
         if (v) then
        if ( not frame ) then error ("Please supply an extra frame argument to the createTag() function.") end
            table.insert(attrs, n .. "=\"" .. wikiescape(v) .. "\"")
        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
         else
             return "<" .. name .. " " .. table.concat(attrs, " ") .. ">" .. content .. "</" .. name .. ">"
             table.insert(attrs, n)
         end
         end
    end
    if ("" == content) then
        return "<" .. name .. " " .. table.concat(attrs, " ") .. "/>"
    else
        return "<" .. name .. " " .. table.concat(attrs, " ") .. ">" .. content .. "</" .. name .. ">"
     end
     end
end
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.