Wiktionary
nnwiktionary
https://nn.wiktionary.org/wiki/Hovudside
MediaWiki 1.47.0-wmf.21
case-sensitive
Filpeikar
Spesial
Diskusjon
Brukar
Brukardiskusjon
Wiktionary
Wiktionary-diskusjon
Fil
Fildiskusjon
MediaWiki
MediaWiki-diskusjon
Mal
Maldiskusjon
Hjelp
Hjelpdiskusjon
Kategori
Kategoridiskusjon
Undertekstar
Undertekstdiskusjon
Modul
Moduldiskusjon
Arrangement
Arrangementsdiskusjon
Modul:yesno
828
15954
80669
77866
2026-09-26T08:10:42Z
Njardarlogar
112
synka med en:
80669
Scribunto
text/plain
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
local lower = string.lower
local tonumber = tonumber
local type = type
local yesno
return function (val, default)
if val == nil then
return nil
elseif not yesno then
yesno = {
[true] = true, [false] = false,
["true"] = true, ["false"] = false,
["t"] = true, ["f"] = false,
[1] = true, [0] = false,
["1"] = true, ["0"] = false,
["yes"] = true, ["no"] = false,
["y"] = true, ["n"] = false,
["on"] = true, ["off"] = false,
}
end
local ret = yesno[val]
if ret ~= nil then
return ret
elseif type(val) ~= "string" then
return default
end
-- Catch inputs like "00".
ret = yesno[tonumber(val)]
if ret ~= nil then
return ret
end
-- Case-insensitive.
ret = yesno[lower(val)]
if ret ~= nil then
return ret
end
return default
end
50fw3j6qj6cod4hrcb5leyd15zs34hg
Modul:category tree/poscatboiler/data/lang-specific
828
16575
80670
80291
2026-09-26T08:14:01Z
Njardarlogar
112
unngå feilmelding
80670
Scribunto
text/plain
-- This module contains language-specific labels and handlers.
local langs_with_modules = {
["acw"] = true,
["afb"] = true,
["ajp"] = true,
["ang"] = true,
["apc"] = true,
["ar"] = true,
["ary"] = true,
["arz"] = true,
["az"] = true,
["be"] = true,
["bg"] = true,
["cs"] = true,
["cu"] = true,
["de"] = true,
["el"] = true,
["en"] = true,
["enm"] = true,
["es"] = true,
["eu"] = true,
["fa"] = true,
["fi"] = true,
["goh"] = true,
["grk-pro"] = true,
["he"] = true,
["hi"] = true,
["ira-pro"] = true,
["it"] = true,
["ja"] = true,
["la"] = true,
["mk"] = true,
["mt"] = true,
["ne"] = true,
["nl"] = true,
["nn"] = true,
["orv"] = true,
["pt"] = true,
["ru"] = true,
["ryu"] = true,
["sa"] = true,
["sc"] = true,
["tl"] = true,
["uk"] = true,
}
--------------------------- Generic driver handler ----------------------------
local function lang_specific_handler(data)
if not data.lang then
return nil
end
local langcode = data.lang:getCode()
if not langs_with_modules[langcode] then
return nil
end
local module = "Module:category tree/poscatboiler/data/lang-specific/" .. data.lang:getCode()
-- Lista over er henta frå en-wikt, og berre nokre av undermodulane finst på nn-wikt.
-- Manglar undermodulen, har språket ingen eigne merkelappar; andre feil vert sende vidare.
local ok, labels_and_handlers = pcall(require, module)
if not ok then
if type(labels_and_handlers) == "string" and
labels_and_handlers:find("module '" .. module .. "' not found", 1, true) then
return nil
end
error(labels_and_handlers, 0)
end
if labels_and_handlers.LABELS then
local retval = labels_and_handlers.LABELS[data.label]
if retval then
if retval.umbrella == nil and retval.umbrella_parents == nil then
retval.umbrella = false
end
retval.module = retval.module or module
return retval
end
end
if labels_and_handlers.HANDLERS then
for _, handler in ipairs(labels_and_handlers.HANDLERS) do
local retval, args_handled = handler(data)
if retval then
if retval.umbrella == nil and retval.umbrella_parents == nil then
retval.umbrella = false
end
retval.module = retval.module or module
return retval, args_handled
end
end
end
end
return {LABELS = {}, HANDLERS = {lang_specific_handler}}
sqjadxztmda9bodyydy5l96bndchiol
Modul:string/compare
828
16674
80667
2026-09-26T08:07:39Z
Njardarlogar
112
frå en:
80667
Scribunto
text/plain
local byte = string.byte
local match = string.match
local sub = string.sub
--[==[
A comparison function for strings, which returns {true} if {a} sorts before {b}, or otherwise {false}; it can be used as the sort function with {table.sort}.
This function always sorts using byte-order, which makes it roughly equivalent to the {<} operator, but with fixes for two serious bugs raised in [[phab:T193096#4161287]] and [[phab:T49137#9167559]]:
* {<} is supposed to compare UTF-8 codepoints in the two strings, but when a codepoint that is U+10000 or above is encountered in the left-hand string, {<} always returns {false}, irrespective of the content of the other string.
* {<} treats unassigned codepoints and non-UTF-8 byte sequences as being higher than {"\0"} but lower than {"\1"}, instead of sorting according to byte order.]==]
return function(a, b)
-- Equality check.
if a == b then
return false
end
-- Byte comparison is slow, so only do it when it's really needed:
-- iterate over both strings, grabbing a set of ASCII bytes followed by
-- a set of non-ASCII bytes from each (either of which could be empty),
-- and compare them with ==. If the ASCII substrings are unequal, just
-- use <, since the bug won't affect it. Otherwise, compare bytes in the
-- non-ASCII substrings.
local loc, ascii_a, nonascii_a, ascii_b, nonascii_b = 1
repeat
ascii_a, nonascii_a = match(a, "^([^\128-\255]*)([\128-\255]*)", loc)
ascii_b, nonascii_b, loc = match(b, "^([^\128-\255]*)([\128-\255]*)()", loc) -- update `loc` on the second call
-- When comparing ASCII sets, use <. The lower substring will be
-- from the lower string *except* when it comprises the start of the
-- other substring and is followed by a non-ASCII character. For
-- instance, if `ascii_a` is "pqrs":
-- If `ascii_b` is "abc", `b` is lower, since "abc" < "pqrs".
-- If `ascii_b` is "pqr" and followed by non-ASCII "ž", `a` is
-- lower, since "pqrs" < "pqrž".
-- If `ascii_b` is "pqr" and at the end of `b`, `b` is lower, since
-- "pqr" < "pqrs".
if ascii_a ~= ascii_b then
if ascii_a < ascii_b then
return nonascii_a == "" or ascii_a ~= sub(ascii_b, 1, #ascii_a)
end
return not (nonascii_b == "" or ascii_b ~= sub(ascii_a, 1, #ascii_b))
end
-- If the non-ASCII parts are not equal, terminate the loop.
until nonascii_a ~= nonascii_b
-- If either one is the empty string, then the end of that string has
-- been reached, making it the lower string.
if nonascii_a == "" then
return true
elseif nonascii_b == "" then
return false
end
loc = 1
while true do
-- 4 bytes at a time is a balance between minimizing the number of
-- byte() calls without grabbing unnecessary extra bytes after the
-- difference.
local b_a1, b_a2, b_a3, b_a4 = byte(nonascii_a, loc, loc + 3)
if b_a1 == nil then
return true
end
local b_b1, b_b2, b_b3, b_b4 = byte(nonascii_b, loc, loc + 3)
if b_a1 ~= b_b1 then
return b_b1 and b_a1 < b_b1
elseif b_a2 ~= b_b2 then
return b_a2 == nil or b_b2 and b_a2 < b_b2
elseif b_a3 ~= b_b3 then
return b_a3 == nil or b_b3 and b_a3 < b_b3
elseif b_a4 ~= b_b4 then
return b_a4 == nil or b_b4 and b_a4 < b_b4
end
loc = loc + 4
end
end
fshgty7mojs150t5jnkyy2f1rbcgty2
Modul:string/removeComments
828
16675
80668
2026-09-26T08:08:44Z
Njardarlogar
112
frå en:
80668
Scribunto
text/plain
local concat = table.concat
local find = string.find
local sub = string.sub
local function remove_comments(str, pre)
local pos1 = find(str, "<!--", nil, true)
if not pos1 then
return str
end
local pos2 = find(str, "-->", pos1 + 4, true)
if not pos2 then
return pre and sub(str, 1, pos1 - 1) or str
end
local ret = sub(str, 1, pos1 - 1)
pos1 = pos2 + 3
pos2 = find(str, "<!--", pos1, true)
if not pos2 then
return ret .. sub(str, pos1)
end
local pos3 = find(str, "-->", pos2 + 4, true)
if not pos3 then
return ret .. sub(str, pos1, pre and pos2 - 1 or nil)
end
ret = {ret, sub(str, pos1, pos2 - 1)}
local n = 2
while true do
pos1 = pos3 + 3
pos2 = find(str, "<!--", pos1, true)
if not pos2 then
return concat(ret) .. sub(str, pos1)
end
pos3 = find(str, "-->", pos2 + 4, true)
if not pos3 then
return concat(ret) .. sub(str, pos1, pre and pos2 - 1 or nil)
end
n = n + 1
ret[n] = sub(str, pos1, pos2 - 1)
end
end
--[==[Removes any HTML comments from the input text. `stage` can be one of three options:
* {"PRE"} (default) applies the method used by MediaWiki's preprocessor: all {{code|html|<nowiki><!-- ... --></nowiki>}} pairs are removed, as well as any text after an unclosed {{code|html|<nowiki><!--</nowiki>}}. This is generally suitable when parsing raw template or [[mw:Parser extension tags|parser extension tag]] code. (Note, however, that the actual method used by the preprocessor is considerably more complex and differs under certain conditions (e.g. comments inside nowiki tags); if full accuracy is absolutely necessary, use [[Module:template parser]] instead).
* {"POST"} applies the method used to generate the final page output once all templates have been expanded: it loops over the text, removing any {{code|html|<nowiki><!-- ... --></nowiki>}} pairs until no more are found (e.g. {{code|html|<nowiki><!-<!-- ... -->- ... --></nowiki>}} would be fully removed), but any unclosed {{code|html|<nowiki><!--</nowiki>}} is ignored. This is suitable for handling links embedded in template inputs, where the {"PRE"} method will have already been applied by the native parser.
* {"BOTH"} applies {"PRE"} then {"POST"}.]==]
return function(str, stage)
if stage == nil or stage == "PRE" then
return remove_comments(str, true)
elseif stage == "BOTH" then
str = remove_comments(str, true)
elseif stage ~= "POST" then
error("bad argument #2 to 'remove_comments' (expected PRE, POST, or BOTH)", 2)
end
while true do
local processed = remove_comments(str)
if processed == str then
return str
end
str = processed
end
end
6q2u94c4jook0g0vegx0uyg6x3jd1ms