To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Module:ChangeLog: Difference between revisions

From ZNC
Jump to navigation Jump to search
Created page with "local p = {} function p.hello(frame) return 'Hello' end return p"
 
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}
function p.hello(frame)
 
     return 'Hello'
function p.prev(frame)
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local found = nil
  for i = 2, #versions, 1 do
    if versions[i] == frame.args.this then
      found = i - 1
      break
    end
  end
  if found == nil then
     return ''
  end
  local result, num = mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
  return result
end
end
function p.next(frame)
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local found = nil
  for i = 1, #versions - 1, 1 do
    if versions[i] == frame.args.this then
      found = i + 1
      break
    end
  end
  if found == nil then
    return ''
  end
  local result, num = mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
  return result
end
function p.stability(frame)
  local stable = frame:expandTemplate{title='ZNC-Version'}
  if stable == frame.args.this then
    return 'stable'
  end
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local result = 'old'
  for i = 1, #versions, 1 do
    mw.log(i, versions[i], frame.args.this)
    if versions[i] == frame.args.this then
      return result
    elseif versions[i] == stable then
      result = 'unstable'
    end
  end
  return 'unknown'
end
function p.debug()
  -- =p.stability(p.debug())
  local frame = {}
  function frame:expandTemplate(args)
    if args.title == 'ZNC-Version' then
      return '2'
    elseif args.title == 'ZNC-Versions' then
      return '2 3 4 5 6'
    end
    return 'no'
  end
  frame.args = {}
  frame.args.this = '6'
  frame.args.template = '<XXX>'
  return frame
end
return p
return p

Latest revision as of 09:49, 2 April 2017

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

local p = {}

function p.prev(frame)
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local found = nil
  for i = 2, #versions, 1 do
    if versions[i] == frame.args.this then
      found = i - 1
      break
    end
  end
  if found == nil then
    return ''
  end
  local result, num = mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
  return result
end

function p.next(frame)
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local found = nil
  for i = 1, #versions - 1, 1 do
    if versions[i] == frame.args.this then
      found = i + 1
      break
    end
  end
  if found == nil then
    return ''
  end
  local result, num = mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
  return result
end

function p.stability(frame)
  local stable = frame:expandTemplate{title='ZNC-Version'}
  if stable == frame.args.this then
    return 'stable'
  end
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local result = 'old'
  for i = 1, #versions, 1 do
    mw.log(i, versions[i], frame.args.this)
    if versions[i] == frame.args.this then
      return result
    elseif versions[i] == stable then
      result = 'unstable'
    end
  end
  return 'unknown'
end

function p.debug()
  -- =p.stability(p.debug())
  local frame = {}
  function frame:expandTemplate(args)
    if args.title == 'ZNC-Version' then
      return '2'
    elseif args.title == 'ZNC-Versions' then
      return '2 3 4 5 6'
    end
    return 'no'
  end
  frame.args = {}
  frame.args.this = '6'
  frame.args.template = '<XXX>'
  return frame
end

return p