မေႃႇၵျူး:Gadgets
Appearance
| ဢဝ် မေႃႇၵျူး ၼႆႉ ၸႂ်ႉဝႆႉတီႈ တူဝ်လိၵ်ႈ ပိူင် ယဝ်ႉ။ ပေႃးႁဵတ်းလွင်ႈလႅၵ်ႈလၢႆႈ ဢၼ်ၼႆႉၼႆႉ တေၸၢင်ႈႁႂ်ႈပဵၼ် လွင်ႈလႅၵ်ႈလၢႆႈၸူး ၽၢင်ႁၢင်ႈ ၽူႈၸႂ်ႉတိုဝ်းဝီႇၶီႇၽီးတီးယႃး ၵမ်းလဵဝ်ယဝ်ႉ။တွၼ်ႈတႃႇ ငိူင်ႉဝႄႈလႆႈ လွင်ႈပဵၼ် တၢင်းယုင်ႈၵဝ်း ယႂ်ႇယႂ်ႇလူင်လူင်ၼႆႉ လွင်ႈလႅၵ်ႈလၢႆႈ ဢၼ်လႂ်သေဢမ်ႇဝႃႈ ဢဝ်တင်း မေႃႇၵျူး ႁင်း /sandbox ဢမ်ႇၼၼ် /testcases ၼႃႈလိၵ်ႈၽႄ၊ ဢမ်ႇၼၼ် ၸၢမ်းတူၺ်းဢွၼ်တၢင်း ၵႃႈတီႈဢွင်ႈတီႈၽူႈၸႂ်ႉတိုဝ်း သုၼ်ႇတူဝ်ၼၼ်ႉလႄႈ။ တီႈလွင်ႈလႅၵ်ႈလၢႆႈၸိူဝ်းၼၼ်ႉ ႁဵတ်းလွင်ႈမႄးထတ်း ပွၵ်ႈလဵဝ်ၵူၺ်းသေၵေႃႈ ၸၢင်ႈသႂ်ႇလႆႈတီႈ မေႃႇၵျူး ယူႇ။ မိူဝ်ႈပႆႇသႂ်ႇ လွင်ႈလႅၵ်ႈလၢႆႈ ဢၼ်လႂ်သေဢမ်ႇဝႃႈ ဢုပ်ႇဢူဝ်း တီႈ ၼႃႈလိၵ်ႈ တႃႇဢုပ်ႇၼၼ်ႉ လႄႈ။ |
moduleဢၼ်ၼႆႉ မၼ်း ၶဝ်ႈပႃးဝႆႉ တီႈၼႂ်း ၼႃႈလိၵ်ႈ ဢၼ်ၵွင်ႉၵၢႆႇႁႄႉၵင်ႈဝႆႉ ၊ ယွၼ်ႉၼၼ်လႄႈ ၸိူဝ်းပဵၼ် ၽူႈၵမ်ၵၢၼ်ၶဝ်ၵူၺ်း တေၸၢင်ႈမႄးထတ်း မၼ်းလႆႈ။ |
Module to parse gadget definitions from MediaWiki:Gadgets-definition.
လွင်ႈၸႂ်ႉတိုဝ်း
[မႄးထတ်းငဝ်ႈငႃႇ]Intended for use from other modules only.
local gadgets = require('Module:Gadgets')
local gadgetRegistry = gadgets.parse()
local p = {}
p.parse = function()
local text = mw.title.new('MediaWiki:Gadgets-definition'):getContent()
local lines = mw.text.split(text, '\n', false)
local repo = {}
for _, line in ipairs(lines) do
if line:sub(1, 1) == '*' then
local name, options, pages = p.parse_line(line)
if name and #pages ~= 0 then
repo[name] = { options = options, pages = pages }
end
end
end
return repo
end
p.parse_line = function(def)
local pattern = "^%*%s*(.+)%s*(%b[])%s*(.-)$"
local name, opts, pageList = string.match(def, pattern)
if name then
name = mw.text.trim(name)
end
-- Process options string into a Lua table
local options = {}
if opts then
-- Extracting the options without square brackets and trimming spaces
opts = opts:sub(2, -2):gsub("%s+", "")
for pair in opts:gmatch("%s*([^|]+)%s*|?") do
local key, value = pair:match("%s*([^=]+)%s*=%s*([^=|]+)%s*")
if key and value then
options[key:match("%s*(.-)%s*$")] = value:match("^%s*(.-)%s*$")
else
key = pair:match("%s*(.-)%s*$")
options[key] = true
end
end
end
-- Process page list into an array
local pages = {}
if pageList then
for page in pageList:gmatch("[^|]+") do
table.insert(pages, mw.text.trim(page))
end
end
return name, options, pages
end
p.get_type = function(def)
if def.options.type == 'general' or def.options.type == 'styles' then
return def.options.type
end
if def.options.dependencies ~= nil then
return 'general'
end
for _, page in ipairs(def.pages) do
if not string.match(page, '%.css$') then
return 'general'
end
end
return 'styles'
end
p.get_usage = function(name)
-- escape name for use in pattern
name = name:gsub("[%-%.%+%[%]%(%)%$%^%%%?%*]", "%%%1"):gsub("_", " ")
-- rely on [[Project:GUS2Wiki]] until [[phab:T354890]] is implemented
local _, _, count = mw.title.new('Project:GUS2Wiki'):getContent():find('\n'..name..',(%d+)')
return tonumber(count) or -1
end
return p