Module:TestModule: Difference between revisions

AdamZachar (talk | contribs)
No edit summary
AdamZachar (talk | contribs)
No edit summary
Line 3: Line 3:
function p.hello( frame )
function p.hello( frame )
  return "Hello, world!"
  return "Hello, world!"
  -- if row.shape == targetShape then
  -- output = output .. " <li>" .. "[[" .. row.shape .. "]]"
  -- end
end
end


function p.externalDataTest( frame )
function p.externalDataTest( frame )
  local output = ""
  local output = ""
  local targetShape = frame.args.targetShape
  local parentCase = frame.args.parentCase
  local data, errors =
  local topics, errors =
   mw.ext.externaldata.getWebData
   mw.ext.externaldata.getDbData
   {
   {
   url = 'https://discoursedb.org/wiki/Special:GetData/Fruits_data',
   source = CaseData,
   data = {name = 'Name',  color = 'Color', shape = 'Shape'},
  query = childrenTopics,
   format = 'CSV with header'
   data = {topicName = topic_name},
   parameters = parentCase
   }
   }


  output = output .. "<ul>"
  output = output .. "<ul>"
  for i, row in ipairs(data) do
  for i, topic in ipairs(topics) do
  output = output .. " <li>" .. "[[" .. topic.topicName .. "]]"
end


  if row.shape == targetShape then
  output = output .. " <li>" .. "'''[[" .. row.shape .. "]]'''"
  else
  output = output .. " <li>" .. "[[" .. row.shape .. "]]"
  end
end
  output = output .. "</ul>"
  output = output .. "</ul>"