Dokumentation für das Modul Quickbar Notruf[Ansicht] [Bearbeiten] [Versionsgeschichte] [Aktualisieren]

Dieses Modul erzeugt eine Infobox mit Notrufnummern eines Landes. Eine detaillierte Dokumentation findest du auf der Vorlage Quickbar Notruf. Das Modul erzeugt indirekt auch eine Reihe von Wartungskategorien durch die verwendeten Wikidata-Module. Diese kannst du auf den Modulseiten der eingebundenen Getxxx-Module einsehen.

Verwandte Module

Verwendung

Benötigte weitere Module

Dieses Modul benötigt folgende weitere Module: GetItem
Hinweise
--[=[ Quickbar Notruf 2023-09-12 ]=]  local items    = require( 'Module:GetItem' )   -- returns nil, if both values are equal, otherwise the value -- similar to the SQL function nullif() local function nilIf ( value, equalValue )     if ( value == nil ) then       return nil    elseif ( tostring ( value ) == tostring ( equalValue ) ) then       return nil    else       return value    end  end   local qbNotruf = {}  function qbNotruf.qb_notruf ( frame )       -- copying and lowering the given parameters    local templateArgs = {}    for key,value in pairs ( frame.args ) do       templateArgs[string.lower(key)] = value    end    for key,value in pairs ( frame:getParent().args ) do       templateArgs[string.lower(key)] = value    end     -- variables for the whole quickbar content and the categories    local display = ''    local categories = ''        -- contains some site.infos    -- needed as fallback for the  parameter "Namen" and the location map    local page = {}    page = mw.title.getCurrentTitle()        -- getting or determining (if needed) the wikidata-ID    if templateArgs.id == '' then templateArgs.id = nil end    local qbID = nilIf ( nilIf ( templateArgs.id, 'self' ), '' ) or mw.wikibase.getEntityIdForCurrentPage() or ''     -- determining the country     -- (not urgently needed, but if someone wants to develop country- specific quickbars)    -- getting from Wikidata, if not provided    -- if you want to save processing time, you should provide it    -- e.g. in country specific infobox tables    local qbIso3166 = templateArgs["iso-3166"] or ''    local qbIso3166Class = ''     if qbIso3166 == '' then       if qbID ~= '' then          local wdCountry = mw.wikibase.getBestStatements( qbID, 'P17' )          local wdIso3166 = {}          if #wdCountry > 0 then             -- there where empty values             if wdCountry[1].mainsnak.datavalue ~= nil then                wdIso3166 = mw.wikibase.getBestStatements( wdCountry[1].mainsnak.datavalue.value["id"], 'P297' )                if #wdIso3166 > 0 then                   if wdIso3166[1].mainsnak.snaktype == 'value' then                      qbIso3166 = string.lower(wdIso3166[1].mainsnak.datavalue.value)                      qbIso3166Class =  ' voy-qb-' .. qbIso3166                   else                   	 qbIso3166Class = ''                   end                else                   qbIso3166Class = ''                end             else                 qbIso3166Class = ''             end          end       end    else       qbIso3166Class = ' voy-qb-' .. qbIso3166    end      -- starting the quickbar table    display = display .. '<table cellspacing="0" class="voy-qb voy-qb-right voy-qb-emergency-calls' .. qbIso3166Class .. '">'        -- creating the row with the heading    local trHeader = mw.html.create ( 'tr' )    trHeader:addClass( 'voy-qb-header' )    trHeader:tag('td')       :attr('colspan', 2 )       :wikitext('Hilfe')     -- adding it to the quickbar    display = display .. tostring ( trHeader )      -- official language    display = display .. mw.ustring.gsub ( mw.ustring.gsub ( items.GetItem().getItemsQuickbar ( qbID, 'P2852' ), 'Notruf ', '' ), 'Euronotruf ', '' )     -- finishing the HTML table    display = display .. '</table>'     return display .. categories     end  return qbNotruf