Module:Toyama: Difference between revisions

(Created page with "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 = "...")
 
No edit summary
 
Line 29: Line 29:
   label = string.sub(label,1)
   label = string.sub(label,1)
   data = string.sub(data,1)
   data = string.sub(data,1)
   text = text .. "label=" .. label .. ";data=" .. data
   text = text .. "label=" .. label .. ";data=" .. string.sub(data,2)


   return text
   return text

Latest revision as of 06:29, 8 February 2023

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