Modul:Text: Unterschied zwischen den Versionen

2018-11-14
w>PerfektesChaos
(2017-11-01)
w>PerfektesChaos
(2018-11-14)
Zeile 1: Zeile 1:
local Text = { serial = "2017-11-01",
local Text = { serial = "2018-11-14",
               suite  = "Text" }
               suite  = "Text" }
--[=[
--[=[
Zeile 12: Zeile 12:
local PatternLatin      = false
local PatternLatin      = false
local PatternTerminated = false
local PatternTerminated = false
local QuoteLang        = false
local QuoteType        = false
local RangesLatin      = false
local RangesLatin      = false
local SeekQuote        = false
local SeekQuote        = false
Zeile 21: Zeile 19:
local function factoryQuote()
local function factoryQuote()
     -- Create quote definitions
     -- Create quote definitions
     QuoteLang = { af        = "bd",
     if not Text.quoteLang then
                  ar        = "la",
        local lucky, quoting = pcall( mw.loadData,
                  be        = "labd",
                                      "Module:Text/quoting" )
                  bg        = "bd",
        if type( quoting ) == "table" then
                  ca        = "la",
            Text.quoteLang = quoting.langs
                  cs        = "bd",
            Text.quoteType = quoting.types
                  da        = "bd",
        end
                  de        = "bd",
        if type( Text.quoteLang ) ~= "table" then
                  dsb      = "bd",
            Text.quoteLang = { }
                  et        = "bd",
        end
                  el        = "lald",
        if type( Text.quoteType ) ~= "table" then
                  en        = "ld",
             Text.quoteType = { }
                  es        = "la",
        end
                  eu        = "la",
        if type( Text.quoteLang.en ) ~= "string" then
             --    fa        = "la",
            Text.quoteLang.en = "ld"
                  fi        = "rd",
        end
                  fr        = "laSPC",
        if type( Text.quoteType[ Text.quoteLang.en ] ) ~= "table" then
                  ga        = "ld",
            Text.quoteType[ Text.quoteLang.en ] = { { 8220, 8221 },
                  he        = "ldla",
                                                    { 8216, 8217 } }
                  hr        = "bd",
        end
                  hsb      = "bd",
     end
                  hu        = "bd",
                  hy        = "labd",
                  id        = "rd",
                  is        = "bd",
                  it        = "ld",
                  ja        = "x300C",
                  ka        = "bd",
                  ko        = "ld",
                  lt        = "bd",
                  lv        = "bd",
                  nl        = "ld",
                  nn        = "la",
                  no        = "la",
                  pl        = "bdla",
                  pt        = "lald",
                  ro        = "bdla",
                  ru        = "labd",
                  sk        = "bd",
                  sl        = "bd",
                  sq        = "la",
                  sr        = "bx",
                  sv        = "rd",
                  th        = "ld",
                  tr        = "ld",
                  uk        = "la",
                  zh        = "ld",
                  ["de-ch"] = "la",
                  ["en-gb"] = "lsld",
                  ["en-us"] = "ld",
                  ["fr-ch"] = "la",
                  ["it-ch"] = "la",
                  ["pt-br"] = "ldla",
                  ["zh-tw"] = "x300C",
                  ["zh-cn"] = "ld" }
    QuoteType = { bd    = { { 8222, 8220 },  { 8218, 8217 } },
                  bdla  = { { 8222, 8220 },  {  171,  187 } },
                  bx    = { { 8222, 8221 },  { 8218, 8217 } },
                  la    = { {  171,  187 },  { 8249, 8250 } },
                  laSPC = { {  171,  187 },  { 8249, 8250 },  true },
                  labd  = { {  171,  187 },  { 8222, 8220 } },
                  lald  = { {  171,  187 },  { 8220, 8221 } },
                  ld    = { { 8220, 8221 },  { 8216, 8217 } },
                  ldla  = { { 8220, 8221 },  {  171,  187 } },
                  lsld  = { { 8216, 8217 },  { 8220, 8221 } },
                  rd    = { { 8221, 8221 },  { 8217, 8217 } },
                  x300C = { { 0x300C, 0x300D },
                            { 0x300E, 0x300F } } }
     return r
end -- factoryQuote()
end -- factoryQuote()


Zeile 102: Zeile 52:
     local r = apply
     local r = apply
     local suite
     local suite
     if not QuoteLang then
     factoryQuote()
        factoryQuote()
     suite = Text.quoteLang[ alien ]
    end
     suite = QuoteLang[ alien ]
     if not suite then
     if not suite then
         local slang = alien:match( "^(%l+)-" )
         local slang = alien:match( "^(%l+)-" )
         if slang then
         if slang then
             suite = QuoteLang[ slang ]
             suite = Text.quoteLang[ slang ]
         end
         end
         if not suite then
         if not suite then
             suite = QuoteLang[ "en" ]
             suite = Text.quoteLang.en
         end
         end
     end
     end
     if suite then
     if suite then
         local quotes = QuoteType[ suite ]
         local quotes = Text.quoteType[ suite ]
         if quotes then
         if quotes then
             local space
             local space
Zeile 613: Zeile 561:
     if about == "quote" then
     if about == "quote" then
         factoryQuote()
         factoryQuote()
         r = { }
         r = { QuoteLang = Text.quoteLang,
        r.QuoteLang = QuoteLang
              QuoteType = Text.quoteType }
        r.QuoteType = QuoteType
     end
     end
     return r
     return r
Zeile 783: Zeile 730:
function p.ucfirstAll( frame )
function p.ucfirstAll( frame )
     return Text.ucfirstAll( frame.args[ 1 ] or "" )
     return Text.ucfirstAll( frame.args[ 1 ] or "" )
end
function p.unstrip( frame )
    return mw.text.trim( mw.text.unstrip( frame.args[ 1 ] or "" ) )
end
end


Anonymer Benutzer