Changes

no edit summary
Line 7: Line 7:  
local args = nil
 
local args = nil
 
local ship = nil
 
local ship = nil
 +
local frame = nil
    
local enumerating_functions = {
 
local enumerating_functions = {
      
+
 
 +
     args = function()
 +
        return mw.text.split(args.args, "%s*,%s*")
 +
    end,
 +
 
 
     base_names = function()
 
     base_names = function()
 
         return ShipIterator.baseForms
 
         return ShipIterator.baseForms
Line 102: Line 107:  
         return "|-\n"
 
         return "|-\n"
 
     elseif prefix == "?" then
 
     elseif prefix == "?" then
         local key = string.sub(arg, 2)
+
         prefix = string.sub(prefix, 1, 1)
        local value = format_value(key)
+
         if prefix == "?" then
         if args.format == "table" then
+
            local key = string.sub(arg, 3)
             return "|" .. value .. "\n"
+
             return frame:preprocess(format{ key, ship = ship:name('/') })
 
         else
 
         else
             return value
+
             local key = string.sub(arg, 2)
 +
            local value = format_value(key)
 +
            if args.format == "table" then
 +
                return "|" .. value .. "\n"
 +
            else
 +
                return value
 +
            end
 
         end
 
         end
 
     else
 
     else
Line 130: Line 141:  
local Calc = {}
 
local Calc = {}
   −
function Calc.format(frame, args_)
+
function Calc.format(frame_, args_)
     return interpret_args(args_ or Utils.getTemplateArgs(frame).explicit)
+
    frame = frame_
 +
     return interpret_args(args_ or Utils.getTemplateArgs(frame_).explicit)
 
end
 
end
    
function Calc.test()
 
function Calc.test()
 +
    --[[
 
     mw.log(Calc.format(nil, {
 
     mw.log(Calc.format(nil, {
 
         format = "table",
 
         format = "table",
Line 140: Line 153:  
         "#", "!@", "?id", "?link", "?implementation_date"
 
         "#", "!@", "?id", "?link", "?implementation_date"
 
     }))
 
     }))
 +
    ]]--
 
end
 
end
    
return Calc
 
return Calc
cssedit, gkautomate
7,060

edits