<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://de.wikijournal.org/w-wiki/index.php?action=history&amp;feed=atom&amp;title=Modul%3ATemplUtl</id>
	<title>Modul:TemplUtl - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://de.wikijournal.org/w-wiki/index.php?action=history&amp;feed=atom&amp;title=Modul%3ATemplUtl"/>
	<link rel="alternate" type="text/html" href="https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;action=history"/>
	<updated>2026-04-19T08:20:22Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in WikiJournal</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;diff=271&amp;oldid=prev</id>
		<title>Philip: 1 Version importiert</title>
		<link rel="alternate" type="text/html" href="https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;diff=271&amp;oldid=prev"/>
		<updated>2025-02-05T06:57:48Z</updated>

		<summary type="html">&lt;p&gt;1 Version importiert&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 5. Februar 2025, 09:57 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;de&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(kein Unterschied)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikijournal_org-de__:diff:1.41:old-147:rev-271 --&gt;
&lt;/table&gt;</summary>
		<author><name>Philip</name></author>
	</entry>
	<entry>
		<id>https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;diff=147&amp;oldid=prev</id>
		<title>Admin: Die Seite wurde neu angelegt: „local TemplUtl = { suite  = &quot;TemplUtl&quot;,                    serial = &quot;2022-05-16&quot;,                    item   = 52364930 }; --[=[ Utilities to support template programming. ]=] local Failsafe = TemplUtl;    local fallible = function ( adjust, ahead )     -- Check for leading character disturbing syntax     -- Precondition:     --    adjust  -- string; trimmed wikitext     --    ahead   -- true, if leading syntax shall start on new line     -- Postcondition:…“</title>
		<link rel="alternate" type="text/html" href="https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;diff=147&amp;oldid=prev"/>
		<updated>2023-03-23T14:40:39Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „local TemplUtl = { suite  = &amp;quot;TemplUtl&amp;quot;,                    serial = &amp;quot;2022-05-16&amp;quot;,                    item   = 52364930 }; --[=[ Utilities to support template programming. ]=] local Failsafe = TemplUtl;    local fallible = function ( adjust, ahead )     -- Check for leading character disturbing syntax     -- Precondition:     --    adjust  -- string; trimmed wikitext     --    ahead   -- true, if leading syntax shall start on new line     -- Postcondition:…“&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 23. März 2023, 17:40 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;de&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(kein Unterschied)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wikijournal_org-de__:diff:1.41:old-270:rev-147 --&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
	<entry>
		<id>https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;diff=270&amp;oldid=prev</id>
		<title>__de&gt;PerfektesChaos: 2022-05-16</title>
		<link rel="alternate" type="text/html" href="https://de.wikijournal.org/w-wiki/index.php?title=Modul:TemplUtl&amp;diff=270&amp;oldid=prev"/>
		<updated>2022-05-17T14:07:36Z</updated>

		<summary type="html">&lt;p&gt;2022-05-16&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local TemplUtl = { suite  = &amp;quot;TemplUtl&amp;quot;,&lt;br /&gt;
                   serial = &amp;quot;2022-05-16&amp;quot;,&lt;br /&gt;
                   item   = 52364930 };&lt;br /&gt;
--[=[&lt;br /&gt;
Utilities to support template programming.&lt;br /&gt;
]=]&lt;br /&gt;
local Failsafe = TemplUtl;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local fallible = function ( adjust, ahead )&lt;br /&gt;
    -- Check for leading character disturbing syntax&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --    adjust  -- string; trimmed wikitext&lt;br /&gt;
    --    ahead   -- true, if leading syntax shall start on new line&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns string, modified if necessary&lt;br /&gt;
    local r = adjust;&lt;br /&gt;
    local c = r:byte( 1, 1 );&lt;br /&gt;
    local lead;&lt;br /&gt;
    if c &amp;lt;= 59  and&lt;br /&gt;
       ( c==35 or c==42 or c==58 or c==59 ) then&lt;br /&gt;
        lead = true;&lt;br /&gt;
    elseif c == 123  or  c == 124 then&lt;br /&gt;
        local c2 = r:byte( 2, 1 );&lt;br /&gt;
        if c == 123  and  c2 == 124 then&lt;br /&gt;
            lead = true;&lt;br /&gt;
        elseif ahead  and  c == 124  and&lt;br /&gt;
               ( c2 == 43  or  c2 == 45  or  c2 == 125 ) then&lt;br /&gt;
            lead = true;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if lead then&lt;br /&gt;
        if ahead then&lt;br /&gt;
            r = &amp;quot;\n&amp;quot; .. r;&lt;br /&gt;
        else&lt;br /&gt;
            r = mw.text.nowiki( r:sub( 1, 1 ) )  ..  r:sub( 2 );&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r;&lt;br /&gt;
end -- fallible()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local fiatTitleRegExp = function ( accept )&lt;br /&gt;
    -- Create pattern to detect page name&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     accept  -- string; trimmed title&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns string with pattern&lt;br /&gt;
    local start = mw.ustring.sub( accept, 1, 1 );&lt;br /&gt;
    local r;&lt;br /&gt;
    if mw.ustring.match( start, &amp;quot;%a&amp;quot; ) then&lt;br /&gt;
        r = string.format( &amp;quot;[%s%s]%s&amp;quot;,&lt;br /&gt;
                           mw.ustring.lower( start ),&lt;br /&gt;
                           mw.ustring.upper( start ),&lt;br /&gt;
                           mw.ustring.sub( accept, 2 ) );&lt;br /&gt;
    else&lt;br /&gt;
        r = accept;&lt;br /&gt;
    end&lt;br /&gt;
    if r:match( &amp;quot; &amp;quot; ) then&lt;br /&gt;
        r = r:gsub( &amp;quot;%&amp;quot;, &amp;quot;%%&amp;quot; )&lt;br /&gt;
             :gsub( &amp;quot;[%-^.?+*()$]&amp;quot;, &amp;quot;%$1&amp;quot; )&lt;br /&gt;
             :gsub( &amp;quot;_&amp;quot;, &amp;quot; &amp;quot; )&lt;br /&gt;
             :gsub( &amp;quot;%s+&amp;quot;, &amp;quot;[%s_]+&amp;quot; );&lt;br /&gt;
    end&lt;br /&gt;
    return r;&lt;br /&gt;
end -- fiatTitleRegExp()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local framing = function ( frame )&lt;br /&gt;
    -- Ensure availability of frame object&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     frame  -- object; #invoke environment, or false&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --     Return frame object&lt;br /&gt;
    if not TemplUtl.frame then&lt;br /&gt;
        if type( frame ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
            TemplUtl.frame = frame;&lt;br /&gt;
        else&lt;br /&gt;
            TemplUtl.frame = mw.getCurrentFrame();&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return TemplUtl.frame;&lt;br /&gt;
end -- framing()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.facets = function ( ask, adjust )&lt;br /&gt;
    local r = ask;&lt;br /&gt;
    if adjust == &amp;quot;%&amp;quot;  and  r:find( &amp;quot;%%%x%x&amp;quot; ) then&lt;br /&gt;
        r = mw.uri.decode( r, &amp;quot;PATH&amp;quot; );&lt;br /&gt;
    elseif r:find( &amp;quot;&amp;amp;&amp;quot;, 1, true ) then&lt;br /&gt;
        r = mw.text.decode( r );&lt;br /&gt;
    end&lt;br /&gt;
    r = mw.ustring.gsub( r, &amp;quot;[%s%p%c]+&amp;quot;, &amp;quot; &amp;quot; );&lt;br /&gt;
    r = mw.text.trim( r );&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.facets()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.faculty = function ( analyze, another )&lt;br /&gt;
    -- Test template arg for boolean&lt;br /&gt;
    --     analyze  -- string, boolean, number or nil&lt;br /&gt;
    --     another  -- fallback: string, boolean, or nil&lt;br /&gt;
    --                 &amp;quot;-&amp;quot; to test for explicit vocabulary choice&lt;br /&gt;
    -- Returns boolean, or &amp;quot;-&amp;quot;&lt;br /&gt;
    local s = type( analyze );&lt;br /&gt;
    local r;&lt;br /&gt;
    if s == &amp;quot;string&amp;quot; then&lt;br /&gt;
        r = mw.text.trim( analyze );&lt;br /&gt;
        if r == &amp;quot;&amp;quot;  then&lt;br /&gt;
            r = TemplUtl.faculty( another, nil );&lt;br /&gt;
        elseif r:find( &amp;quot;1&amp;quot;, 1, true )  and&lt;br /&gt;
               r:match( &amp;quot;^[0%-]*1[01%-]*$&amp;quot; ) then&lt;br /&gt;
            r = true;&lt;br /&gt;
        elseif r:match( &amp;quot;^[0%-]+$&amp;quot; ) then&lt;br /&gt;
            r = false;&lt;br /&gt;
        else&lt;br /&gt;
            r = r:lower();&lt;br /&gt;
            if r == &amp;quot;y&amp;quot;  or&lt;br /&gt;
               r == &amp;quot;yes&amp;quot;  or&lt;br /&gt;
               r == &amp;quot;true&amp;quot;  or&lt;br /&gt;
               r == &amp;quot;on&amp;quot; then&lt;br /&gt;
                r = true;&lt;br /&gt;
            elseif r == &amp;quot;n&amp;quot;  or&lt;br /&gt;
                   r == &amp;quot;no&amp;quot;  or&lt;br /&gt;
                   r == &amp;quot;false&amp;quot;  or&lt;br /&gt;
                   r == &amp;quot;off&amp;quot; then&lt;br /&gt;
                r = false;&lt;br /&gt;
            else&lt;br /&gt;
                if not TemplUtl.boolang then&lt;br /&gt;
                    -- TODO: page language&lt;br /&gt;
                    local l, d = pcall( mw.ext.data.get, &amp;quot;i18n/01.tab&amp;quot; );&lt;br /&gt;
                    if type( d ) == &amp;quot;table&amp;quot;  and&lt;br /&gt;
                       type( d.data ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
                        local f = function ( at )&lt;br /&gt;
                                  local e = d.data[ at ];&lt;br /&gt;
                                  l = e[ 1 ];&lt;br /&gt;
                                  s = e[ 2 ];&lt;br /&gt;
                                  if type( l ) == &amp;quot;boolean&amp;quot;  and&lt;br /&gt;
                                     type( s ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
                                      s = mw.text.split( s, &amp;quot;|&amp;quot; );&lt;br /&gt;
                                      for i = 1, #s do&lt;br /&gt;
                                          TemplUtl.boolang[ s[ i ] ] = l;&lt;br /&gt;
                                      end -- for i&lt;br /&gt;
                                  end&lt;br /&gt;
                              end&lt;br /&gt;
                        TemplUtl.boolang = { };&lt;br /&gt;
                        f( 1 );&lt;br /&gt;
                        f( 2 );&lt;br /&gt;
                    else&lt;br /&gt;
                        TemplUtl.boolang = true;&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
                if type( TemplUtl.boolang ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
                    s = TemplUtl.boolang[ r ];&lt;br /&gt;
                    if type( s ) == &amp;quot;boolean&amp;quot; then&lt;br /&gt;
                        r = s;&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
                if type( r ) ~= &amp;quot;boolean&amp;quot; then&lt;br /&gt;
                    s = type( another );&lt;br /&gt;
                    if s == &amp;quot;nil&amp;quot; then&lt;br /&gt;
                        r = true;&lt;br /&gt;
                    elseif s == &amp;quot;boolean&amp;quot; then&lt;br /&gt;
                        r = another;&lt;br /&gt;
                    elseif s == &amp;quot;string&amp;quot; then&lt;br /&gt;
                        s = mw.text.trim( another );&lt;br /&gt;
                        if s == &amp;quot;-&amp;quot; then&lt;br /&gt;
                            r = &amp;quot;-&amp;quot;;&lt;br /&gt;
                        elseif s == &amp;quot;&amp;quot; then&lt;br /&gt;
                            r = true;&lt;br /&gt;
                        else&lt;br /&gt;
                            r = TemplUtl.faculty( s );&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    elseif s == &amp;quot;boolean&amp;quot; then&lt;br /&gt;
        r = analyze;&lt;br /&gt;
    elseif s == &amp;quot;number&amp;quot; then&lt;br /&gt;
        r = ( analyze ~= 0 );&lt;br /&gt;
    else&lt;br /&gt;
        r = false;&lt;br /&gt;
    end&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.faculty()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.failure = function ( alert, always, addClass, frame )&lt;br /&gt;
    -- Format error message, mostly hidden&lt;br /&gt;
    --     alert     -- string: message&lt;br /&gt;
    --     always    -- boolean, or nil: do not hide&lt;br /&gt;
    --     addClass  -- string, or nil: add classes to element&lt;br /&gt;
    --     frame     -- object, or nil&lt;br /&gt;
    -- Returns string&lt;br /&gt;
    local err  = mw.html.create( &amp;quot;span&amp;quot; )&lt;br /&gt;
                        :addClass( &amp;quot;error&amp;quot; )&lt;br /&gt;
                        :wikitext( alert );&lt;br /&gt;
    local live = ( framing( frame ):preprocess( &amp;quot;{{REVISIONID}}&amp;quot; )&lt;br /&gt;
                   == &amp;quot;&amp;quot; );&lt;br /&gt;
    if type( addClass ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        err:addClass( addClass )&lt;br /&gt;
    end&lt;br /&gt;
    if live then&lt;br /&gt;
        local max  = 1000000000;&lt;br /&gt;
        local id   = math.floor( os.clock() * max );&lt;br /&gt;
        local sign = string.format( &amp;quot;error_%d&amp;quot;, id );&lt;br /&gt;
        local btn  = mw.html.create( &amp;quot;span&amp;quot; );&lt;br /&gt;
        local top  = mw.html.create( &amp;quot;div&amp;quot; );&lt;br /&gt;
        err:attr( &amp;quot;id&amp;quot;, sign );&lt;br /&gt;
        -- TODO: LTR&lt;br /&gt;
        btn:css( { [&amp;quot;background&amp;quot;]      = &amp;quot;#FFFF00&amp;quot;,&lt;br /&gt;
                   [&amp;quot;border&amp;quot;]          = &amp;quot;#FF0000 3px solid&amp;quot;,&lt;br /&gt;
                   [&amp;quot;font-weight&amp;quot;]     = &amp;quot;bold&amp;quot;,&lt;br /&gt;
                   [&amp;quot;padding&amp;quot;]         = &amp;quot;2px&amp;quot;,&lt;br /&gt;
                   [&amp;quot;text-decoration&amp;quot;] = &amp;quot;none&amp;quot; } )&lt;br /&gt;
           :wikitext( &amp;quot;&amp;amp;gt;&amp;amp;gt;&amp;amp;gt;&amp;quot; );&lt;br /&gt;
        sign = string.format( &amp;quot;[[#%s|%s]]&amp;quot;,  sign,  tostring( btn ) );&lt;br /&gt;
        top:wikitext( sign, &amp;quot;&amp;amp;#160;&amp;quot;, alert );&lt;br /&gt;
        mw.addWarning( tostring( top:attr( &amp;quot;role&amp;quot;, &amp;quot;alert&amp;quot; ) ) );&lt;br /&gt;
    elseif not always then&lt;br /&gt;
        err:css( { [&amp;quot;display&amp;quot;]     = &amp;quot;none&amp;quot; } );&lt;br /&gt;
--      err:css( { [&amp;quot;display&amp;quot;]     = &amp;quot;inline-block&amp;quot;,&lt;br /&gt;
--                 [&amp;quot;line-height&amp;quot;] = &amp;quot;0&amp;quot;,&lt;br /&gt;
--                 [&amp;quot;max-height&amp;quot;]  = &amp;quot;0&amp;quot;,&lt;br /&gt;
--                 [&amp;quot;max-width&amp;quot;]   = &amp;quot;0&amp;quot;,&lt;br /&gt;
--                 [&amp;quot;visibility&amp;quot;]  = &amp;quot;hidden&amp;quot; } );&lt;br /&gt;
    end&lt;br /&gt;
    return tostring( err );&lt;br /&gt;
end -- TemplUtl.failure()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.fake = function ( access )&lt;br /&gt;
    -- Simulation of template transclusion&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --    access  -- string; page name (template)&lt;br /&gt;
    if type( access ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local s = mw.text.trim( access );&lt;br /&gt;
        if s ~= &amp;quot;&amp;quot; then&lt;br /&gt;
            local t = mw.title.new( s, 10 );&lt;br /&gt;
            if not mw.title.equals( mw.title.getCurrentTitle(), t )  and&lt;br /&gt;
               t.exists then&lt;br /&gt;
                t:getContent();&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end -- TemplUtl.fake()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.fakes = function ( array, frame, ahead, answer )&lt;br /&gt;
    -- Simulation of template transclusions&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --    array   -- table, with template title strings&lt;br /&gt;
    --    frame   -- object, or nil&lt;br /&gt;
    --    ahead   -- string, or nil, with common prefix&lt;br /&gt;
    --    answer  -- true, or nil, for list creation&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns string, if answer requested&lt;br /&gt;
    local e = framing( frame );&lt;br /&gt;
    local f = function ( a )&lt;br /&gt;
                  e:expandTemplate{ title = a };&lt;br /&gt;
              end&lt;br /&gt;
    local s = ahead or &amp;quot;&amp;quot;;&lt;br /&gt;
    local r;&lt;br /&gt;
    for k, v in pairs( array ) do&lt;br /&gt;
        if type( k ) == &amp;quot;number&amp;quot; and&lt;br /&gt;
           type( v ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
            v = s .. mw.text.trim( v );&lt;br /&gt;
            pcall( f, v );&lt;br /&gt;
            if answer then&lt;br /&gt;
                if r then&lt;br /&gt;
                    r = r .. &amp;quot;\n&amp;quot;;&lt;br /&gt;
                else&lt;br /&gt;
                    r = &amp;quot;&amp;quot;;&lt;br /&gt;
                end&lt;br /&gt;
                r = string.format( &amp;quot;%s* [[Template:%s|%s]]&amp;quot;, r, v, v );&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end -- for k, v&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.fakes()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.feasible = function ( address )&lt;br /&gt;
    -- Does this describe an URL beginning?&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --    address  -- string; what to inspect, URL presumed&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns true, if URL beginning&lt;br /&gt;
    local start, r = address:match( &amp;quot;^%s*((%a*:?)//)&amp;quot; );&lt;br /&gt;
    if start then&lt;br /&gt;
        if r == &amp;quot;&amp;quot; then&lt;br /&gt;
            r = true;&lt;br /&gt;
        elseif r:sub( -1, -1 ) == &amp;quot;:&amp;quot; then&lt;br /&gt;
            local schemes = &amp;quot;:ftp:ftps:http:https:&amp;quot;;&lt;br /&gt;
            r = &amp;quot;:&amp;quot; .. r:lower();&lt;br /&gt;
            if schemes:find( r, 1, true ) then&lt;br /&gt;
                r = true;&lt;br /&gt;
            else&lt;br /&gt;
                r = false;&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            r = false;&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.feasible()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.feed = function ( area, ahead, at, after )&lt;br /&gt;
    -- Detect next free &amp;quot;|&amp;quot; or &amp;quot;}}&amp;quot;&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     area   -- string; template transclusion&lt;br /&gt;
    --     ahead  -- string; opening element, or false&lt;br /&gt;
    --     at     -- number; byte position in area where to start&lt;br /&gt;
    --     after  -- true, if only to search for &amp;quot;}}&amp;quot;&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns&lt;br /&gt;
    --          -- number; byte position in area&lt;br /&gt;
    --             -- before &amp;quot;|&amp;quot; or &amp;quot;}}&amp;quot;, may be at end&lt;br /&gt;
    --             -- to continue search; ahead has been closed&lt;br /&gt;
    --          -- true, if to be continued at number&lt;br /&gt;
    local j    = at;&lt;br /&gt;
    local loop = true;&lt;br /&gt;
    local c, k, r, s, seek;&lt;br /&gt;
    if after then&lt;br /&gt;
        seek = &amp;quot;[{}&amp;lt;]&amp;quot;;&lt;br /&gt;
    else&lt;br /&gt;
        seek = &amp;quot;[%[%]|{}&amp;lt;:]&amp;quot;;&lt;br /&gt;
    end&lt;br /&gt;
    while loop do&lt;br /&gt;
        j = area:find( seek, j );&lt;br /&gt;
        if j then&lt;br /&gt;
            c = area:byte( j, j );&lt;br /&gt;
            if c == 123 then    -- {&lt;br /&gt;
                k = j + 1;&lt;br /&gt;
                if area:byte( k, k ) == 123 then&lt;br /&gt;
                    k = k + 1;&lt;br /&gt;
                    if area:byte( k, k ) == 123 then&lt;br /&gt;
                        j, loop = TemplUtl.feed( area, &amp;quot;{{{&amp;quot;, k, after );&lt;br /&gt;
                    else&lt;br /&gt;
                        k = k - 1;&lt;br /&gt;
                        j, loop = TemplUtl.feed( area, &amp;quot;{{&amp;quot;, k, after );&lt;br /&gt;
                    end&lt;br /&gt;
                    if not loop then&lt;br /&gt;
                        r = j;&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            elseif c == 125 then    -- }&lt;br /&gt;
                k = j + 1;&lt;br /&gt;
                if area:byte( k, k ) == 125 then&lt;br /&gt;
                    if ahead == &amp;quot;{{&amp;quot; then&lt;br /&gt;
                        r = k;&lt;br /&gt;
                        break;    -- while loop;&lt;br /&gt;
                    elseif ahead == &amp;quot;{{{&amp;quot; then&lt;br /&gt;
                        k = k + 1;&lt;br /&gt;
                        if area:byte( k, k ) == 125 then&lt;br /&gt;
                            r = k;&lt;br /&gt;
                            break;    -- while loop;&lt;br /&gt;
                        end&lt;br /&gt;
                    elseif not ahead then&lt;br /&gt;
                        r    = j - 1;&lt;br /&gt;
                        loop = false;&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            elseif c == 60 then    -- &amp;lt;&lt;br /&gt;
                k = j + 3;&lt;br /&gt;
                if area:sub( j, k ) == &amp;quot;&amp;lt;!--&amp;quot; then&lt;br /&gt;
                    k = area:find( &amp;quot;--&amp;gt;&amp;quot;, k );&lt;br /&gt;
                    if k then&lt;br /&gt;
                        j = k + 2;&lt;br /&gt;
                    end&lt;br /&gt;
                else&lt;br /&gt;
                    local skip;&lt;br /&gt;
                    s    = area:sub( j + 1 ):lower();&lt;br /&gt;
                    skip = s:match( &amp;quot;^%s*nowiki%s*&amp;gt;&amp;quot; );&lt;br /&gt;
                    if skip then&lt;br /&gt;
                        local n = skip:len();&lt;br /&gt;
                        n, k = s:find( &amp;quot;&amp;lt;%s*/%s*nowiki%s*&amp;gt;&amp;quot;, n );&lt;br /&gt;
                        if k then&lt;br /&gt;
                            j = j + k;&lt;br /&gt;
                        else&lt;br /&gt;
                            loop = false;&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            elseif c == 124 then    -- |&lt;br /&gt;
                if not r then&lt;br /&gt;
                    r = j - 1;&lt;br /&gt;
                end&lt;br /&gt;
                if not ahead then&lt;br /&gt;
                    loop = false;&lt;br /&gt;
                end&lt;br /&gt;
            elseif c == 91 then    -- [&lt;br /&gt;
                k = j + 1;&lt;br /&gt;
                if area:byte( k, k ) == 91 then&lt;br /&gt;
                    k = k + 1;&lt;br /&gt;
                    j, loop = TemplUtl.feed( area, &amp;quot;[[&amp;quot;, k, after );&lt;br /&gt;
                elseif TemplUtl.feasible( area:sub( k ) ) then&lt;br /&gt;
                    k = k + 3;&lt;br /&gt;
                    j, loop = TemplUtl.feed( area, &amp;quot;[&amp;quot;, k, after );&lt;br /&gt;
                end&lt;br /&gt;
                if not loop then&lt;br /&gt;
                    r = j;&lt;br /&gt;
                end&lt;br /&gt;
            elseif c == 93 then    -- ]&lt;br /&gt;
                if ahead == &amp;quot;[&amp;quot; then&lt;br /&gt;
                    r = j;&lt;br /&gt;
                    break;    -- while loop&lt;br /&gt;
                elseif ahead == &amp;quot;[[&amp;quot; then&lt;br /&gt;
                    k = j + 1;&lt;br /&gt;
                    if area:byte( k, k ) == 93 then&lt;br /&gt;
                        r = k;&lt;br /&gt;
                        break;    -- while loop&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            elseif c == 58 then    -- :&lt;br /&gt;
                s = area:sub( j + 1,  j + 2 );&lt;br /&gt;
                if s == &amp;quot;//&amp;quot; then&lt;br /&gt;
                    s = &amp;quot; &amp;quot; .. area:sub( 1,  j + 2 );&lt;br /&gt;
                    s = s:match( &amp;quot;%s(%a+://)$&amp;quot; );&lt;br /&gt;
                    if s  and  TemplUtl.feasible( s ) then&lt;br /&gt;
                        s = area .. &amp;quot; &amp;quot;;&lt;br /&gt;
                        s = s:match( &amp;quot;([^%s|]+)%s&amp;quot;, j );&lt;br /&gt;
                        if s then&lt;br /&gt;
                            k = s:find( &amp;quot;}}&amp;quot; );&lt;br /&gt;
                            if k then&lt;br /&gt;
                                j = j + k + 1;&lt;br /&gt;
                            else&lt;br /&gt;
                                j = j + s:len();&lt;br /&gt;
                            end&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            j = j + 1;&lt;br /&gt;
        else&lt;br /&gt;
            loop = false;&lt;br /&gt;
        end&lt;br /&gt;
    end -- while loop&lt;br /&gt;
    if not r then&lt;br /&gt;
        r = area:len();&lt;br /&gt;
    end&lt;br /&gt;
    return r, loop;&lt;br /&gt;
end -- TemplUtl.feed()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.feeder = function ( area, at )&lt;br /&gt;
    -- Retrieve all parameters&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     area   -- string; template transclusion&lt;br /&gt;
    --     at     -- optional number; byte position in area of &amp;quot;{{&amp;quot;&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns&lt;br /&gt;
    --          -- table&lt;br /&gt;
    --              [0]       -- template, page, parser function name&lt;br /&gt;
    --              [1]       -- unnamed parameter&lt;br /&gt;
    --              [&amp;quot;name&amp;quot;]  -- named parameter&lt;br /&gt;
    --          -- string; error message, if any, else nil&lt;br /&gt;
    local n = 0;&lt;br /&gt;
    local j, k, p, r, r2, s, v;&lt;br /&gt;
    if type( at ) == &amp;quot;number&amp;quot; then&lt;br /&gt;
        j = at + 2;&lt;br /&gt;
    else&lt;br /&gt;
        j = 3;&lt;br /&gt;
    end&lt;br /&gt;
    while true do&lt;br /&gt;
        k = TemplUtl.feed( area, false, j );&lt;br /&gt;
        s = area:sub( j, k );&lt;br /&gt;
        s = s:gsub( &amp;quot;&amp;lt;!--.*--&amp;gt;&amp;quot;, &amp;quot;&amp;quot; );&lt;br /&gt;
        if n == 0 then&lt;br /&gt;
            r = { [ 0 ] = s };&lt;br /&gt;
            n = 1;&lt;br /&gt;
        else&lt;br /&gt;
            p, v = s:match( &amp;quot;^([^=]*)=(.*)$&amp;quot; );&lt;br /&gt;
            if p then&lt;br /&gt;
                if p:match( &amp;quot;^%s*%d+%s*$&amp;quot; )  then&lt;br /&gt;
                    p = tonumber( p );&lt;br /&gt;
                else&lt;br /&gt;
                    p = mw.text.trim( p );&lt;br /&gt;
                end&lt;br /&gt;
                v = mw.text.trim( v );&lt;br /&gt;
            else&lt;br /&gt;
                p = n;&lt;br /&gt;
                v = s;&lt;br /&gt;
                n = n + 1;&lt;br /&gt;
            end&lt;br /&gt;
            if r[ p ] then&lt;br /&gt;
                if r2 then&lt;br /&gt;
                    r2 = r2 .. &amp;quot; * &amp;quot;;&lt;br /&gt;
                else&lt;br /&gt;
                    r2 = &amp;quot;&amp;quot;;&lt;br /&gt;
                end&lt;br /&gt;
                r2 = string.format( &amp;quot;%s%s &amp;#039;%s&amp;#039;&amp;quot;,&lt;br /&gt;
                                    r2,&lt;br /&gt;
                                    &amp;quot;duplicated parameter&amp;quot;,&lt;br /&gt;
                                    tostring( p ) );&lt;br /&gt;
            end&lt;br /&gt;
            r[ p ] = v;&lt;br /&gt;
        end&lt;br /&gt;
        s = area:sub( k + 1,  k + 2 );&lt;br /&gt;
        if s == &amp;quot;}}&amp;quot; then&lt;br /&gt;
            break;    -- while true&lt;br /&gt;
        elseif s == &amp;quot;&amp;quot; then&lt;br /&gt;
            r2 = &amp;quot;template not closed&amp;quot;;&lt;br /&gt;
            break;    -- while true&lt;br /&gt;
        end&lt;br /&gt;
        j = k + 2;&lt;br /&gt;
    end -- while true&lt;br /&gt;
    return r, r2;&lt;br /&gt;
end -- TemplUtl.feeder()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.fetch = function ( area, ask )&lt;br /&gt;
    -- Find assignment of a named template parameter&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     area  -- string; template transclusion&lt;br /&gt;
    --     ask   -- string; parameter name&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns string with trimmed parameter value, or nil&lt;br /&gt;
    --     Does not return value if template inside&lt;br /&gt;
    local r;&lt;br /&gt;
    local scan = string.format( &amp;quot;%s%s%s&amp;quot;,&lt;br /&gt;
                                &amp;quot;|%s*&amp;quot;, ask, &amp;quot;%s*=(.+)$&amp;quot; );&lt;br /&gt;
    r = mw.ustring.match( area, scan );&lt;br /&gt;
    if r then&lt;br /&gt;
        local j = TemplUtl.feed( r, false, 1 );&lt;br /&gt;
        r = r:sub( 1, j );&lt;br /&gt;
        if r then&lt;br /&gt;
            r = mw.text.trim( r );&lt;br /&gt;
            if r == &amp;quot;&amp;quot; then&lt;br /&gt;
                r = nil;&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.fetch()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.find = function ( area, access, at, alter )&lt;br /&gt;
    -- Find next occurrence of a template&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     area    -- string; where to search&lt;br /&gt;
    --     access  -- string; trimmed (template) title&lt;br /&gt;
    --     at      -- optional number; ustring position in area, if not 1&lt;br /&gt;
    --     alter   -- optional string; lowercase namespace pattern&lt;br /&gt;
    --                                 &amp;quot;&amp;quot; for article&lt;br /&gt;
    --                                 no colon (:)&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns ustring position of &amp;quot;{{&amp;quot; in area, or false&lt;br /&gt;
    -- Requires:&lt;br /&gt;
    --     fiatTitleRegExp()&lt;br /&gt;
    local scan = string.format( &amp;quot;{{%s%s%s&amp;quot;,&lt;br /&gt;
                                &amp;quot;([%w_%s:]*)%s*&amp;quot;,&lt;br /&gt;
                                fiatTitleRegExp( access ),&lt;br /&gt;
                                &amp;quot;%s*([|}&amp;lt;]!?)&amp;quot; );&lt;br /&gt;
    local r, space, start, suffix;&lt;br /&gt;
    if type( at ) == &amp;quot;number&amp;quot; then&lt;br /&gt;
        r = at;&lt;br /&gt;
    else&lt;br /&gt;
        r = 1;&lt;br /&gt;
    end&lt;br /&gt;
    while true do&lt;br /&gt;
        r = mw.ustring.find( area, scan, r );&lt;br /&gt;
        if r then&lt;br /&gt;
            start, suffix = mw.ustring.match( area, scan, r );&lt;br /&gt;
            if start then&lt;br /&gt;
                start = mw.text.trim( start );&lt;br /&gt;
                if start == &amp;quot;&amp;quot; then&lt;br /&gt;
                    break; -- while true&lt;br /&gt;
                elseif alter then&lt;br /&gt;
                    if not space then&lt;br /&gt;
                        space = string.format( &amp;quot;^:?%s:$&amp;quot;, alter );&lt;br /&gt;
                    end&lt;br /&gt;
                    start = mw.ustring.lower( start );&lt;br /&gt;
                    if mw.ustring.match( start, space ) then&lt;br /&gt;
                        break; -- while true&lt;br /&gt;
                    end&lt;br /&gt;
                else&lt;br /&gt;
                    start = start:match( &amp;quot;^:?(.+):$&amp;quot; );&lt;br /&gt;
                    if start then&lt;br /&gt;
                        start = mw.ustring.lower( start );&lt;br /&gt;
                        if start == &amp;quot;template&amp;quot; then&lt;br /&gt;
                            break; -- while true&lt;br /&gt;
                        else&lt;br /&gt;
                            if not space then&lt;br /&gt;
                                space = mw.site.namespaces[ 10 ].name;&lt;br /&gt;
                                space = mw.ustring.lower( space );&lt;br /&gt;
                            end&lt;br /&gt;
                            start = start:gsub( &amp;quot;_&amp;quot;, &amp;quot; &amp;quot; )&lt;br /&gt;
                                         :gsub( &amp;quot;%s+&amp;quot;, &amp;quot; &amp;quot; );&lt;br /&gt;
                            if start == space then&lt;br /&gt;
                                break; -- while true&lt;br /&gt;
                            end&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                break; -- while true&lt;br /&gt;
            end&lt;br /&gt;
            r = r + 2;&lt;br /&gt;
        else&lt;br /&gt;
            r = false;&lt;br /&gt;
            break; -- while true&lt;br /&gt;
        end&lt;br /&gt;
    end -- while true&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.find()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- finder()&lt;br /&gt;
--      1 page name&lt;br /&gt;
--      2 template title / page name&lt;br /&gt;
--      3 4 5 6&lt;br /&gt;
--        more like 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.firstbreak = function ( adjust )&lt;br /&gt;
    -- Precede leading character with newline if specific syntax&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --    adjust  -- string; trimmed wikitext&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns string, modified if necessary&lt;br /&gt;
    return fallible( adjust, true );&lt;br /&gt;
end -- TemplUtl.firstbreak()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.flat = function ( area )&lt;br /&gt;
    -- Remove syntax elements that hide effective syntax only&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     area  -- string; unparsed wikitext to be reduced&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns cleared wikitext&lt;br /&gt;
    local delimiters = { { &amp;quot;&amp;lt;%s*NOWIKI%s*&amp;gt;&amp;quot;, &amp;quot;&amp;lt;%s*/%s*NOWIKI%s*&amp;gt;&amp;quot; },&lt;br /&gt;
                         { &amp;quot;&amp;lt;!--&amp;quot;, &amp;quot;--&amp;gt;&amp;quot;, true },&lt;br /&gt;
                         { &amp;quot;&amp;lt;%s*PRE%s*&amp;gt;&amp;quot;, &amp;quot;&amp;lt;%s*/%s*PRE%s*&amp;gt;&amp;quot; },&lt;br /&gt;
                         { &amp;quot;&amp;lt;%s*SYNTAXHIGHLIGHT[^&amp;lt;&amp;gt;]*&amp;gt;&amp;quot;,&lt;br /&gt;
                           &amp;quot;&amp;lt;%s*/%s*SYNTAXHIGHLIGHT%s*&amp;gt;&amp;quot; } };&lt;br /&gt;
    local i          = 1;&lt;br /&gt;
    local r          = area;&lt;br /&gt;
    local k, m, n;&lt;br /&gt;
    if not TemplUtl.Delimiters then&lt;br /&gt;
        local c, sD, sP;&lt;br /&gt;
        TemplUtl.Delimiters = { };&lt;br /&gt;
        for j = 1, #delimiters do&lt;br /&gt;
            table.insert( TemplUtl.Delimiters, { } );&lt;br /&gt;
            for ji = 1, 2 do&lt;br /&gt;
                sD = delimiters[ j ][ ji ];&lt;br /&gt;
                sP = &amp;quot;&amp;quot;;&lt;br /&gt;
                for js = 1, #sD, 1 do&lt;br /&gt;
                    c = sD:byte( js, js );&lt;br /&gt;
                    if c &amp;gt;= 65  and  c &amp;lt;= 90 then&lt;br /&gt;
                        sP = string.format( &amp;quot;%s[%c%c]&amp;quot;,&lt;br /&gt;
                                            sP,  c,  c + 32 );&lt;br /&gt;
                    else&lt;br /&gt;
                        sP = sP .. string.char( c );&lt;br /&gt;
                    end&lt;br /&gt;
                end -- for js&lt;br /&gt;
                table.insert( TemplUtl.Delimiters[ j ], sP );&lt;br /&gt;
            end -- for ji&lt;br /&gt;
        end -- for j&lt;br /&gt;
    end&lt;br /&gt;
    while ( true ) do&lt;br /&gt;
        k = false;&lt;br /&gt;
        for j = 1, #delimiters do&lt;br /&gt;
            m = r:find( TemplUtl.Delimiters[ j ][ 1 ],&lt;br /&gt;
                        i,&lt;br /&gt;
                        TemplUtl.Delimiters[ j ][ 3 ] );&lt;br /&gt;
            if m  and  ( not k  or  m &amp;lt; k ) then&lt;br /&gt;
                k = m;&lt;br /&gt;
                n = j;&lt;br /&gt;
            end&lt;br /&gt;
        end -- for j&lt;br /&gt;
        if k then&lt;br /&gt;
            local s&lt;br /&gt;
            if k &amp;gt; 1 then&lt;br /&gt;
                i = k - 1;&lt;br /&gt;
                s = r:sub( 1, i );&lt;br /&gt;
            else&lt;br /&gt;
                s = &amp;quot;&amp;quot;;&lt;br /&gt;
            end&lt;br /&gt;
            j, m  =  r:find( TemplUtl.Delimiters[ n ][ 2 ],&lt;br /&gt;
                             k + 1,&lt;br /&gt;
                             TemplUtl.Delimiters[ n ][ 3 ] );&lt;br /&gt;
            if m then&lt;br /&gt;
                r = s  ..  r:sub( m + 1 );&lt;br /&gt;
            else&lt;br /&gt;
                r = s;&lt;br /&gt;
                break; -- while true&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            break; -- while true&lt;br /&gt;
        end&lt;br /&gt;
    end -- while true&lt;br /&gt;
    return r;&lt;br /&gt;
end -- TemplUtl.flat()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TemplUtl.nowiki1 = function ( adjust )&lt;br /&gt;
    -- HTML-escape leading character if disturbing syntax&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --    adjust  -- string; trimmed wikitext&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --    Returns string, modified if necessary&lt;br /&gt;
    return fallible( adjust, false );&lt;br /&gt;
end -- TemplUtl.nowiki1()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Failsafe.failsafe = function ( atleast )&lt;br /&gt;
    -- Retrieve versioning and check for compliance&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     atleast  -- string, with required version&lt;br /&gt;
    --                         or wikidata|item|~|@ or false&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --     Returns  string  -- with queried version/item, also if problem&lt;br /&gt;
    --              false   -- if appropriate&lt;br /&gt;
    -- 2020-08-17&lt;br /&gt;
    local since = atleast&lt;br /&gt;
    local last    = ( since == &amp;quot;~&amp;quot; )&lt;br /&gt;
    local linked  = ( since == &amp;quot;@&amp;quot; )&lt;br /&gt;
    local link    = ( since == &amp;quot;item&amp;quot; )&lt;br /&gt;
    local r&lt;br /&gt;
    if last  or  link  or  linked  or  since == &amp;quot;wikidata&amp;quot; then&lt;br /&gt;
        local item = Failsafe.item&lt;br /&gt;
        since = false&lt;br /&gt;
        if type( item ) == &amp;quot;number&amp;quot;  and  item &amp;gt; 0 then&lt;br /&gt;
            local suited = string.format( &amp;quot;Q%d&amp;quot;, item )&lt;br /&gt;
            if link then&lt;br /&gt;
                r = suited&lt;br /&gt;
            else&lt;br /&gt;
                local entity = mw.wikibase.getEntity( suited )&lt;br /&gt;
                if type( entity ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
                    local seek = Failsafe.serialProperty or &amp;quot;P348&amp;quot;&lt;br /&gt;
                    local vsn  = entity:formatPropertyValues( seek )&lt;br /&gt;
                    if type( vsn ) == &amp;quot;table&amp;quot;  and&lt;br /&gt;
                       type( vsn.value ) == &amp;quot;string&amp;quot;  and&lt;br /&gt;
                       vsn.value ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                        if last  and  vsn.value == Failsafe.serial then&lt;br /&gt;
                            r = false&lt;br /&gt;
                        elseif linked then&lt;br /&gt;
                            if mw.title.getCurrentTitle().prefixedText&lt;br /&gt;
                               ==  mw.wikibase.getSitelink( suited ) then&lt;br /&gt;
                                r = false&lt;br /&gt;
                            else&lt;br /&gt;
                                r = suited&lt;br /&gt;
                            end&lt;br /&gt;
                        else&lt;br /&gt;
                            r = vsn.value&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if type( r ) == &amp;quot;nil&amp;quot; then&lt;br /&gt;
        if not since  or  since &amp;lt;= Failsafe.serial then&lt;br /&gt;
            r = Failsafe.serial&lt;br /&gt;
        else&lt;br /&gt;
            r = false&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- Failsafe.failsafe()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Export&lt;br /&gt;
local p = { };&lt;br /&gt;
&lt;br /&gt;
function p.facets( frame )&lt;br /&gt;
    return TemplUtl.facets( frame.args[ 1 ]  or  &amp;quot;&amp;quot;,&lt;br /&gt;
                            frame.args.decode );&lt;br /&gt;
end -- p.facets&lt;br /&gt;
&lt;br /&gt;
function p.faculty( frame )&lt;br /&gt;
    local r = TemplUtl.faculty( frame.args[ 1 ],&lt;br /&gt;
                                frame.args[ 2 ] );&lt;br /&gt;
    if r ~= &amp;quot;-&amp;quot; then&lt;br /&gt;
        r = r and &amp;quot;1&amp;quot;;&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.faculty&lt;br /&gt;
&lt;br /&gt;
function p.failure( frame )&lt;br /&gt;
    local scream = mw.text.trim( frame.args[ 1 ]  or  &amp;quot;&amp;quot; );&lt;br /&gt;
    local loud   = frame.args[ 2 ];&lt;br /&gt;
    local select = frame.args.class;&lt;br /&gt;
    if scream == &amp;quot;&amp;quot; then&lt;br /&gt;
        scream = &amp;quot;?????????&amp;quot;;&lt;br /&gt;
    end&lt;br /&gt;
    if loud then&lt;br /&gt;
        loud = TemplUtl.faculty( loud, nil );&lt;br /&gt;
    end&lt;br /&gt;
    return TemplUtl.failure( scream, loud, select, frame );&lt;br /&gt;
end -- p.failure&lt;br /&gt;
&lt;br /&gt;
function p.fake( frame )&lt;br /&gt;
    TemplUtl.fake( frame.args[ 1 ]  or  &amp;quot;&amp;quot;,  frame );&lt;br /&gt;
    return &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.fake&lt;br /&gt;
&lt;br /&gt;
function p.fakes( frame )&lt;br /&gt;
    local list = ( frame.args.list == &amp;quot;1&amp;quot; );&lt;br /&gt;
    local r    = TemplUtl.fakes( frame.args,&lt;br /&gt;
                                 frame,&lt;br /&gt;
                                 frame.args.prefix,&lt;br /&gt;
                                 list );&lt;br /&gt;
    return r or &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.fakes&lt;br /&gt;
&lt;br /&gt;
function p.firstbreak( frame )&lt;br /&gt;
    local r = ( frame.args[ 1 ] );&lt;br /&gt;
    if r then&lt;br /&gt;
        r = mw.text.trim( r );&lt;br /&gt;
        if r ~= &amp;quot;&amp;quot; then&lt;br /&gt;
            r = TemplUtl.firstbreak( r );&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.firstbreak&lt;br /&gt;
&lt;br /&gt;
function p.from( frame )&lt;br /&gt;
    local r = frame:getParent():getTitle();&lt;br /&gt;
    if r then&lt;br /&gt;
        r = string.format( &amp;quot;&amp;amp;#123;&amp;amp;#123;%s&amp;amp;#125;&amp;amp;#125;&amp;quot;, r );&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.from&lt;br /&gt;
&lt;br /&gt;
function p.isRedirect()&lt;br /&gt;
    return mw.title.getCurrentTitle().isRedirect and &amp;quot;1&amp;quot;  or  &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.isRedirect&lt;br /&gt;
&lt;br /&gt;
function p.nowiki1( frame )&lt;br /&gt;
    local r = ( frame.args[ 1 ] );&lt;br /&gt;
    if r then&lt;br /&gt;
        r = mw.text.trim( r );&lt;br /&gt;
        if r ~= &amp;quot;&amp;quot; then&lt;br /&gt;
            r = TemplUtl.nowiki1( r );&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;;&lt;br /&gt;
end -- p.nowiki1&lt;br /&gt;
&lt;br /&gt;
p.failsafe = function ( frame )&lt;br /&gt;
    -- Versioning interface&lt;br /&gt;
    local s = type( frame )&lt;br /&gt;
    local since&lt;br /&gt;
    if s == &amp;quot;table&amp;quot; then&lt;br /&gt;
        since = frame.args[ 1 ]&lt;br /&gt;
    elseif s == &amp;quot;string&amp;quot; then&lt;br /&gt;
        since = frame&lt;br /&gt;
    end&lt;br /&gt;
    if since then&lt;br /&gt;
        since = mw.text.trim( since )&lt;br /&gt;
        if since == &amp;quot;&amp;quot; then&lt;br /&gt;
            since = false&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return Failsafe.failsafe( since )  or  &amp;quot;&amp;quot;&lt;br /&gt;
end -- p.failsafe&lt;br /&gt;
&lt;br /&gt;
p.TemplUtl = function ()&lt;br /&gt;
    return TemplUtl;&lt;br /&gt;
end -- p.TemplUtl()&lt;br /&gt;
&lt;br /&gt;
setmetatable( p,  { __call = function ( func, ... )&lt;br /&gt;
                                 setmetatable( p, nil );&lt;br /&gt;
                                 return Failsafe;&lt;br /&gt;
                             end } );&lt;br /&gt;
&lt;br /&gt;
return p;&lt;/div&gt;</summary>
		<author><name>__de&gt;PerfektesChaos</name></author>
	</entry>
</feed>