Modul:TemplUtl: Unterschied zwischen den Versionen

571 Bytes hinzugefügt ,  3. Juli 2020
K
21 Versionen importiert: Doku-Vorlage
(2019-11-12)
K (21 Versionen importiert: Doku-Vorlage)
 
(Eine dazwischenliegende Version von einem anderen Benutzer wird nicht angezeigt)
Zeile 1: Zeile 1:
local TemplUtl = { suite  = "TemplUtl",
local TemplUtl = { suite  = "TemplUtl",
                   serial = "2019-11-12",
                   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.L10N then
                 if not TemplUtl.boolang then
                     local lucky;
                    -- TODO: page language
                     s = string.format( "Module:%s/local",
                     local l, d = pcall( mw.ext.data.get, "i18n/01.tab" );
                                      TemplUtl.suite );
                     if type( d ) == "table"  and
                     lucky, TemplUtl.L10N = pcall( mw.loadData, s );
                      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.L10N ) == "table" then
                 if type( TemplUtl.boolang ) == "table" then
                     local entry;
                     s = TemplUtl.boolang[ r ];
                     if not TemplUtl.lang then
                     if type( s ) == "boolean" then
                         -- TODO: page language
                         r = s;
                        TemplUtl.lang =
                              mw.language.getContentLanguage():getCode();
                     end
                     end
                    entry = TemplUtl.L10N[ TemplUtl.lang ];
                    if type( entry ) == "table" then
                        s = entry[ r ];
                        if type( s ) == "boolean" then
                            r = s;
                        end
                    end
                else
                    TemplUtl.L10N = true;
                 end
                 end
                 if type( r ) ~= "boolean" then
                 if type( r ) ~= "boolean" then
                     if type( another ) ~= "nil" 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 );
                    else
                        r = true;
                     end
                     end
                 end
                 end
Zeile 696: Zeile 706:
                                                                 item ) )
                                                                 item ) )
             if type( entity ) == "table" then
             if type( entity ) == "table" then
                 local vsn = entity:formatPropertyValues( "P348" )
                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