Zum Inhalt springen
Willkommen in der InkluPedia
Wenn dir dieses Wiki geholfen hat, würde sich die InkluPedia über eine Bewertung auf der Trustpilot-Website hierüber als Dankeschön freuen. Feedback zu diesem Wiki ist über das Kontaktformular oder nach eine Anmeldung möglich. Für eine Mitarbeit ist eine Anmeldung erforderlich, Angaben persönlicher Daten sind dabei nicht notwendig. Derzeit ist das wegen monatelangen Attacken von weltweit aktiven SPAM-Bots [1] nur über ein Formular möglich.

Modul:Coordinates/kml: Unterschied zwischen den Versionen

serial angepasst
(Modul neu nach https://de.wikipedia.org/wiki/Modul:Coordinates/kml , Autoren siehe https://de.wikipedia.org/w/index.php?title=Modul:Coordinates/kml&action=history und https://de.wikipedia.beta.wmflabs.org/w/index.php?title=Modul:Coordinates/kml)
 
(serial angepasst)
Zeile 1: Zeile 1:
local coordinates = { suite  = "Coordinates/kml",
local coordinates = { suite  = "Coordinates/kml",
                      serial = "2018-04-02",
                      serial = "2021-02-23 ",
                      item  = 50976437 }
                      item  = 50976437 }
--[=[
--[=[
Overcome a limitation in kmlexport in 2018.
Overcome a limitation in kmlexport in 2018.
 
There are three functions below which might be copied into an existing
There are three functions below which might be copied into an existing
      [[Module:Coordinates]] ([[d:Q7348344]])
      [[Module:Coordinates]] ([[d:Q7348344]])
or this module might be used stand-alone.
or this module might be used stand-alone.
 
In templates it can be used then by
In templates it can be used then by
        {{#invoke:Coordinates|kmlTitle|Some title for geohack}}
        {{#invoke:Coordinates|kmlTitle|Some title for geohack}}
or respectively (as is)
or respectively (as is)
        {{#invoke:Coordinates/kml|kmlTitle|Some title for geohack}}
        {{#invoke:Coordinates/kml|kmlTitle|Some title for geohack}}
]=]
]=]
 
 
 
coordinates.utf8max2bytes = function ( adjust )
coordinates.utf8max2bytes = function ( adjust )
    -- Save characters > 0x7FF by simplification
    -- Save characters > 0x7FF by simplification
    -- Precondition:
    -- Precondition:
    --    adjust  -- string to be adjusted
    --    adjust  -- string to be adjusted
    -- Postcondition:
    -- Postcondition:
    --    returns  string
    --    returns  string
    local r = adjust
    local r = adjust
    local lucky, translate = pcall( mw.loadData,
    local lucky, translate = pcall( mw.loadData,
                                    "Module:Sort/utf8max2bytes" )
                                    "Module:Sort/utf8max2bytes" )
    if type( translate ) == "table" then
    if type( translate ) == "table" then
        local Sort
        local Sort
        lucky, Sort = pcall( require, "Module:Sort" )
        lucky, Sort = pcall( require, "Module:Sort" )
        if type( Sort ) == "table" and
        if type( Sort ) == "table" and
          type( Sort.Sort ) == "function" then
          type( Sort.Sort ) == "function" then
          Sort = Sort.Sort()
          Sort = Sort.Sort()
            if type( Sort ) == "table" and
            if type( Sort ) == "table" and
              type( Sort.lex ) == "function" then
              type( Sort.lex ) == "function" then
                local s = Sort.lex( r, translate )
                local s = Sort.lex( r, translate )
                if type( s ) == "string" then
                if type( s ) == "string" then
                    r = s
                    r = s
                end
                end
            end
            end
        end
        end
    end
    end
    return r
    return r
end -- coordinates.utf8max2bytes()
end -- coordinates.utf8max2bytes()
 
 
 
coordinates._kmlTitle = function ( adjust )
coordinates._kmlTitle = function ( adjust )
    -- Hack kmlexport title as of 2018 UTF-8 limitation
    -- Hack kmlexport title as of 2018 UTF-8 limitation
    -- Precondition:
    -- Precondition:
    --    adjust  -- string to be adjusted
    --    adjust  -- string to be adjusted
    -- Postcondition:
    -- Postcondition:
    --    returns  string
    --    returns  string
    local pattern = mw.ustring.char( 91, 0x0800, 45, 0x7FFFF, 93 )
    local pattern = mw.ustring.char( 91, 0x0800, 45, 0x7FFFF, 93 )
    local r = mw.text.decode( adjust, true )
    local r = mw.text.decode( adjust, true )
    r = mw.text.trim( r )
    r = mw.text.trim( r )
    if mw.ustring.find( r, pattern ) then
    if mw.ustring.find( r, pattern ) then
        r = coordinates.utf8max2bytes( r )
        r = coordinates.utf8max2bytes( r )
        r = mw.ustring.gsub( r, pattern, "" )
        r = mw.ustring.gsub( r, pattern, "" )
    end
    end
    if mw.text.trim( r ) == "" then
    if mw.text.trim( r ) == "" then
        -- fall back to original string if all characters removed
        -- fall back to original string if all characters removed
        r = adjust
        r = adjust
    end
    end
    return r
    return r
end -- coordinates._kmlTitle()
end -- coordinates._kmlTitle()
 
 
 
coordinates.kmlTitle = function ( frame )
coordinates.kmlTitle = function ( frame )
    -- #invoke to adjust kmlexport title
    -- #invoke to adjust kmlexport title
    local r = frame.args[ 1 ]
    local r = frame.args[ 1 ]
    if r and r ~= "" then
    if r and r ~= "" then
        r = coordinates._kmlTitle( r )
        r = coordinates._kmlTitle( r )
    end
    end
    return r or ""
    return r or ""
end -- coordinates.kmlTitle
end -- coordinates.kmlTitle
 
 
 
return coordinates
return coordinates
66.474

Bearbeitungen