查看“模块:Main”的源代码
←
模块:Main
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
该页面已被保护以防止编辑和其他操作。
本页面已经受到保护,不能编辑,因为它被嵌入于以下被“连锁保护”的页面:
模板:Main
模块:Main
您必须确认您的电子邮件地址才能编辑页面。请通过
系统设置
设置并确认您的电子邮件地址。
您可以查看与复制此页面的源代码。
--[[ -- This module produces a link to a main article or articles. It implements the -- template {{main}}. -- -- If the module is used in category or category talk space, it produces "The -- main article for this category is xxx". Otherwise, it produces -- "Main article: xxx". --]] local mHatnote = require('Module:Hatnote') local mTableTools -- lazily initialise local mArguments -- lazily initialise local p = {} function p.main(frame) mTableTools = require('Module:TableTools') mArguments = require('Module:Arguments') local args = mArguments.getArgs(frame, {parentOnly = true}) local pages = {} --模板版的限制 local limit =10 local islimit=false local limittext = "<span class=\"error\">(在模板"..frame:expandTemplate{title="tl",args={"main"}}.."中使用了太多的参数)</span>" --模板版的限制 for k, v in pairs(args) do if type(k) == 'number' then if k > limit then islimit=true break else local display = args['l' .. tostring(k)] local page = {v, display} pages[k] = page end end end pages = mTableTools.compressSparseArray(pages) local options = { selfref = args.selfref } return p._main(frame,options, unpack(pages)) .. ((islimit and limittext) or "") end function p._main(frame,options, ...) -- Get the list of pages. If no first page was specified we use the current -- page name. local pages = {...} local currentTitle = mw.title.getCurrentTitle() local firstPageTable = pages[1] local firstPage if firstPageTable then firstPage = firstPageTable[1] else firstPage = currentTitle.text firstPageTable = {firstPage} pages[1] = firstPageTable end -- Find the pagetype. local firstPageNs = mHatnote.findNamespaceId(firstPage) local pagetype = firstPageNs == 0 and '条目' or '页面' -- Make the formatted link text local links = mHatnote.formatPageTables(unpack(pages)) links = mw.text.listToText(links) -- Build the text. local currentNs = currentTitle.namespace local isCategoryNamespace = currentNs - currentNs % 2 == 14 local stringToFormat if isCategoryNamespace then stringToFormat = '此[[Wikipedia:頁面分類|分类]]的主%s是%s' else stringToFormat = '主%s:%s' end local text = string.format(stringToFormat, pagetype, links) -- Process the options and pass the text to the _rellink function in -- [[Module:Hatnote]]. --[[options = options or {} local hnOptions = { extraclasses = 'noprint relarticle mainarticle' --追加noprint的css类 ,selfref = options.selfref } return mHatnote._hatnote(text, hnOptions)]] return frame:expandTemplate{title="rellink",args={text,extraclasses='noprint relarticle mainarticle'}} --没想到Hatnote与{{rellink}}实现不同,替代品 end return p
该页面使用的模板:
模板:Code
(
查看源代码
)
模板:Main
(
查看源代码
)(受保护)
模板:Tl
(
查看源代码
)
模板:Transclude
(
查看源代码
)
模板:Translating
(
查看源代码
)
模块:Main
(
查看源代码
)(受保护)
模块:Main/doc
(
查看源代码
)
返回至
模块:Main
。
导航菜单
个人工具
创建账户
登录
命名空间
模块
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
首页
所有条目
分类索引
PV政策
PV人物
PV电站
PV企业
PV技术
PV标准
PV工艺
PV导航
最近更改
随机页面
帮助
编辑规范
新手速成
编辑手册
能库部署
帮助
链接
光伏們
坎德拉学院
关于
我们的目标
关于能库
工具
链入页面
相关更改
特殊页面
页面信息