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 = " | 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 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 | ||
if not Text.quoteLang then | |||
local lucky, quoting = pcall( mw.loadData, | |||
"Module:Text/quoting" ) | |||
if type( quoting ) == "table" then | |||
Text.quoteLang = quoting.langs | |||
Text.quoteType = quoting.types | |||
end | |||
if type( Text.quoteLang ) ~= "table" then | |||
Text.quoteLang = { } | |||
end | |||
if type( Text.quoteType ) ~= "table" then | |||
Text.quoteType = { } | |||
end | |||
if type( Text.quoteLang.en ) ~= "string" then | |||
Text.quoteLang.en = "ld" | |||
end | |||
if type( Text.quoteType[ Text.quoteLang.en ] ) ~= "table" then | |||
Text.quoteType[ Text.quoteLang.en ] = { { 8220, 8221 }, | |||
{ 8216, 8217 } } | |||
end | |||
end | |||
end -- factoryQuote() | end -- factoryQuote() | ||
| Zeile 102: | Zeile 52: | ||
local r = apply | local r = apply | ||
local suite | local suite | ||
factoryQuote() | |||
suite = Text.quoteLang[ alien ] | |||
suite = | |||
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 = | suite = Text.quoteLang[ slang ] | ||
end | end | ||
if not suite then | if not suite then | ||
suite = | suite = Text.quoteLang.en | ||
end | end | ||
end | end | ||
if suite then | if suite then | ||
local quotes = | 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, | ||
QuoteType = Text.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 | ||