Modul:TemplUtl: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
2019-11-20
(2019-11-12) |
(2019-11-20) |
||
Zeile 1: | Zeile 1: | ||
local TemplUtl = { suite = "TemplUtl", | local TemplUtl = { suite = "TemplUtl", | ||
serial = "2019-11- | serial = "2019-11-20", | ||
item = 52364930 }; | item = 52364930 }; | ||
local Failsafe = TemplUtl; | local Failsafe = TemplUtl; | ||
Zeile 103: | Zeile 103: | ||
r = false; | r = false; | ||
else | else | ||
if not TemplUtl. | if not TemplUtl.boolang then | ||
local | -- TODO: page language | ||
s = string. | local l, d = pcall( mw.ext.data.get, "i18n/01.tab" ); | ||
if type( d ) == "table" and | |||
type( d.data ) == "table" then | |||
local f = function ( at ) | |||
local e = d.data[ at ]; | |||
l = e[ 1 ]; | |||
s = e[ 2 ]; | |||
if type( l ) == "boolean" and | |||
type( s ) == "string" then | |||
s = mw.text.split( s, "|" ); | |||
for i = 1, #s do | |||
TemplUtl.boolang[ s[ i ] ] = l; | |||
end -- for i | |||
end | |||
end | |||
TemplUtl.boolang = { }; | |||
f( 1 ); | |||
f( 2 ); | |||
else | |||
TemplUtl.boolang = true; | |||
end | |||
end | end | ||
if type( TemplUtl. | if type( TemplUtl.boolang ) == "table" then | ||
s = TemplUtl.boolang[ r ]; | |||
if | if type( s ) == "boolean" then | ||
r = s; | |||
end | end | ||
end | end | ||
if type( r ) ~= "boolean" then | if type( r ) ~= "boolean" then | ||
s = type( another ); | |||
if s == "nil" then | |||
r = true; | |||
elseif s == "boolean" then | |||
r = another; | |||
else | |||
r = TemplUtl.faculty( another ); | r = TemplUtl.faculty( another ); | ||
end | end | ||
end | end | ||
Zeile 696: | Zeile 706: | ||
item ) ) | item ) ) | ||
if type( entity ) == "table" then | if type( entity ) == "table" then | ||
local vsn = entity:formatPropertyValues( | local seek = Failsafe.serialProperty or "P348" | ||
local vsn = entity:formatPropertyValues( seek ) | |||
if type( vsn ) == "table" and | if type( vsn ) == "table" and | ||
type( vsn.value ) == "string" and | type( vsn.value ) == "string" and |