Loading AI tools
来自维基百科,自由的百科全书
您可能想要创建本Scribunto模块的文档。 编者可以在本模块的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模块的子页面。 |
local p = {}
local mError = require('Module:Error')
function processText(text)
local splits = mw.text.split(text, '\n')
for i, line in ipairs(splits) do
if mw.ustring.match(line, '^=.-=$') then
splits[i] = '=' .. line .. '='
end
end
return mw.text.listToText(splits, '\n', '\n')
end
function p.mergeCGroupContent(groups, locals)
if type(groups) ~= type({}) then
groups = {group}
end
for _, group in ipairs(groups) do
local status, module = pcall(require, 'Module:CGroup/' .. group)
if not status then
table.insert(locals, { type = 'text', text = mError.error({ '合併[[Module:CGroup/' .. group .. ']]失敗:' .. module, tag = 'div' }) })
else
table.insert(locals, { type = 'text', text = '== [[Module:CGroup/' .. group .. ']] ==' })
for _, line in ipairs(module.content) do
if line.type == 'text' then
table.insert(locals, { type = 'text', text = processText(line.text) })
else
table.insert(locals, line)
end
end
end
end
return locals
end
return p
Seamless Wikipedia browsing. On steroids.
Every time you click a link to Wikipedia, Wiktionary or Wikiquote in your browser's search results, it will show the modern Wikiwand interface.
Wikiwand extension is a five stars, simple, with minimum permission required to keep your browsing private, safe and transparent.