跳转到内容

模組:沙盒/Lopullinen/doc

维基百科,自由的百科全书

这是本页的一个历史版本,由For Each element In group ... Next留言 | 贡献2025年4月3日 (四) 13:28编辑。这可能和当前版本存在着巨大的差异。

这是Module:沙盒/Lopullinen的文档页面

测试区

  • {{#invoke:沙盒/Lopullinen|target}}脚本错误:函数“target”不存在。
  • {{#invoke:沙盒/Lopullinen|target|issue}}脚本错误:函数“target”不存在。
  • {{#invoke:沙盒/Lopullinen|link}}脚本错误:函数“link”不存在。
  • {{#invoke:沙盒/Lopullinen|link|feature|status=pending}}脚本错误:函数“link”不存在。
  • {{#invoke:沙盒/Lopullinen|link|news|status=ondraft}}脚本错误:函数“link”不存在。
  • {{#invoke:沙盒/Lopullinen|content|id=2020-01}}脚本错误:函数“content”不存在。
  • {{#invoke:沙盒/Lopullinen|index}}脚本错误:函数“index”不存在。

备忘录

-- 获取页面信息
mw.title.getCurrentTitle().text -- 獲取頁面標題,不含命名空間

-- 调用Mediawiki模板
mw.getCurrentFrame():expandTemplate{ title = 'template', args = { 'arg1', 'arg2', name = 'arg3' } }  -- {{template|args1|args2|name=args3}}
mw.getCurrentFrame():callParserFunction{ name = '#tag', args = { 'nowiki', 'some text' } }  -- {{#tag:nowiki|some text}}

-- 字符串处理
_, _, capture1, capture2 = mw.ustring.find(source_text, '(.+)blah blah(.+)')  -- 分組捕獲
new_string = mw.ustring.gsub(old_string, ptn, replacement)  -- 替换