1.581
Bearbeitungen
Cws (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „local p = {} -- Helper function to test for truthy and falsy values -- @todo Somehow internationalize it local function truthy(value) if not value or value =…“) |
Cws (Diskussion | Beiträge) |
||
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 118: | Zeile 118: | ||
-- Throws a Lua error or returns an empty string if error reporting is disabled | -- Throws a Lua error or returns an empty string if error reporting is disabled | ||
local function throwError(key, value) | local function throwError(key, value) | ||
-- local TNT = require('Module:TNT') | |||
-- local ok, message = pcall(TNT.format, 'I18n/Module:Transcluder.tab', 'error-' .. key, value) | |||
-- if not ok then message = key end | |||
message = key | |||
-- error(message, 2) | |||
error() | |||
end | end | ||
Zeile 127: | Zeile 129: | ||
-- Returns a wiki friendly error or an empty string if error reporting is disabled | -- Returns a wiki friendly error or an empty string if error reporting is disabled | ||
local function getError(key, value) | local function getError(key, value) | ||
-- local TNT = require('Module:TNT') | |||
-- local ok, message = pcall(TNT.format, 'I18n/Module:Transcluder.tab', 'error-' .. key, value) | |||
-- if not ok then message = key end | |||
message = key | |||
-- message = mw.html.create('div'):addClass('error'):wikitext(message) | |||
-- return message | |||
end | end | ||
Zeile 434: | Zeile 437: | ||
local count = 0 | local count = 0 | ||
local prefix, section, suffix | local prefix, section, suffix | ||
for title in string.gmatch('\n' .. text .. '\n==', '\n==+%s*([^=]+)%s*==+ | for title in string.gmatch('\n' .. text .. '\n==', '\n==+%s*([^=]+)%s*==+') do | ||
count = count + 1 | count = count + 1 | ||
prefix, section, suffix = string.match('\n' .. text .. '\n==', '\n()==+%s*' .. escapeString(title) .. '%s*==+(.-)()\n==') | prefix, section, suffix = string.match('\n' .. text .. '\n==', '\n()==+%s*' .. escapeString(title) .. '%s*==+(.-)()\n==') |