News media map: Difference between revisions
		
		
		
		Jump to navigation
		Jump to search
		
No edit summary  | 
				No edit summary  | 
				||
| (4 intermediate revisions by the same user not shown) | |||
| Line 4: | Line 4: | ||
   -- local args = frame:getParent().args  |    -- local args = frame:getParent().args  | ||
   local arr = mw.visualdata.query( 'News media', '[[  |    local arr = mw.visualdata.query( 'News media', '[[region::+]]', {}, {} )  | ||
-- https://maps.extension.wiki/wiki/Displaying_Leaflet_maps  | -- https://maps.extension.wiki/wiki/Displaying_Leaflet_maps  | ||
-- Location~Popup title~Popup text~File:CustomIcon~Group~Inline label~File:VisitedIcon  | -- Location~Popup title~Popup text~File:CustomIcon~Group~Inline label~File:VisitedIcon  | ||
   local ret = {}  |    local ret = {}  | ||
   for i,v in ipairs(arr) do  |    for i,v in ipairs(arr) do  | ||
local v_ = v.data.region .. ',' .. v.data.country .. '~'.. v.data.name .. '~' .. v.data.region .. ' (' .. v.data.country .. ')'  | local v_ = v.data.region .. ',' .. v.data.country .. '~'.. v.data.name .. '~' .. v.data.region .. ' (' .. v.data.country .. ')' .. '~~' .. v.data.region .. '-' .. v.data.country .. '~'.. v.data.name .. '~'  | ||
     table.insert(ret, v_)  |      table.insert(ret, v_)  | ||
--ret[#ret + 1] = string.gsub(v_, "^%s*(.-)%s*$", "%1")  | --ret[#ret + 1] = string.gsub(v_, "^%s*(.-)%s*$", "%1")  | ||
Latest revision as of 10:33, 20 December 2024
Documentation for this module may be created at Module:News media map/doc
local p = {}
function p.main(frame)
  -- local args = frame:getParent().args
  local arr = mw.visualdata.query( 'News media', '[[region::+]]', {}, {} )
-- https://maps.extension.wiki/wiki/Displaying_Leaflet_maps
-- Location~Popup title~Popup text~File:CustomIcon~Group~Inline label~File:VisitedIcon
  local ret = {}
  for i,v in ipairs(arr) do
local v_ = v.data.region .. ',' .. v.data.country .. '~'.. v.data.name .. '~' .. v.data.region .. ' (' .. v.data.country .. ')' .. '~~' .. v.data.region .. '-' .. v.data.country .. '~'.. v.data.name .. '~'
    table.insert(ret, v_)
--ret[#ret + 1] = string.gsub(v_, "^%s*(.-)%s*$", "%1")
   
  end
-- return string.gsub(ret, "^%s*(.-)%s*$", "%1")
 return  table.concat(ret, '\n' )
--   Gent, Belgie~The city Ghent~Ghent is awesome~ ~ ~Ghent
 --  Brussel~The city Brussel~The capital of Belgium~ ~ ~Brussels
 --  Antwerp~The city Antwerp~ ~ ~ ~Antwerp
--   return mw.text.jsonEncode(ret)
end
return p