跳至內容
主選單
主選單
移至側邊欄
隱藏
導覽
首頁
最近修改
分類索引
隨機頁面
貢獻分數
建立新頁面
工具
上傳檔案
特殊頁面
搜尋
搜尋
建立賬號
登入
個人工具
暗色模式
建立賬號
登入
用於已登出編輯者的頁面
了解更多
貢獻
討論
正在編輯
模組:Page
模組
討論
English
閱讀
編輯原始碼
檢視歷史
工具
工具
移至側邊欄
隱藏
操作
閱讀
編輯原始碼
檢視歷史
一般
連結至此的頁面
相關變更
特殊頁面
頁面資訊
取得短網址
警告:
您尚未登入。 若您進行任何的編輯您的 IP 位址將會被公開。 若您
登入
或
建立帳號
,您的編輯將會以您的使用者名稱標示,並能擁有另外的益處。
防垃圾訊息檢查用。
請勿
填寫此欄位!
---- This module is meant to allow the goodies listed in ---- http://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Title_objects ---- to be accessed by people who don't want to program a Lua module. ---- Usage is: {{#invoke:Page|(function)|parameters}} ---- (function) is one of the function names from the table above: ---- id, interwiki, namespace, fragment, nsText, subjectNsText, text, prefixedText, fullText ... ---- parameters are: ---- page = (name of page to load; leave blank to call mw.title.getCurrentTitle() ---- this is "text" passed to mw.title.new or "title" passed to mw.title.makeTitle ---- makeTitle = nonblank to call mw.title.makeTitle otherwise mw.title.new is called ---- namespace = (parameter passed to new/makeTitle) ---- fragment = (parameter passed to makeTitle) ---- interwiki = (parameter passed to makeTitle) ---- p1 = first parameter passed to functions within the title object ---- p2 = second parameter " " " " ---- p3 etc. (for inNamespaces) function main(frame, field) local args, pargs = frame.args, ( frame:getParent() or {} ).args or {}; local makeTitle=args.makeTitle or pargs.makeTitle or ""; local namespace=args.namespace or pargs.namespace or ""; local fragment=args.fragment or pargs.fragment or ""; local interwiki=args.interwiki or pargs.interwiki or ""; local nowiki=args.nowiki or pargs.nowiki or false; local page=args.page or args[1] or pargs.page or pargs[1] or ""; local id= tonumber( args.id or pargs.id ); local pn = {}; local title -- holds the result of the mw.title.xxx call for i = 1,9 do pn[i] = args['p'..i] or pargs['p'..i]; end if not id and not mw.ustring.match( page, '%S' ) then page = nil; end if id then title = mw.title.new(id); if not title then return "error: failed to mw.title.new(" .. id .. ")"; end elseif not page then title = mw.title.getCurrentTitle(); if not title then return "error: failed to getCurrentTitle()"; end elseif makeTitle then title = mw.title.makeTitle(namespace, page, fragment, interwiki); if not title then return mw.ustring.format("error: failed to makeTitle(%s,%s,%s,%s)", namespace, page, fragment, interwiki); end else title=mw.title.new(page, namespace); if not title then return "error: failed to mw.title.new(" .. page .. "," .. namespace .. ")"; end end local result, success = title[field]; if type(result) == "function" then success, result = pcall( result, title, unpack(pn) ); if not success then return mw.ustring.format("error: failed to title:%s(%s)", field, table.concat(pn, ',' )); end end if nowiki and result ~= nil then return mw.text.nowiki( tostring( result ) ); else return tostring(result or ""); end end local p = {}; -- main function does all the work function p.id(frame) return main(frame, "id"); end function p.interwiki(frame) return main(frame, "interwiki"); end function p.namespace(frame) return main(frame, "namespace"); end function p.fragment(frame) return main(frame, "fragment"); end function p.nsText(frame) return main(frame, "nsText") end function p.subjectNsText(frame) return main(frame, "subjectNsText"); end function p.text(frame) return main(frame, "text"); end function p.prefixedText(frame) return main(frame, "prefixedText"); end function p.fullText(frame) return main(frame, "fullText"); end function p.rootText(frame) return main(frame, "rootText"); end function p.baseText(frame) return main(frame, "baseText"); end function p.subpageText(frame) return main(frame, "subpageText"); end function p.canTalk(frame) return main(frame, "canTalk"); end function p.exists(frame) return main(frame, "exists"); end function p.fileExists(frame) return main(frame, "fileExists"); end function p.isContentPage(frame) return main(frame, "isContentPage"); end function p.isExternal(frame) return main(frame, "isExternal"); end function p.isLocal(frame) return main(frame, "isLocal"); end function p.isRedirect(frame) return main(frame, "isRedirect"); end function p.isSpecialPage(frame) return main(frame, "isSpecialPage"); end function p.isSubpage(frame) return main(frame, "isSubpage"); end function p.isTalkPage(frame) return main(frame, "isTalkPage"); end function p.isSubpageOf(frame) return main(frame, "isSubpageOf"); end function p.inNamespace(frame) return main(frame, "inNamespace"); end function p.inNamespaces(frame) return main(frame, "inNamespaces"); end function p.hasSubjectNamespace(frame) return main(frame, "hasSubjectNamespace"); end function p.contentModel(frame) return main(frame, "contentModel"); end function p.basePageTitle(frame) return main(frame, "basePageTitle"); end function p.rootPageTitle(frame) return main(frame, "rootPageTitle"); end function p.talkPageTitle(frame) return main(frame, "talkPageTitle"); end function p.subjectPageTitle(frame) return main(frame, "subjectPageTitle"); end function p.subPageTitle(frame) return main(frame, "subPageTitle"); end function p.partialUrl(frame) return main(frame, "partialUrl"); end function p.fullUrl(frame) return main(frame, "fullUrl"); end function p.localUrl(frame) return main(frame, "localUrl"); end function p.canonicalUrl(frame) return main(frame, "canonicalUrl"); end function p.getContent(frame) return main(frame, "getContent"); end return p
摘要:
請注意,所有於合眾百科 Unitedbook所做的貢獻會依據CC BY-NC-SA(創用CC 姓名標示─非商業性─相同方式分享)授權條款發佈(詳情請見
合眾百科 Unitedbook:版權
)。若您不希望您的著作被任意修改與散佈,請勿在此發表文章。
您同時向我們保證在此的著作內容是您自行撰寫,或是取自不受版權保護的公開領域或自由資源。
請勿在未經授權的情況下發表文章!
取消
編輯說明
(在新視窗開啟)
此頁面使用了以下模板:
模組:Page/doc
(
編輯
)
切換限制內容寬度