Modul:Vorlage:lang/Zwiebelfisch

aus Wikipedia, der freien Enzyklopädie
local Serial = "2019-11-01"
--[=[
dewiki-Suche nach Zwiebelfisch für Vorlage:lang
]=]


local CatMix = "Wikipedia:Vorlagenfehler/Vorlage:lang/Zwiebelfisch"



-- Export
local p = { }

p.finder = function ( apply, assume )
    -- Run analysis
    --     apply   -- string, with text
    --     assume  -- string, with expected script code
    -- Returns string with error handling, or false
    local title = mw.title.getCurrentTitle()
    local r
    if title.namespace == 0 then
        local lucky, bib = pcall( require, "Module:ISO15924" )
        if type( bib ) == "table"  and
           type( bib.ISO15924 ) == "function" then
            bib = bib.ISO15924()
            if type( bib ) == "table" then
                local e, cp = bib.isScript( assume, apply )
                if not e then
                    local m, n = bib.testScripts( assume, cp )
                    if n > 0  and  m > 0 then
                        local e = mw.html.create( "span" )
                                         :addClass( "error" )
                                         :addClass( "Zwiebelfisch" )
                                         :css( { display = "none" } )
                        local s = "Category:" .. CatMix
                        r = bib.showScripts( cp )
                        r = string.format( " [[:%s|%s]] %s",
                                           s,
                                           "Zwiebelfisch",
                                           r )
                        r = tostring( e:wikitext( r ) )
                        if not bib.isCJK( assume )  or
                           r:find( "-Latn", 52, true ) then
                            r = string.format( "%s[[%s|%s]]",
                                               r,
                                               s,
                                               assume )
                        end
                    end
                end
            end
        end
    end
    return r
end -- p.finder()



p.failsafe = function ()
    return Serial
end -- p.failsafe()

return p