Modul:Common: Unterschied zwischen den Versionen

keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 4: Zeile 4:
-- Draws a simple Table that contains all arguments that are fed from the
-- Draws a simple Table that contains all arguments that are fed from the
-- template to the scribunto-model. For debugging only!
-- template to the scribunto-model. For debugging only!
t='<table class="wikitable">'
local t='<table class="wikitable">'
for i, v in pairs(args) do
for i, v in pairs(args) do
t = t .. '<tr><td>[[Attribut:' .. i .. '|' .. i .. ']]</td>' ..
t = t .. '<tr><td>[[Attribut:' .. i .. '|' .. i .. ']]</td>' ..
Zeile 40: Zeile 40:
function p.getPageName(frame)
function p.getPageName(frame)
-- This is for unlinking semantic attributes with datatype site.
-- This is for unlinking semantic attributes with datatype site.
p = frame.args[1] or ""
local p = frame.args[1] or ""
-- Throw away all text after |
-- Throw away all text after |
t = mw.ustring.match(p, "([^|]+)")
local t = mw.ustring.match(p, "([^|]+)")
-- Throw away everything before [[:
-- Throw away everything before [[:
t = mw.ustring.match(t, "%[%[:(.+)")
t = mw.ustring.match(t, "%[%[:(.+)")
Zeile 70: Zeile 69:
function getMonthnr(name)  
function getMonthnr(name)  
-- Returns the number of the given monthname  
-- Returns the number of the given monthname  
months = getMonthList()
local months = getMonthList()
for nr, mn in pairs(months) do
for nr, mn in pairs(months) do
if mn == name then
if mn == name then
Zeile 96: Zeile 95:


function get_key_for_value( t, value )
function get_key_for_value( t, value )
   for k,v in pairs(t) do
   for k, v in pairs(t) do
     if v==value then return k end
     if v==value then return k end
   end
   end
Zeile 143: Zeile 142:
function split(s, d)
function split(s, d)
if d==nil then d="%s" end
if d==nil then d="%s" end
local arr={}
arr={}
local n=0
n=0
for i in string.gmatch(s, "[^"..d.."]+") do
for i in string.gmatch(s, "[^"..d.."]+") do
arr[n]=i
arr[n]=i
Zeile 154: Zeile 152:


function p.spaces(frame)
function p.spaces(frame)
n = tonumber(frame.args[1])
local n = tonumber(frame.args[1])
s = ""
local s = ""
for i=0, n do
for i=0, n do
s = s .. '&nbsp;'
s = s .. '&nbsp;'
82.367

Bearbeitungen