Module:Toyama

Revision as of 06:29, 8 February 2023 by Editor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:Toyama/doc

local getArgs = require('Module:Arguments').getArgs;
local defArgs = require('Module:Arguments').defaultArgs;
local toyama = {};

function toyama.func1( frame )
  local args = defArgs(getArgs(frame), 1, "");
  local arg = args[1];
  local text = ""

  for line in arg:gmatch("[%S ]+") do
    text = text .. line
  end

  return text
end


function toyama.vbar( frame )
  local args = defArgs(getArgs(frame), 1, "");
  local arg = args[1];
  local text = ""

  local label = ""
  local data  = ""
  for i,j in arg:gmatch("&&([%S ]+)&&([-.0-9]+)") do
    label = label .. "," .. i
    data  = data .. "," .. j
  end
  label = string.sub(label,1)
  data = string.sub(data,1)
  text = text .. "label=" .. label .. ";data=" .. string.sub(data,2)

  return text
end

return toyama