Modul:RO: Unterschied zwischen den Versionen

Aus ipsc.de
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 43: Zeile 43:
  local page = 'RO:' .. page
  local page = 'RO:' .. page
  local ret = ''
  local ret = ''
  --ret = punktesumme(ro)
  ret = p.punktesumme(frame)
  return ret
  return ret
end
end


return p
return p

Version vom 21. Dezember 2020, 17:46 Uhr

Die Dokumentation für dieses Modul kann unter Modul:RO/Doku erstellt werden

local p = {}

function p.next(frame)
 local page = frame.args[1]
 title  = mw.title .new(page)
 pt = title:getContent()
 local match = os.date('%y')..'%-%d%d%-(%d%d+)'
 local new = 1
 for w in string.gmatch(pt, match) do
  local num = tonumber(w)
  if num >= new then
   new = num + 1
  end
 end
 local lv = tonumber(string.match(page, '%d+'))
 local out = os.date('%y')..'-'..string.format("%02i", lv)..'-'..string.format("%02i", new)
 return out
end

function p.punktesumme(frame)
 local ro = frame.args[1]
 local jahr = frame.args[2]
 local typ = frame.args[3]
 local page = 'RO:' .. page
 if jahr == nil or jahr == "" then
  jahr = '%w+'
 end
 if typ == nil or typ == "" then
  typ = '%wW'
 end
 title  = mw.title .new(page)
 pt = title:getContent()
 local punkte = 0
 for w in string.gmatch(pt, '| Punkte%s+'..typ..'%s+'..jahr..'%s+=%s+(%d+)') do
  local num = tonumber(w)
  punkte = punkte + num
 end
 return punkte
end

function p.bgcolor(frame)
 local ro = frame.args[1]
 local page = 'RO:' .. page
 local ret = ''
 ret = p.punktesumme(frame)
 return ret
end

return p