<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://kryptowiki.eu/index.php?action=history&amp;feed=atom&amp;title=Modul%3AVorlage%3ALuaModuleDoc</id>
	<title>Modul:Vorlage:LuaModuleDoc - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://kryptowiki.eu/index.php?action=history&amp;feed=atom&amp;title=Modul%3AVorlage%3ALuaModuleDoc"/>
	<link rel="alternate" type="text/html" href="https://kryptowiki.eu/index.php?title=Modul:Vorlage:LuaModuleDoc&amp;action=history"/>
	<updated>2026-11-17T08:03:15Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Kryptowiki - Die freie Enzyklopädie der Kryptowährungen</subtitle>
	<generator>MediaWiki 1.39.15</generator>
	<entry>
		<id>https://kryptowiki.eu/index.php?title=Modul:Vorlage:LuaModuleDoc&amp;diff=1515&amp;oldid=prev</id>
		<title>C1ph4: 1 Version importiert</title>
		<link rel="alternate" type="text/html" href="https://kryptowiki.eu/index.php?title=Modul:Vorlage:LuaModuleDoc&amp;diff=1515&amp;oldid=prev"/>
		<updated>2017-11-09T19:43:55Z</updated>

		<summary type="html">&lt;p&gt;1 Version importiert&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local Serial = &amp;quot;2017-11-06&amp;quot;&lt;br /&gt;
--[=[&lt;br /&gt;
Support {{LuaModuleDoc}}&lt;br /&gt;
* nav()&lt;br /&gt;
* failsafe()&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Module globals&lt;br /&gt;
local CurrentTitle&lt;br /&gt;
local Frame&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function fetch( arg, assign )&lt;br /&gt;
    -- Retrieve template argument&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     arg     -- string or number; argument identifier&lt;br /&gt;
    --     assign  -- any, optional; default value&lt;br /&gt;
    local r = Frame.args[ arg ]&lt;br /&gt;
    if type( r ) ~= &amp;quot;string&amp;quot; then&lt;br /&gt;
        if assign == nil then&lt;br /&gt;
            r = &amp;quot;{{{&amp;lt;&amp;quot; .. arg .. &amp;quot;&amp;gt;}}}&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            r = assign&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- fetch()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function catIfDefined( slot )&lt;br /&gt;
    -- Categorize if category defined&lt;br /&gt;
    --     slot  -- string; Config entry&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string or false:  categorization, if any&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local s = fetch( slot, &amp;quot;&amp;quot; )&lt;br /&gt;
    local r&lt;br /&gt;
    if #s &amp;gt; 0 then&lt;br /&gt;
        local t = mw.title.makeTitle( &amp;quot;Category&amp;quot;, s )&lt;br /&gt;
        if t.exists then&lt;br /&gt;
            r = string.format( &amp;quot;[[%s]]&amp;quot;, t.prefixedText )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- catIfDefined()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function createPage( swift, sub, start, ns, script )&lt;br /&gt;
    -- Create button for page creation&lt;br /&gt;
    --     swift   -- string;&lt;br /&gt;
    --                &amp;quot;NoPageCentral&amp;quot;, &amp;quot;NoTalkCentral&amp;quot;, &amp;quot;NoTalkRedir&amp;quot;&lt;br /&gt;
    --     sub     -- string; page name to be created&lt;br /&gt;
    --     start   -- string; defined pageDocRoot argument&lt;br /&gt;
    --     ns      -- number; namespace&lt;br /&gt;
    --     script  -- string; module name (main)&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    -- MediaWiki:Move-leave-redirect   Weiterleitung erstellen&lt;br /&gt;
    -- MediaWiki:autosumm-new          Seite wurde neu angelegt: „$1“&lt;br /&gt;
    local setup = &amp;quot;preload&amp;quot; .. swift:sub( 7 )&lt;br /&gt;
    local r&lt;br /&gt;
    setup = fetch( setup )&lt;br /&gt;
    if setup then&lt;br /&gt;
        local create = { action  = &amp;quot;edit&amp;quot;,&lt;br /&gt;
                         preload = setup,&lt;br /&gt;
                         redlink = &amp;quot;1&amp;quot; }&lt;br /&gt;
        local button, path, show, story, summary&lt;br /&gt;
        if swift == &amp;quot;NoTalkRedir&amp;quot; then&lt;br /&gt;
            show    = &amp;quot;move-leave-redirect&amp;quot;&lt;br /&gt;
            story   = string.format( &amp;quot;%s/%s&amp;quot;, start, script )&lt;br /&gt;
            story   = mw.title.makeTitle( ns, story ).prefixedText&lt;br /&gt;
            story   = string.format( &amp;quot;[[%s]]&amp;quot;, story )&lt;br /&gt;
            summary = &amp;quot;#redirect &amp;quot; .. story&lt;br /&gt;
        else&lt;br /&gt;
            local s = fetch( &amp;quot;langsRequest&amp;quot;, false )&lt;br /&gt;
            show    = &amp;quot;recreate&amp;quot;&lt;br /&gt;
            if s then&lt;br /&gt;
                s = mw.text.trim( s )&lt;br /&gt;
                if s ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                    s = &amp;quot;|&amp;quot; .. s&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            story = ( s or &amp;quot;&amp;quot; )&lt;br /&gt;
            summary = &amp;quot;{{LuaModuleDoc}}&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
    --  summary = mw.message.new( &amp;quot;autosumm-new&amp;quot; ):params( summary )&lt;br /&gt;
        create.summary      = summary&lt;br /&gt;
        create.preloadtitle = summary&lt;br /&gt;
        if story then&lt;br /&gt;
            create[ &amp;quot;preloadparams[]&amp;quot; ] = story&lt;br /&gt;
        end&lt;br /&gt;
        path   = { sub,  mw.uri.buildQueryString( create ) }&lt;br /&gt;
        r      = Frame:callParserFunction( &amp;quot;fullurl&amp;quot;, path )&lt;br /&gt;
        show   = mw.message.new( show ):plain()&lt;br /&gt;
        button = mw.title.makeTitle( mw.site.namespaces.Template.id,&lt;br /&gt;
                                     &amp;quot;MediaWiki-Button&amp;quot; )&lt;br /&gt;
        if button.exists then&lt;br /&gt;
            button = { template = button.text,&lt;br /&gt;
                       Typ      = &amp;quot;progressive&amp;quot;,&lt;br /&gt;
                       [&amp;quot;Groß&amp;quot;] = &amp;quot;1&amp;quot;,&lt;br /&gt;
                       Link     = r,&lt;br /&gt;
                       Text     = show }&lt;br /&gt;
            r      = Frame:expandTemplate{ title = button.template,&lt;br /&gt;
                                           args  = button }&lt;br /&gt;
        else&lt;br /&gt;
            r = string.format( &amp;quot;&amp;lt;br&amp;gt;[%s '''%s''']&amp;quot;, r, show )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;&lt;br /&gt;
end -- createPage()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function globalRepos( script )&lt;br /&gt;
    -- Check for global dissemination&lt;br /&gt;
    --     script  -- string; module name (main)&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     mw.wikibase.getEntity()&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local entity = mw.wikibase.getEntity()&lt;br /&gt;
    local r&lt;br /&gt;
    if type( entity ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
        local mode = 0&lt;br /&gt;
        local repo = entity:formatPropertyValues( &amp;quot;P1324&amp;quot; )&lt;br /&gt;
        local params, s, t&lt;br /&gt;
        if type( repo ) == &amp;quot;table&amp;quot;  and&lt;br /&gt;
           type( repo.value) == &amp;quot;string&amp;quot;  and&lt;br /&gt;
           repo.value:find( &amp;quot;//&amp;quot; ) then&lt;br /&gt;
            repo = mw.uri.new( repo.value )&lt;br /&gt;
            if type( repo.path ) == &amp;quot;string&amp;quot;  and&lt;br /&gt;
               repo.path:match( &amp;quot;^/wiki/&amp;quot; ) then&lt;br /&gt;
                local space&lt;br /&gt;
                space, s = repo.path:sub( 7 ):match( &amp;quot;^([^:]+):(.+)$&amp;quot; )&lt;br /&gt;
                if space and s then&lt;br /&gt;
                    t = mw.title.makeTitle( space, s )&lt;br /&gt;
                    s = &amp;quot;//&amp;quot; .. repo.host&lt;br /&gt;
                    if mw.title.equals( CurrentTitle, t )  and&lt;br /&gt;
                       mw.site.server:find( s, 1, true ) then&lt;br /&gt;
                        mode = 2&lt;br /&gt;
                    else&lt;br /&gt;
                        mode = 1&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            s = fetch( &amp;quot;templateGlobal&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
            if #s &amp;gt; 0 then&lt;br /&gt;
                local lucky, bib = pcall( require,&lt;br /&gt;
                                          CurrentTitle.prefixedText )&lt;br /&gt;
                local vsn = entity:formatPropertyValues( &amp;quot;P348&amp;quot; )&lt;br /&gt;
                params = { }&lt;br /&gt;
                if mode &amp;lt; 2 then&lt;br /&gt;
                    params[ 1 ] = string.format( &amp;quot;[%s %s]&amp;quot;,&lt;br /&gt;
                                                 tostring( repo ),&lt;br /&gt;
                                                 repo.host )&lt;br /&gt;
                end&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;
                    params.version = vsn.value&lt;br /&gt;
                end&lt;br /&gt;
                if type( bib ) == &amp;quot;table&amp;quot;  and  bib.failsafe then&lt;br /&gt;
                    t = type( bib.failsafe )&lt;br /&gt;
                    if t == &amp;quot;function&amp;quot; then&lt;br /&gt;
                        bib = bib.failsafe( { args = { } } )&lt;br /&gt;
                        t    = type( bib )&lt;br /&gt;
                    else&lt;br /&gt;
                        bib = bib.failsafe&lt;br /&gt;
                    end&lt;br /&gt;
                    if t == &amp;quot;number&amp;quot; then&lt;br /&gt;
                        bib = string.format( &amp;quot;%d&amp;quot;, bib )&lt;br /&gt;
                        t    = &amp;quot;string&amp;quot;&lt;br /&gt;
                    end&lt;br /&gt;
                    if t == &amp;quot;string&amp;quot; then&lt;br /&gt;
                        params.here = bib&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
                if params.version  and  params.here  and&lt;br /&gt;
                   params.version ~= params.here  then&lt;br /&gt;
                    params.update = &amp;quot;1&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
                r = Frame:expandTemplate{ title=s,&lt;br /&gt;
                                          args=params }&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        s = fetch( &amp;quot;categoryWikiData&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
        if #s &amp;gt; 0 then&lt;br /&gt;
            local slot&lt;br /&gt;
            if mode &amp;gt; 0 then&lt;br /&gt;
                if mode == 2 then&lt;br /&gt;
                    slot = catIfDefined( &amp;quot;categoryWikiDataParent&amp;quot; )&lt;br /&gt;
                else&lt;br /&gt;
                    slot = catIfDefined( &amp;quot;categoryWikiDataChild&amp;quot; )&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            if not slot then&lt;br /&gt;
                slot = catIfDefined( s )&lt;br /&gt;
            end&lt;br /&gt;
            if slot then&lt;br /&gt;
                if r then&lt;br /&gt;
                    r = r .. slot&lt;br /&gt;
                else&lt;br /&gt;
                    r = slot&lt;br /&gt;
                end&lt;br /&gt;
                if params and params.update then&lt;br /&gt;
                    slot = catIfDefined( &amp;quot;categoryWikiDataReplication&amp;quot; )&lt;br /&gt;
                    if slot then&lt;br /&gt;
                        r = r .. slot&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;&lt;br /&gt;
end -- globalRepos()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navDevelop( nsDocs, start, script )&lt;br /&gt;
    -- Most interesting test and development page&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     nsDocs  -- number; central documentation namespace number&lt;br /&gt;
    --     start   -- string; central documentation root&lt;br /&gt;
    --     script  -- string; basic module name&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string or false:  full page name, if any&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local n   = nsDocs&lt;br /&gt;
    local r   = false&lt;br /&gt;
    local sub = &amp;quot;/&amp;quot; .. fetch( &amp;quot;subTest&amp;quot;, &amp;quot;Test&amp;quot; )&lt;br /&gt;
    local s   = string.format( &amp;quot;%s/%s%s&amp;quot;, start, script, sub )&lt;br /&gt;
    local t   = mw.title.makeTitle( n, s )&lt;br /&gt;
    if not t.exists then&lt;br /&gt;
        local low    = false&lt;br /&gt;
        local subLow = mw.ustring.lower( sub )&lt;br /&gt;
        if subLow ~= sub then&lt;br /&gt;
            s   = string.format( &amp;quot;%s/%s%s&amp;quot;, start, script, subLow )&lt;br /&gt;
            t   = mw.title.makeTitle( n, s )&lt;br /&gt;
            low = t.exists&lt;br /&gt;
        end&lt;br /&gt;
        if not low then&lt;br /&gt;
            n = mw.site.namespaces.Module.id&lt;br /&gt;
            s = string.format( &amp;quot;%s/%s&amp;quot;, script, sub )&lt;br /&gt;
            t = mw.title.makeTitle( n, s )&lt;br /&gt;
            if not t.exists  and  subLow ~= sub then&lt;br /&gt;
                s = script .. subLow&lt;br /&gt;
                t = mw.title.makeTitle( n, s )&lt;br /&gt;
                t = t.exists&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if t then&lt;br /&gt;
        r =  mw.site.namespaces[ n ].name .. &amp;quot;:&amp;quot; .. s&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navDevelop()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navError( say, specific )&lt;br /&gt;
    -- Return error message, evaluate page .pageErr&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     say       -- string; message key&lt;br /&gt;
    --     specific  -- string, optional; additional information&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    local show = fetch( &amp;quot;pageErr&amp;quot; )&lt;br /&gt;
    local r&lt;br /&gt;
    if type( show ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local pars = { say }&lt;br /&gt;
        if type( specific ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
            table.insert( pars, specific )&lt;br /&gt;
        end&lt;br /&gt;
        r = Frame:expandTemplate{ title = show, args = pars }&lt;br /&gt;
    else&lt;br /&gt;
        local e = mw.html.create( &amp;quot;span&amp;quot; )&lt;br /&gt;
                         :attr( &amp;quot;class&amp;quot;, &amp;quot;error&amp;quot; )&lt;br /&gt;
                         :wikitext( error( &amp;quot;arg 'pageErr' missing&amp;quot;, 3 ) )&lt;br /&gt;
        r = tostring( e )&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navError()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navLang( suite, collect, lazy )&lt;br /&gt;
    -- Append languages from string to collection&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     suite    -- string; space separated source&lt;br /&gt;
    --     collect  -- table; to be extended&lt;br /&gt;
    --                 every element: { langCode, lazy }&lt;br /&gt;
    --     lazy     -- true if only existing page is to be linked&lt;br /&gt;
    if type( suite ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local raw = mw.text.split( suite, &amp;quot;%s+&amp;quot; )&lt;br /&gt;
        local e, i, j, s&lt;br /&gt;
        for i = 1, #raw do&lt;br /&gt;
            s = raw[ i ]&lt;br /&gt;
            if #s &amp;gt; 1 then&lt;br /&gt;
                for j = 1, #collect do&lt;br /&gt;
                    if s then&lt;br /&gt;
                        e = collect[ j ]&lt;br /&gt;
                        if e[ 1 ] == s then&lt;br /&gt;
                            s = false&lt;br /&gt;
                            if not lazy then&lt;br /&gt;
                                e[ 2 ] = false&lt;br /&gt;
                            end&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end -- for j&lt;br /&gt;
                if s then&lt;br /&gt;
                    table.insert( collect,  { s, lazy } )&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end -- for i&lt;br /&gt;
    end&lt;br /&gt;
end -- navLang()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navLangs( nsDocs, start, script )&lt;br /&gt;
    -- Analyze languages&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     current page is supposed to transclude LuaModuleDoc&lt;br /&gt;
    --     nsDocs  -- number; central documentation namespace number&lt;br /&gt;
    --     start   -- string; central documentation root&lt;br /&gt;
    --     script  -- string; basic module name&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     table:  args for navigation template&lt;br /&gt;
    --             [1] basic module name&lt;br /&gt;
    --             [2] number of language codes  +  1&lt;br /&gt;
    --             [3] first language code&lt;br /&gt;
    --             [4] second language code&lt;br /&gt;
    --             ... list of further language codes&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     navLang()&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local e, i, s, t&lt;br /&gt;
    local r = { }&lt;br /&gt;
    local specified = fetch( &amp;quot;langsRequest&amp;quot;, false )&lt;br /&gt;
    local super     = start .. &amp;quot;/&amp;quot; .. script .. &amp;quot;/&amp;quot;&lt;br /&gt;
    if type( specified ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        if specified:match( &amp;quot;^%s*$&amp;quot; ) then&lt;br /&gt;
            specified = false&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    navLang( fetch( &amp;quot;langsDefault&amp;quot; ),  r,  specified )&lt;br /&gt;
    navLang( fetch( &amp;quot;langsMore&amp;quot; ),  r,  true  )&lt;br /&gt;
    navLang( specified, r, false )&lt;br /&gt;
    if #r &amp;lt; 1 then&lt;br /&gt;
        r = { { &amp;quot;en&amp;quot;, false } }&lt;br /&gt;
    end&lt;br /&gt;
    for i = #r, 1, -1 do&lt;br /&gt;
        e = r[ i ]&lt;br /&gt;
        s = e[ 1 ]&lt;br /&gt;
        if e[ 2 ] then&lt;br /&gt;
            t = mw.title.makeTitle( nsDocs,  super .. s )&lt;br /&gt;
            if not t.exists then&lt;br /&gt;
                s = false&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        if s then&lt;br /&gt;
            r[ i ] = s&lt;br /&gt;
        else&lt;br /&gt;
            table.remove( r, i )&lt;br /&gt;
        end&lt;br /&gt;
    end -- for i -1&lt;br /&gt;
    table.insert( r,  1,  script )&lt;br /&gt;
    table.insert( r,  2,  tostring( #r ) )&lt;br /&gt;
    return r&lt;br /&gt;
end -- navLangs()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navMerge( start, swift, ns, nsDocs, script, sub, lead )&lt;br /&gt;
    -- Include various external content into page&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     start   -- string; defined pageDocRoot argument&lt;br /&gt;
    --     swift   -- string; defined pageNav argument&lt;br /&gt;
    --     ns      -- number; current namespace number&lt;br /&gt;
    --     nsDocs  -- number; central documentation namespace number&lt;br /&gt;
    --     script  -- string; module name (main)&lt;br /&gt;
    --     sub     -- string or false; possible sub-module name&lt;br /&gt;
    --     lead    -- true: Module: namespace;   false: text namespace&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    --     navLangs()&lt;br /&gt;
    --     navError()&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    --     createPage()&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    local server  = mw.site.server&lt;br /&gt;
    local super   = false&lt;br /&gt;
    local collect = navLangs( nsDocs, start, script )&lt;br /&gt;
    local t       = navDevelop( nsDocs, start, script )&lt;br /&gt;
    local low, r, s&lt;br /&gt;
    if t then&lt;br /&gt;
        collect.Test = t&lt;br /&gt;
    end&lt;br /&gt;
    if ns == nsDocs then&lt;br /&gt;
        s = string.format( &amp;quot;%s/%s&amp;quot;, start, script )&lt;br /&gt;
        if CurrentTitle.text == s then&lt;br /&gt;
            super = CurrentTitle.text .. &amp;quot;/&amp;quot;&lt;br /&gt;
        elseif sub then&lt;br /&gt;
            collect.subDoc = sub&lt;br /&gt;
            collect.subModule = sub&lt;br /&gt;
            s = string.format( &amp;quot;%s/%s/%s&amp;quot;, start, script, sub )&lt;br /&gt;
            if CurrentTitle.text == s then&lt;br /&gt;
                s = string.format( &amp;quot;%s/%s&amp;quot;, s, collect[ 3 ] )&lt;br /&gt;
                t = mw.title.makeTitle( nsDocs, s )&lt;br /&gt;
                if t.exists then&lt;br /&gt;
                    super = CurrentTitle.text .. &amp;quot;/&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    elseif lead and sub then&lt;br /&gt;
        s = string.format( &amp;quot;%s/%s/%s&amp;quot;, start, script, sub )&lt;br /&gt;
        t = mw.title.makeTitle( nsDocs, s )&lt;br /&gt;
        if t.exists then&lt;br /&gt;
            collect.subDoc = sub&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if server:match( &amp;quot;%.beta%.wmflabs%.org$&amp;quot; ) then&lt;br /&gt;
        local slang, series = server:match( &amp;quot;//(%l+)%.(%l+)%.&amp;quot; )&lt;br /&gt;
        low = true&lt;br /&gt;
        if series == &amp;quot;wikipedia&amp;quot; then&lt;br /&gt;
            if slang == &amp;quot;de&amp;quot; then&lt;br /&gt;
                collect.BETA = &amp;quot;w:de:&amp;quot;   --Talk&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    r = Frame:expandTemplate{ title = swift, args = collect }&lt;br /&gt;
    if not low then&lt;br /&gt;
        t = CurrentTitle.talkPageTitle&lt;br /&gt;
        if ns == mw.site.namespaces.Module.id then&lt;br /&gt;
            local doc&lt;br /&gt;
            s   = string.format( &amp;quot;%s/%s&amp;quot;, start, script )&lt;br /&gt;
            doc = mw.title.makeTitle( nsDocs, s )&lt;br /&gt;
            if not doc.exists then&lt;br /&gt;
                r = r .. createPage( &amp;quot;NoPageCentral&amp;quot;,&lt;br /&gt;
                                     doc.prefixedText,&lt;br /&gt;
                                     start,&lt;br /&gt;
                                     nsDocs,&lt;br /&gt;
                                     script )&lt;br /&gt;
                t = false&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        if t  and  not t.exists then&lt;br /&gt;
            if super then&lt;br /&gt;
                s = &amp;quot;NoTalkCentral&amp;quot;&lt;br /&gt;
            elseif ns == nsDocs + 1 then&lt;br /&gt;
                s = false&lt;br /&gt;
            else&lt;br /&gt;
                s = &amp;quot;NoTalkRedir&amp;quot;&lt;br /&gt;
            end&lt;br /&gt;
            if s then&lt;br /&gt;
                r = string.format( &amp;quot;%s%s%s&amp;quot;,&lt;br /&gt;
                                   r,&lt;br /&gt;
                                   navError( s ),&lt;br /&gt;
                                   createPage( s,&lt;br /&gt;
                                               t.prefixedText,&lt;br /&gt;
                                               start,&lt;br /&gt;
                                               nsDocs + 1,&lt;br /&gt;
                                               script ) )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if super then&lt;br /&gt;
        local d  = &amp;quot;{{%s*[lL]uaModuleDoc[^}]*}}%s*&amp;quot;&lt;br /&gt;
        local p1 = &amp;quot;^%s*&amp;quot; .. d .. &amp;quot;&amp;lt;onlyinclude&amp;gt;&amp;quot;&lt;br /&gt;
        local p2 = &amp;quot;%s*&amp;lt;noinclude&amp;gt;&amp;quot; .. d .. &amp;quot;&amp;lt;/noinclude&amp;gt;&amp;quot;&lt;br /&gt;
        local space, sub, support&lt;br /&gt;
        for i = 3, #collect do&lt;br /&gt;
            t = mw.title.makeTitle( nsDocs,  super .. collect[ i ] )&lt;br /&gt;
            s = t:getContent()&lt;br /&gt;
            if s then&lt;br /&gt;
                s = s:gsub( p1, &amp;quot;&amp;quot; ):gsub( p2, &amp;quot;&amp;quot; )&lt;br /&gt;
                if s:match( d ) then&lt;br /&gt;
                    r = string.format( &amp;quot;%s&amp;lt;br /&amp;gt;%s&amp;lt;br /&amp;gt;&amp;quot;,&lt;br /&gt;
                                       r,&lt;br /&gt;
                                       navError( &amp;quot;BadInclude&amp;quot;,&lt;br /&gt;
                                                 t.prefixedText ) )&lt;br /&gt;
                else&lt;br /&gt;
                    r = r ..&lt;br /&gt;
                        Frame:expandTemplate{ title = t.prefixedText }&lt;br /&gt;
                    break    -- for i&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end -- for i&lt;br /&gt;
        s = fetch( &amp;quot;pageTemplateInsert&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
        space, support = s:match( &amp;quot;^([^:]+):(.+)$&amp;quot; )&lt;br /&gt;
        if space  and  mw.title.makeTitle( space, support ).exists then&lt;br /&gt;
            local suppress = fetch( &amp;quot;noHint&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
            if #suppress == 0 then&lt;br /&gt;
                local swift = collect[ 1 ]&lt;br /&gt;
                if sub then&lt;br /&gt;
                    swift = string.format( &amp;quot;%s/%s&amp;quot;, swift, sub )&lt;br /&gt;
                end&lt;br /&gt;
                r = r .. Frame:expandTemplate{ title = s,&lt;br /&gt;
                                               args = { swift } }&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        s = fetch( &amp;quot;categoryDocs&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
        if #s &amp;gt; 0 then&lt;br /&gt;
            i = mw.title.makeTitle( &amp;quot;Category&amp;quot;, s )&lt;br /&gt;
            if i.exists then&lt;br /&gt;
                r = string.format( &amp;quot;%s[[%s|%s]]&amp;quot;,&lt;br /&gt;
                                   r, i.prefixedText, collect[ 1 ] )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        r = r .. &amp;quot;__NOEDITSECTION__&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if lead then&lt;br /&gt;
        r = r .. globalRepos( script )&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navMerge()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navPage( lead, ns, nsDocs )&lt;br /&gt;
    -- Return navigation text; analyze page location&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     current namespace will support LuaModuleDoc&lt;br /&gt;
    --     lead    -- true: Module: namespace;   false: text namespace&lt;br /&gt;
    --     ns      -- number; current namespace&lt;br /&gt;
    --     nsDocs  -- number; namespace for doc&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     navError()&lt;br /&gt;
    --     navMerge()&lt;br /&gt;
    local r&lt;br /&gt;
    local start = fetch( &amp;quot;pageDocRoot&amp;quot; )&lt;br /&gt;
    if type( start ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local s      = &amp;quot;^&amp;quot;&lt;br /&gt;
        local script&lt;br /&gt;
        if not lead then&lt;br /&gt;
            s = &amp;quot;^&amp;quot; .. start .. &amp;quot;/&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        s = s .. &amp;quot;([^/]+)/(.*/?)$&amp;quot;&lt;br /&gt;
        script, s = string.match( CurrentTitle.text .. &amp;quot;/&amp;quot;,  s )&lt;br /&gt;
        if type( script ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
            local sub   = false&lt;br /&gt;
            local swift = fetch( &amp;quot;pageNav&amp;quot; )&lt;br /&gt;
            if type( s ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
                if #s &amp;gt; 1 then&lt;br /&gt;
                    local q&lt;br /&gt;
                    s = s:match( &amp;quot;^([^/]+)/.*/?$&amp;quot; )&lt;br /&gt;
                    q = mw.title.makeTitle( &amp;quot;Module&amp;quot;,&lt;br /&gt;
                                            script .. &amp;quot;/&amp;quot; .. s )&lt;br /&gt;
                    if q.exists and q.contentModel == &amp;quot;Scribunto&amp;quot; then&lt;br /&gt;
                        sub = s&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            if type( swift ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
                r = navMerge( start, swift, ns, nsDocs, script, sub, lead )&lt;br /&gt;
            else&lt;br /&gt;
                r = navError( &amp;quot;configMissing&amp;quot;, &amp;quot;pageNav&amp;quot; )&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            r = navError( &amp;quot;BadPage&amp;quot; ) .. CurrentTitle.text&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        r = navError( &amp;quot;configMissing&amp;quot;, &amp;quot;pageDocRoot&amp;quot; )&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navPage()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navigation()&lt;br /&gt;
    -- Start execution; return navigation text; analyze namespace&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     mw.title.getCurrentTitle()&lt;br /&gt;
    --     navPage()&lt;br /&gt;
    --     navError()&lt;br /&gt;
    local r&lt;br /&gt;
    local nsDocs = fetch( &amp;quot;nsDocs&amp;quot; )&lt;br /&gt;
    if nsDocs then&lt;br /&gt;
        CurrentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
        local ns   = CurrentTitle.namespace&lt;br /&gt;
        local lead = ( ns == mw.site.namespaces.Module.id )&lt;br /&gt;
        nsDocs = tonumber( nsDocs )&lt;br /&gt;
        if lead or  ns == nsDocs  or  ns == nsDocs + 1 then&lt;br /&gt;
            r = navPage( lead, ns, nsDocs )&lt;br /&gt;
        else&lt;br /&gt;
            r = navError( &amp;quot;BadNamespace&amp;quot; )&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        r = navError( &amp;quot;configMissing&amp;quot;, &amp;quot;nsDocs&amp;quot; )&lt;br /&gt;
    end&lt;br /&gt;
    return  r&lt;br /&gt;
end -- navigation()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Provide template access&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.nav( frame )&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     navigation()&lt;br /&gt;
    local lucky, r&lt;br /&gt;
    Frame = frame&lt;br /&gt;
    lucky, r = pcall( navigation )&lt;br /&gt;
    if not lucky then&lt;br /&gt;
        local e = mw.html.create( &amp;quot;span&amp;quot; )&lt;br /&gt;
                         :attr( &amp;quot;class&amp;quot;, &amp;quot;error&amp;quot; )&lt;br /&gt;
                         :wikitext( r )&lt;br /&gt;
        r = tostring( e )&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.failsafe()&lt;br /&gt;
    return Serial&lt;br /&gt;
end -- p.failsafe()&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>C1ph4</name></author>
	</entry>
	<entry>
		<id>https://kryptowiki.eu/index.php?title=Modul:Vorlage:LuaModuleDoc&amp;diff=1160&amp;oldid=prev</id>
		<title>C1ph4: 1 Version importiert</title>
		<link rel="alternate" type="text/html" href="https://kryptowiki.eu/index.php?title=Modul:Vorlage:LuaModuleDoc&amp;diff=1160&amp;oldid=prev"/>
		<updated>2017-08-20T14:11:22Z</updated>

		<summary type="html">&lt;p&gt;1 Version importiert&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local Serial = &amp;quot;2017-01-25&amp;quot;&lt;br /&gt;
--[=[&lt;br /&gt;
Support {{LuaModuleDoc}}&lt;br /&gt;
* nav()&lt;br /&gt;
* failsafe()&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Module globals&lt;br /&gt;
local CurrentTitle&lt;br /&gt;
local Frame&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function fetch( arg, assign )&lt;br /&gt;
    -- Retrieve template argument&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     arg     -- string or number; argument identifier&lt;br /&gt;
    --     assign  -- any, optional; default value&lt;br /&gt;
    local r = Frame.args[ arg ]&lt;br /&gt;
    if type( r ) ~= &amp;quot;string&amp;quot; then&lt;br /&gt;
        if assign == nil then&lt;br /&gt;
            r = &amp;quot;{{{&amp;lt;&amp;quot; .. arg .. &amp;quot;&amp;gt;}}}&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            r = assign&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- fetch()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function catIfDefined( slot )&lt;br /&gt;
    -- Categorize if category defined&lt;br /&gt;
    --     slot  -- string; Config entry&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string or false:  categorization, if any&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local s = fetch( slot, &amp;quot;&amp;quot; )&lt;br /&gt;
    local r&lt;br /&gt;
    if #s &amp;gt; 0 then&lt;br /&gt;
        local t = mw.title.makeTitle( &amp;quot;Category&amp;quot;, s )&lt;br /&gt;
        if t.exists then&lt;br /&gt;
            r = string.format( &amp;quot;[[%s]]&amp;quot;, t.prefixedText )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- catIfDefined()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function globalRepos( script )&lt;br /&gt;
    -- Check for global dissemination&lt;br /&gt;
    --     script  -- string; module name (main)&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     mw.wikibase.getEntity()&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local entity = mw.wikibase.getEntity()&lt;br /&gt;
    local r&lt;br /&gt;
    if entity then&lt;br /&gt;
        local mode = 0&lt;br /&gt;
        local repo = entity:formatPropertyValues( &amp;quot;P1324&amp;quot; )&lt;br /&gt;
        local params, s, t&lt;br /&gt;
        if repo  and  repo.value  and  repo.value:find( &amp;quot;//&amp;quot; ) then&lt;br /&gt;
            repo = mw.uri.new( repo.value )&lt;br /&gt;
            if repo  and  repo.path:match( &amp;quot;^/wiki/&amp;quot; ) then&lt;br /&gt;
                local space&lt;br /&gt;
                space, s = repo.path:sub( 7 ):match( &amp;quot;^([^:]+):(.+)$&amp;quot; )&lt;br /&gt;
                if space and s then&lt;br /&gt;
                    t = mw.title.makeTitle( space, s )&lt;br /&gt;
                    s = &amp;quot;//&amp;quot; .. repo.host&lt;br /&gt;
                    if mw.title.equals( CurrentTitle, t )  and&lt;br /&gt;
                       mw.site.server:find( s, 1, true ) then&lt;br /&gt;
                        mode = 2&lt;br /&gt;
                    else&lt;br /&gt;
                        mode = 1&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            s = fetch( &amp;quot;templateGlobal&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
            if #s &amp;gt; 0 then&lt;br /&gt;
                local lucky, code = pcall( require,&lt;br /&gt;
                                           CurrentTitle.prefixedText )&lt;br /&gt;
                local vsn = entity:formatPropertyValues( &amp;quot;P348&amp;quot; )&lt;br /&gt;
                params = { }&lt;br /&gt;
                if mode &amp;lt; 2 then&lt;br /&gt;
                    params[ 1 ] = string.format( &amp;quot;[%s %s]&amp;quot;,&lt;br /&gt;
                                                 tostring( repo ),&lt;br /&gt;
                                                 repo.host )&lt;br /&gt;
                end&lt;br /&gt;
                if vsn  and  vsn.value and  vsn.value ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                    params.version = vsn.value&lt;br /&gt;
                end&lt;br /&gt;
                if type( code ) == &amp;quot;table&amp;quot;  and  code.failsafe then&lt;br /&gt;
                    t = type( code.failsafe )&lt;br /&gt;
                    if t == &amp;quot;function&amp;quot; then&lt;br /&gt;
                        code = code.failsafe( { args = { } } )&lt;br /&gt;
                        t    = type( code )&lt;br /&gt;
                    else&lt;br /&gt;
                        code = code.failsafe&lt;br /&gt;
                    end&lt;br /&gt;
                    if t == &amp;quot;number&amp;quot; then&lt;br /&gt;
                        code = string.format( &amp;quot;%d&amp;quot;, code )&lt;br /&gt;
                        t    = &amp;quot;string&amp;quot;&lt;br /&gt;
                    end&lt;br /&gt;
                    if t == &amp;quot;string&amp;quot; then&lt;br /&gt;
                        params.here = code&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
                if params.version  and  params.here  and&lt;br /&gt;
                   params.version ~= params.here  then&lt;br /&gt;
                    params.update = &amp;quot;1&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
                r = Frame:expandTemplate{ title=s,&lt;br /&gt;
                                          args=params }&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        s = fetch( &amp;quot;categoryWikiData&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
        if #s &amp;gt; 0 then&lt;br /&gt;
            local slot&lt;br /&gt;
            if mode &amp;gt; 0 then&lt;br /&gt;
                if mode == 2 then&lt;br /&gt;
                    slot = catIfDefined( &amp;quot;categoryWikiDataParent&amp;quot; )&lt;br /&gt;
                else&lt;br /&gt;
                    slot = catIfDefined( &amp;quot;categoryWikiDataChild&amp;quot; )&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            if not slot then&lt;br /&gt;
                slot = catIfDefined( s )&lt;br /&gt;
            end&lt;br /&gt;
            if slot then&lt;br /&gt;
                if r then&lt;br /&gt;
                    r = r .. slot&lt;br /&gt;
                else&lt;br /&gt;
                    r = slot&lt;br /&gt;
                end&lt;br /&gt;
                if params and params.update then&lt;br /&gt;
                    slot = catIfDefined( &amp;quot;categoryWikiDataReplication&amp;quot; )&lt;br /&gt;
                    if slot then&lt;br /&gt;
                        r = r .. slot&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;&lt;br /&gt;
end -- globalRepos()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navDevelop( nsDocs, start, script )&lt;br /&gt;
    -- Most interesting test and development page&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     nsDocs  -- number; central documentation namespace number&lt;br /&gt;
    --     start   -- string; central documentation root&lt;br /&gt;
    --     script  -- string; basic module name&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     string or false:  full page name, if any&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local n   = nsDocs&lt;br /&gt;
    local r   = false&lt;br /&gt;
    local sub = &amp;quot;/&amp;quot; .. fetch( &amp;quot;subTest&amp;quot;, &amp;quot;Test&amp;quot; )&lt;br /&gt;
    local s   = string.format( &amp;quot;%s/%s%s&amp;quot;, start, script, sub )&lt;br /&gt;
    local t   = mw.title.makeTitle( n, s )&lt;br /&gt;
    if not t.exists then&lt;br /&gt;
        local low    = false&lt;br /&gt;
        local subLow = mw.ustring.lower( sub )&lt;br /&gt;
        if subLow ~= sub then&lt;br /&gt;
            s   = string.format( &amp;quot;%s/%s%s&amp;quot;, start, script, subLow )&lt;br /&gt;
            t   = mw.title.makeTitle( n, s )&lt;br /&gt;
            low = t.exists&lt;br /&gt;
        end&lt;br /&gt;
        if not low then&lt;br /&gt;
            n = mw.site.namespaces.Module.id&lt;br /&gt;
            s = string.format( &amp;quot;%s/%s&amp;quot;, script, sub )&lt;br /&gt;
            t = mw.title.makeTitle( n, s )&lt;br /&gt;
            if not t.exists  and  subLow ~= sub then&lt;br /&gt;
                s = script .. subLow&lt;br /&gt;
                t = mw.title.makeTitle( n, s )&lt;br /&gt;
                t = t.exists&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if t then&lt;br /&gt;
        r =  mw.site.namespaces[ n ].name .. &amp;quot;:&amp;quot; .. s&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navDevelop()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navError( say, specific )&lt;br /&gt;
    -- Return error message, evaluate page .pageErr&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     say       -- string; message key&lt;br /&gt;
    --     specific  -- string, optional; additional information&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    local show = fetch( &amp;quot;pageErr&amp;quot; )&lt;br /&gt;
    local r&lt;br /&gt;
    if type( show ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local pars = { say }&lt;br /&gt;
        if type( specific ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
            table.insert( pars, specific )&lt;br /&gt;
        end&lt;br /&gt;
        r = Frame:expandTemplate{ title = show, args = pars }&lt;br /&gt;
    else&lt;br /&gt;
        local e = mw.html.create( &amp;quot;span&amp;quot; )&lt;br /&gt;
                         :attr( &amp;quot;class&amp;quot;, &amp;quot;error&amp;quot; )&lt;br /&gt;
                         :wikitext( error( &amp;quot;arg 'pageErr' missing&amp;quot;, 3 ) )&lt;br /&gt;
        r = tostring( e )&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navError()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navLang( suite, collect, lazy )&lt;br /&gt;
    -- Append languages from string to collection&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     suite    -- string; space separated source&lt;br /&gt;
    --     collect  -- table; to be extended&lt;br /&gt;
    --                 every element: { langCode, lazy }&lt;br /&gt;
    --     lazy     -- true if only existing page is to be linked&lt;br /&gt;
    if type( suite ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local raw = mw.text.split( suite, &amp;quot;%s+&amp;quot; )&lt;br /&gt;
        local e, i, j, s&lt;br /&gt;
        for i = 1, #raw do&lt;br /&gt;
            s = raw[ i ]&lt;br /&gt;
            if #s &amp;gt; 1 then&lt;br /&gt;
                for j = 1, #collect do&lt;br /&gt;
                    if s then&lt;br /&gt;
                        e = collect[ j ]&lt;br /&gt;
                        if e[ 1 ] == s then&lt;br /&gt;
                            s = false&lt;br /&gt;
                            if not lazy then&lt;br /&gt;
                                e[ 2 ] = false&lt;br /&gt;
                            end&lt;br /&gt;
                        end&lt;br /&gt;
                    end&lt;br /&gt;
                end -- for j&lt;br /&gt;
                if s then&lt;br /&gt;
                    table.insert( collect,  { s, lazy } )&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end -- for i&lt;br /&gt;
    end&lt;br /&gt;
end -- navLang()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navLangs( nsDocs, start, script )&lt;br /&gt;
    -- Analyze languages&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     current page is supposed to transclude LuaModuleDoc&lt;br /&gt;
    --     nsDocs  -- number; central documentation namespace number&lt;br /&gt;
    --     start   -- string; central documentation root&lt;br /&gt;
    --     script  -- string; basic module name&lt;br /&gt;
    -- Return:&lt;br /&gt;
    --     table:  args for navigation template&lt;br /&gt;
    --             [1] basic module name&lt;br /&gt;
    --             [2] number of language codes  +  1&lt;br /&gt;
    --             [3] first language code&lt;br /&gt;
    --             [4] second language code&lt;br /&gt;
    --             ... list of further language codes&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     navLang()&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    local e, i, s, t&lt;br /&gt;
    local r = { }&lt;br /&gt;
    local specified = fetch( &amp;quot;langsRequest&amp;quot;, false )&lt;br /&gt;
    local super     = start .. &amp;quot;/&amp;quot; .. script .. &amp;quot;/&amp;quot;&lt;br /&gt;
    if type( specified ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        if specified:match( &amp;quot;^%s*$&amp;quot; ) then&lt;br /&gt;
            specified = false&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    navLang( fetch( &amp;quot;langsDefault&amp;quot; ),  r,  specified )&lt;br /&gt;
    navLang( fetch( &amp;quot;langsMore&amp;quot; ),  r,  true  )&lt;br /&gt;
    navLang( specified, r, false )&lt;br /&gt;
    if #r &amp;lt; 1 then&lt;br /&gt;
        r = { { &amp;quot;en&amp;quot;, false } }&lt;br /&gt;
    end&lt;br /&gt;
    for i = #r, 1, -1 do&lt;br /&gt;
        e = r[ i ]&lt;br /&gt;
        s = e[ 1 ]&lt;br /&gt;
        if e[ 2 ] then&lt;br /&gt;
            t = mw.title.makeTitle( nsDocs,  super .. s )&lt;br /&gt;
            if not t.exists then&lt;br /&gt;
                s = false&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        if s then&lt;br /&gt;
            r[ i ] = s&lt;br /&gt;
        else&lt;br /&gt;
            table.remove( r, i )&lt;br /&gt;
        end&lt;br /&gt;
    end -- for i -1&lt;br /&gt;
    table.insert( r,  1,  script )&lt;br /&gt;
    table.insert( r,  2,  tostring( #r ) )&lt;br /&gt;
    return r&lt;br /&gt;
end -- navLangs()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navMerge( start, swift, ns, nsDocs, script, sub, lead )&lt;br /&gt;
    -- Include various external content into page&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     start   -- string; defined pageDocRoot argument&lt;br /&gt;
    --     swift   -- string; defined pageNav argument&lt;br /&gt;
    --     ns      -- number; current namespace number&lt;br /&gt;
    --     nsDocs  -- number; central documentation namespace number&lt;br /&gt;
    --     script  -- string; module name (main)&lt;br /&gt;
    --     sub     -- string or false; possible sub-module name&lt;br /&gt;
    --     lead    -- true: Module: namespace;   false: text namespace&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    --     navLangs()&lt;br /&gt;
    --     navError()&lt;br /&gt;
    --     mw.title.makeTitle()&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    local server  = mw.site.server&lt;br /&gt;
    local super   = false&lt;br /&gt;
    local collect = navLangs( nsDocs, start, script )&lt;br /&gt;
    local t       = navDevelop( nsDocs, start, script )&lt;br /&gt;
    local low, r, s&lt;br /&gt;
    if t then&lt;br /&gt;
        collect.Test = t&lt;br /&gt;
    end&lt;br /&gt;
    if ns == nsDocs then&lt;br /&gt;
        s = string.format( &amp;quot;%s/%s&amp;quot;, start, script )&lt;br /&gt;
        if CurrentTitle.text == s then&lt;br /&gt;
            super = CurrentTitle.text .. &amp;quot;/&amp;quot;&lt;br /&gt;
        elseif sub then&lt;br /&gt;
            collect.subDoc = sub&lt;br /&gt;
            collect.subModule = sub&lt;br /&gt;
            s = string.format( &amp;quot;%s/%s/%s&amp;quot;, start, script, sub )&lt;br /&gt;
            if CurrentTitle.text == s then&lt;br /&gt;
                s = string.format( &amp;quot;%s/%s&amp;quot;, s, collect[ 3 ] )&lt;br /&gt;
                t = mw.title.makeTitle( nsDocs, s )&lt;br /&gt;
                if t.exists then&lt;br /&gt;
                    super = CurrentTitle.text .. &amp;quot;/&amp;quot;&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    elseif lead and sub then&lt;br /&gt;
        s = string.format( &amp;quot;%s/%s/%s&amp;quot;, start, script, sub )&lt;br /&gt;
        t = mw.title.makeTitle( nsDocs, s )&lt;br /&gt;
        if t.exists then&lt;br /&gt;
            collect.subDoc = sub&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if server:match( &amp;quot;%.beta%.wmflabs%.org$&amp;quot; ) then&lt;br /&gt;
        local slang, series = server:match( &amp;quot;//(%l+)%.(%l+)%.&amp;quot; )&lt;br /&gt;
        low = true&lt;br /&gt;
        if series == &amp;quot;wikipedia&amp;quot; then&lt;br /&gt;
            if slang == &amp;quot;de&amp;quot; then&lt;br /&gt;
                collect.BETA = &amp;quot;w:de:&amp;quot;   --Talk&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    r = Frame:expandTemplate{ title = swift, args = collect }&lt;br /&gt;
    if not low then&lt;br /&gt;
        t = CurrentTitle.talkPageTitle&lt;br /&gt;
        if t then&lt;br /&gt;
            s = t.exists&lt;br /&gt;
        else&lt;br /&gt;
            s = false&lt;br /&gt;
        end&lt;br /&gt;
        if not s then&lt;br /&gt;
            if super then&lt;br /&gt;
                s = &amp;quot;NoTalkCentral&amp;quot;&lt;br /&gt;
            elseif ns == nsDocs + 1 then&lt;br /&gt;
                s = false&lt;br /&gt;
            else&lt;br /&gt;
                s = &amp;quot;NoTalkRedir&amp;quot;&lt;br /&gt;
            end&lt;br /&gt;
            if s then&lt;br /&gt;
                r = r .. navError( s )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if super then&lt;br /&gt;
        local d  = &amp;quot;{{%s*[lL]uaModuleDoc[^}]*}}%s*&amp;quot;&lt;br /&gt;
        local p1 = &amp;quot;^%s*&amp;quot; .. d .. &amp;quot;&amp;lt;onlyinclude&amp;gt;&amp;quot;&lt;br /&gt;
        local p2 = &amp;quot;%s*&amp;lt;noinclude&amp;gt;&amp;quot; .. d .. &amp;quot;&amp;lt;/noinclude&amp;gt;&amp;quot;&lt;br /&gt;
        local space, sub, support&lt;br /&gt;
        for i = 3, #collect do&lt;br /&gt;
            t = mw.title.makeTitle( nsDocs,  super .. collect[ i ] )&lt;br /&gt;
            s = t:getContent()&lt;br /&gt;
            if s then&lt;br /&gt;
                s = s:gsub( p1, &amp;quot;&amp;quot; ):gsub( p2, &amp;quot;&amp;quot; )&lt;br /&gt;
                if s:match( d ) then&lt;br /&gt;
                    r = string.format( &amp;quot;%s&amp;lt;br /&amp;gt;%s&amp;lt;br /&amp;gt;&amp;quot;,&lt;br /&gt;
                                       r,&lt;br /&gt;
                                       navError( &amp;quot;BadInclude&amp;quot;,&lt;br /&gt;
                                                 t.prefixedText ) )&lt;br /&gt;
                else&lt;br /&gt;
                    r = r ..&lt;br /&gt;
                        Frame:expandTemplate{ title = t.prefixedText }&lt;br /&gt;
                    break    -- for i&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
        end -- for i&lt;br /&gt;
        s = fetch( &amp;quot;pageTemplateInsert&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
        space, support = s:match( &amp;quot;^([^:]+):(.+)$&amp;quot; )&lt;br /&gt;
        if space  and  mw.title.makeTitle( space, support ).exists then&lt;br /&gt;
            local suppress = fetch( &amp;quot;noHint&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
            if #suppress == 0 then&lt;br /&gt;
                local swift = collect[ 1 ]&lt;br /&gt;
                if sub then&lt;br /&gt;
                    swift = string.format( &amp;quot;%s/%s&amp;quot;, swift, sub )&lt;br /&gt;
                end&lt;br /&gt;
                r = r .. Frame:expandTemplate{ title = s,&lt;br /&gt;
                                               args = { swift } }&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        s = fetch( &amp;quot;categoryDocs&amp;quot;, &amp;quot;&amp;quot; )&lt;br /&gt;
        if #s &amp;gt; 0 then&lt;br /&gt;
            i = mw.title.makeTitle( &amp;quot;Category&amp;quot;, s )&lt;br /&gt;
            if i.exists then&lt;br /&gt;
                r = string.format( &amp;quot;%s[[%s|%s]]&amp;quot;,&lt;br /&gt;
                                   r, i.prefixedText, collect[ 1 ] )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
        r = r .. &amp;quot;__NOEDITSECTION__&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    if lead then&lt;br /&gt;
        r = r .. globalRepos( script )&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navMerge()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navPage( lead, ns, nsDocs )&lt;br /&gt;
    -- Return navigation text; analyze page location&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     current namespace will support LuaModuleDoc&lt;br /&gt;
    --     lead    -- true: Module: namespace;   false: text namespace&lt;br /&gt;
    --     ns      -- number; current namespace&lt;br /&gt;
    --     nsDocs  -- number; namespace for doc&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     navError()&lt;br /&gt;
    --     navMerge()&lt;br /&gt;
    local r&lt;br /&gt;
    local start = fetch( &amp;quot;pageDocRoot&amp;quot; )&lt;br /&gt;
    if type( start ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local s      = &amp;quot;^&amp;quot;&lt;br /&gt;
        local script&lt;br /&gt;
        if not lead then&lt;br /&gt;
            s = &amp;quot;^&amp;quot; .. start .. &amp;quot;/&amp;quot;&lt;br /&gt;
        end&lt;br /&gt;
        s = s .. &amp;quot;([^/]+)/(.*/?)$&amp;quot;&lt;br /&gt;
        script, s = string.match( CurrentTitle.text .. &amp;quot;/&amp;quot;,  s )&lt;br /&gt;
        if type( script ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
            local sub   = false&lt;br /&gt;
            local swift = fetch( &amp;quot;pageNav&amp;quot; )&lt;br /&gt;
            if type( s ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
                if #s &amp;gt; 1 then&lt;br /&gt;
                    local q&lt;br /&gt;
                    s = s:match( &amp;quot;^([^/]+)/.*/?$&amp;quot; )&lt;br /&gt;
                    q = mw.title.makeTitle( &amp;quot;Module&amp;quot;,&lt;br /&gt;
                                            script .. &amp;quot;/&amp;quot; .. s )&lt;br /&gt;
                    if q.exists and q.contentModel == &amp;quot;Scribunto&amp;quot; then&lt;br /&gt;
                        sub = s&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            if type( swift ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
                r = navMerge( start, swift, ns, nsDocs, script, sub, lead )&lt;br /&gt;
            else&lt;br /&gt;
                r = navError( &amp;quot;configMissing&amp;quot;, &amp;quot;pageNav&amp;quot; )&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            r = navError( &amp;quot;BadPage&amp;quot; ) .. CurrentTitle.text&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        r = navError( &amp;quot;configMissing&amp;quot;, &amp;quot;pageDocRoot&amp;quot; )&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- navPage()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function navigation()&lt;br /&gt;
    -- Start execution; return navigation text; analyze namespace&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     &amp;gt;&amp;lt; CurrentTitle&lt;br /&gt;
    --     fetch()&lt;br /&gt;
    --     mw.title.getCurrentTitle()&lt;br /&gt;
    --     navPage()&lt;br /&gt;
    --     navError()&lt;br /&gt;
    local r&lt;br /&gt;
    local nsDocs = fetch( &amp;quot;nsDocs&amp;quot; )&lt;br /&gt;
    if nsDocs then&lt;br /&gt;
        CurrentTitle = mw.title.getCurrentTitle()&lt;br /&gt;
        local ns   = CurrentTitle.namespace&lt;br /&gt;
        local lead = ( ns == mw.site.namespaces.Module.id )&lt;br /&gt;
        nsDocs = tonumber( nsDocs )&lt;br /&gt;
        if lead or  ns == nsDocs  or  ns == nsDocs + 1 then&lt;br /&gt;
            r = navPage( lead, ns, nsDocs )&lt;br /&gt;
        else&lt;br /&gt;
            r = navError( &amp;quot;BadNamespace&amp;quot; )&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        r = navError( &amp;quot;configMissing&amp;quot;, &amp;quot;nsDocs&amp;quot; )&lt;br /&gt;
    end&lt;br /&gt;
    return  r&lt;br /&gt;
end -- navigation()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- Provide template access&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.nav( frame )&lt;br /&gt;
    -- Uses:&lt;br /&gt;
    --     navigation()&lt;br /&gt;
    local lucky, r&lt;br /&gt;
    Frame = frame&lt;br /&gt;
    lucky, r = pcall( navigation )&lt;br /&gt;
    if not lucky then&lt;br /&gt;
        local e = mw.html.create( &amp;quot;span&amp;quot; )&lt;br /&gt;
                         :attr( &amp;quot;class&amp;quot;, &amp;quot;error&amp;quot; )&lt;br /&gt;
                         :wikitext( r )&lt;br /&gt;
        r = tostring( e )&lt;br /&gt;
    end&lt;br /&gt;
    return r or &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.failsafe()&lt;br /&gt;
    return Serial&lt;br /&gt;
end -- p.failsafe()&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>C1ph4</name></author>
	</entry>
</feed>