Difference between revisions of "Module:IDs"

From Taskman Wiki
Jump to navigation Jump to search
m
m
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local p = {};
 
local p = {};
  
function p.run(frame)
+
function p.makeList(frame)
   local ids = frame.args[1]
+
   local ids = frame:getParent().args[1]
   local ret = "<span style=\"font-family: monospace; font-size: 13px;\">"
+
   local ret = '<span class="tw-id">'
   for id in string.gmatch(ids, "([A-Z0-9]{4,})(?:,|$)") do
+
   for v in string.gmatch(ids, "([A-Z0-9]+)") do
     ret = ret .. id .. utf8.char(2002)
+
     ret = ret .. linkID(v) .. " "
 
   end
 
   end
 
   return ret .. "</span>"
 
   return ret .. "</span>"
 
end
 
end
 +
 +
function p.makeId(frame)
 +
  return '<span class="tw-id">' .. linkID(frame:getParent().args[1]) .. "</span>"
 +
end
 +
 +
function p.makeInternalLinkId(frame)
 +
  return "[[" .. frame:getParent().args[1] .. '|<span class="tw-id">' .. frame:getParent().args[1] .. "</span>]]"
 +
end
 +
 +
function linkID(id)
 +
  return id
 +
end
 +
 +
return p

Latest revision as of 06:25, 20 May 2020

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

local p = {};

function p.makeList(frame)
  local ids = frame:getParent().args[1]
  local ret = '<span class="tw-id">'
  for v in string.gmatch(ids, "([A-Z0-9]+)") do
    ret = ret .. linkID(v) .. " "
  end
  return ret .. "</span>"
end

function p.makeId(frame)
  return '<span class="tw-id">' .. linkID(frame:getParent().args[1]) .. "</span>"
end

function p.makeInternalLinkId(frame)
  return "[[" .. frame:getParent().args[1] .. '|<span class="tw-id">' .. frame:getParent().args[1] .. "</span>]]"
end

function linkID(id)
  return id
end

return p