<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://wiki.cowboy-of-bottrop.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3AVorlage%3AGoogleBook</id>
	<title>Modul:Vorlage:GoogleBook - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cowboy-of-bottrop.de/index.php?action=history&amp;feed=atom&amp;title=Modul%3AVorlage%3AGoogleBook"/>
	<link rel="alternate" type="text/html" href="https://wiki.cowboy-of-bottrop.de/index.php?title=Modul:Vorlage:GoogleBook&amp;action=history"/>
	<updated>2026-08-02T05:54:57Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Cowboy’s Wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.cowboy-of-bottrop.de/index.php?title=Modul:Vorlage:GoogleBook&amp;diff=5932&amp;oldid=prev</id>
		<title>Cowboy: Die Seite wurde neu angelegt: „local GoogleBook = { suite  = &quot;GoogleBook&quot;,                      serial = &quot;2024-04-22&quot;,                      item   = 125516841 } --[=[ Template:Google Buch ]=]  local Failsafe = GoogleBook    local function factory( args )     -- Create alerts table from template args     -- Precondition:     --     args   -- table, with error message strings     -- Postcondition:     --     Returns  table, with error messages     local r = { }     local suffixes = &quot;CHNP…“</title>
		<link rel="alternate" type="text/html" href="https://wiki.cowboy-of-bottrop.de/index.php?title=Modul:Vorlage:GoogleBook&amp;diff=5932&amp;oldid=prev"/>
		<updated>2026-07-30T15:32:26Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „local GoogleBook = { suite  = &amp;quot;GoogleBook&amp;quot;,                      serial = &amp;quot;2024-04-22&amp;quot;,                      item   = 125516841 } --[=[ Template:Google Buch ]=]  local Failsafe = GoogleBook    local function factory( args )     -- Create alerts table from template args     -- Precondition:     --     args   -- table, with error message strings     -- Postcondition:     --     Returns  table, with error messages     local r = { }     local suffixes = &amp;quot;CHNP…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local GoogleBook = { suite  = &amp;quot;GoogleBook&amp;quot;,&lt;br /&gt;
                     serial = &amp;quot;2024-04-22&amp;quot;,&lt;br /&gt;
                     item   = 125516841 }&lt;br /&gt;
--[=[&lt;br /&gt;
Template:Google Buch&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local Failsafe = GoogleBook&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function factory( args )&lt;br /&gt;
    -- Create alerts table from template args&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     args   -- table, with error message strings&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --     Returns  table, with error messages&lt;br /&gt;
    local r = { }&lt;br /&gt;
    local suffixes = &amp;quot;CHNP&amp;quot;&lt;br /&gt;
    local s, sign&lt;br /&gt;
    for i = 2, #suffixes do&lt;br /&gt;
        sign = suffixes:sub( i, i )&lt;br /&gt;
        s    = args[ &amp;quot;err&amp;quot; .. sign ]&lt;br /&gt;
        if type( s ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
            s = mw.text.trim( s )&lt;br /&gt;
            if s ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                r[ sign:lower() ] = s&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end -- for i&lt;br /&gt;
    return r&lt;br /&gt;
end -- factory()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
GoogleBook.fine = function ( at, alerts, assign, apply, about )&lt;br /&gt;
    -- Check identifier&lt;br /&gt;
    -- Precondition:&lt;br /&gt;
    --     at       -- identifier&lt;br /&gt;
    --     alerts   -- table, with error message strings, or not&lt;br /&gt;
    --                 .n   -- if length invalid, or not&lt;br /&gt;
    --                 .c   -- if ID invalid, or not&lt;br /&gt;
    --                 .h   -- if # in parameters, or not&lt;br /&gt;
    --                 .p   -- if parameters invalid, or not&lt;br /&gt;
    --     assign   -- error category if invalid, or not&lt;br /&gt;
    --     apply    -- additional class for error messages, or not&lt;br /&gt;
    --     about    -- string mentioning template, or not&lt;br /&gt;
    -- Postcondition:&lt;br /&gt;
    --     Returns  string  -- error, wikitext&lt;br /&gt;
    --              false   -- fine&lt;br /&gt;
    --              true    -- if invalid but no signalling&lt;br /&gt;
    local errs, r, s&lt;br /&gt;
    if type( alerts ) == &amp;quot;table&amp;quot; then&lt;br /&gt;
        errs = alerts&lt;br /&gt;
    else&lt;br /&gt;
        errs = { }&lt;br /&gt;
    end&lt;br /&gt;
    if type( at ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        local u&lt;br /&gt;
        s = mw.text.trim( at )&lt;br /&gt;
        if s:find( &amp;quot;&amp;amp;&amp;quot; ) then&lt;br /&gt;
            u = mw.text.split( s, &amp;quot;&amp;amp;&amp;quot; )&lt;br /&gt;
            s = u[ 1 ]&lt;br /&gt;
        end&lt;br /&gt;
        if s:len() == 12 then&lt;br /&gt;
            if s:match( &amp;quot;^[%w_%-]+$&amp;quot; ) then&lt;br /&gt;
                if u then&lt;br /&gt;
                    if #u == 2 then&lt;br /&gt;
                        s = u[ 2 ]&lt;br /&gt;
                        if s:find( &amp;quot;#&amp;quot;, 1, true ) then&lt;br /&gt;
                            r = errs.h or true&lt;br /&gt;
                        elseif not s:match( &amp;quot;^%w+=%S+$&amp;quot; ) then&lt;br /&gt;
                            if s == &amp;quot;&amp;quot;  or&lt;br /&gt;
                               s == &amp;quot;dq&amp;quot;  or&lt;br /&gt;
                               s == &amp;quot;pg&amp;quot;  or&lt;br /&gt;
                               s == &amp;quot;q&amp;quot; then&lt;br /&gt;
                                   r = errs.p or true&lt;br /&gt;
                               end&lt;br /&gt;
                        end&lt;br /&gt;
                    elseif                                    false then&lt;br /&gt;
                        for i = 2, #u do&lt;br /&gt;
                             s = u[ i ]&lt;br /&gt;
                             if not s:match( &amp;quot;^%S+$&amp;quot; ) then&lt;br /&gt;
                                 r = errs.p or true&lt;br /&gt;
                                 break -- for i&lt;br /&gt;
                             end&lt;br /&gt;
                        end -- for i&lt;br /&gt;
                    end&lt;br /&gt;
                end&lt;br /&gt;
            else&lt;br /&gt;
                r = errs.c or true&lt;br /&gt;
            end&lt;br /&gt;
        else&lt;br /&gt;
            r = errs.n or true&lt;br /&gt;
        end&lt;br /&gt;
    else&lt;br /&gt;
        r = errs.n or true&lt;br /&gt;
    end&lt;br /&gt;
    if type( r ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        s = mw.text.trim( r )&lt;br /&gt;
        if s == &amp;quot;&amp;quot; then&lt;br /&gt;
            r = &amp;quot;&amp;quot;&lt;br /&gt;
        else&lt;br /&gt;
            local e = mw.html.create( &amp;quot;span&amp;quot; )&lt;br /&gt;
                        :addClass( &amp;quot;error&amp;quot; )&lt;br /&gt;
            if about then&lt;br /&gt;
                e:wikitext( about .. &amp;quot;&amp;amp;#32;&amp;amp;#8211;&amp;amp;#32;&amp;quot; )&lt;br /&gt;
            end&lt;br /&gt;
            e:wikitext( s )&lt;br /&gt;
            if apply then&lt;br /&gt;
                s = mw.text.trim( apply )&lt;br /&gt;
                if s ~= &amp;quot;&amp;quot; then&lt;br /&gt;
                    e:addClass( s )&lt;br /&gt;
                     :css( &amp;quot;display&amp;quot;, &amp;quot;none&amp;quot; )&lt;br /&gt;
                end&lt;br /&gt;
            end&lt;br /&gt;
            r = tostring( e )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    if r  and  type( assign ) == &amp;quot;string&amp;quot; then&lt;br /&gt;
        s = mw.text.trim( assign )&lt;br /&gt;
        if s ~= &amp;quot;&amp;quot; then&lt;br /&gt;
            if type( r ) ~= &amp;quot;string&amp;quot; then&lt;br /&gt;
                r = &amp;quot;&amp;quot;&lt;br /&gt;
            end&lt;br /&gt;
            r = string.format( &amp;quot;%s[[Category:%s]]&amp;quot;, r, s )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
    return r or false&lt;br /&gt;
end -- GoogleBook.fine()&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;
    -- 2024-03-01&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;
        elseif link then&lt;br /&gt;
            r = false&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;
&lt;br /&gt;
&lt;br /&gt;
p.fine = function ( frame )&lt;br /&gt;
    -- Check identifier&lt;br /&gt;
    -- #invoke&lt;br /&gt;
    --     id        -- identifier&lt;br /&gt;
    --     errN      -- error message if length invalid, or not&lt;br /&gt;
    --     errC      -- error message if ID invalid, or not&lt;br /&gt;
    --     errH      -- error message if # in parameters, or not&lt;br /&gt;
    --     errP      -- error message if parameters invalid, or not&lt;br /&gt;
    --     cat       -- error category if invalid, or not&lt;br /&gt;
    --     class     -- additional class for error messages, or not&lt;br /&gt;
    --     template  -- mentioning template, or not&lt;br /&gt;
    local r = GoogleBook.fine( frame.args.id,&lt;br /&gt;
                               factory( frame.args ),&lt;br /&gt;
                               frame.args.cat,&lt;br /&gt;
                               frame.args.class,&lt;br /&gt;
                               frame.args.template )&lt;br /&gt;
    if type( r ) ~= &amp;quot;string&amp;quot; then&lt;br /&gt;
        r = &amp;quot;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end -- p.fine&lt;br /&gt;
&lt;br /&gt;
&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;
&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>Cowboy</name></author>
	</entry>
</feed>