编辑“︁
Template:Special wikitext/doc
”︁
跳转到导航
跳转到搜索
这是
Special wikitext
模板的
文档页面
。
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
{{NoteTA |G1=MediaWiki |1=zh-hans:替换引用;zh-hant:替換引用;}}{{Documentation subpage}}<!-- 在本行下編輯模板說明 --> {{Lua|Module:Special wikitext|Module:Module wikitext|Module:Special wikitext/JSON|Module:Special wikitext/Template}} {{模板樣式|Template:Special wikitext/JSON.css}} {{ombox | small = yes| image = [[File:Wiki-tech-logo-js.svg|32px|alt=JavaScript]]| text = 本模板使用以下[[JavaScript]]腳本:<div> *[[:MediaWiki:Gadget-SpecialWikitext.js]] </div>}} {{High-use}} 本系列工具主要目的是在不支援顯示標記模板或介面文字之特殊頁面中補上標記模板或介面文字,以令標記維護模板或提刪流程得以順利進行。 本模板為[[Module:Special wikitext]]、[[Module:Module wikitext]]和[[MediaWiki:Gadget-SpecialWikitext.js]]的模板調用,目的是為了驗證相關程式碼行為的一致性、除錯、維護以及測試相關功能之用。 詳細結果請參考本模板的測試樣例:[[Template:Special wikitext/testcases]]。 == 功能 == ;系列工具的功能: {| class=wikitable !colspan=3 style="border-style: solid solid none solid;"|功能 !rowspan=2|實現方式 |- !style="border-style: none solid solid solid;"|{{0}} !width=150px|內容模型 !名字空間 |- !rowspan=4|插入Wikitext |rowspan=2|JS、 JSON、 CSS |User、MediaWiki |內嵌至[[MediaWiki:Clearyourcache]] |- |其他名字空間 |rowspan=2|[[AJAX]]:當前版本內容送交[[Special:ApiHelp/parse|API:parse]] |- |[[Help:模板樣式|模板樣式]]、 純文字及其他 |任何 |- |rowspan=2|[[Lua]] |rowspan=2|Module |rowspan=2|內嵌至[[MediaWiki:Scribunto-doc-page-does-not-exist]] |- !rowspan=2|預覽功能 |- |rowspan=2|JS、 JSON、 CSS、 [[Help:模板樣式|模板樣式]]、 純文字及其他 |rowspan=2|任何 |rowspan=2|[[AJAX]]:編輯框內容送交[[Special:ApiHelp/parse|API:parse]] |- !rowspan=2|已刪內容預覽 |- |[[Lua]] |Module |[[AJAX]]:使用模板沙盒參數解析Lua |- !檢視差異或歷史版本<br/>(含修訂版本刪除) |colspan=2|任何符合_addText模式的頁面 |[[AJAX]]:歷史版本送交[[Special:ApiHelp/parse|API:parse]] |} {{Anchor|特殊頁面放置方法}} {{Special wikitext/放置方法}} ;{{tl|Special wikitext}}模板的功能: {{Ombox |type=notice |image=[[File:Information icon.svg|50px|alt=|link=]] |text='''本模板{{red|不}}建議[[Wikipedia:Substitution|替换引用]]。'''模板使用了與[[T:虛擬模板]]相關的技術,由於技術限制,替換引用後的結果可能會與預期不符。如需替換引用請使用{{tl|softsubst}}。 }} {| class=wikitable !功能 !你所輸入的 !你所看到的 |- !嵌入包含特殊頁面中的<code>_addText</code> |<div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}[[Template:Special wikitext|Special wikitext]] {{#tag:span||class=linenos|data-line=2}}{{0| }}{{Background color|#edf6fd|2={{!}}preview=preview}} {{#tag:span||class=linenos|data-line=3}}{{0| }}{{Background color|#ffdfc4|2={{!}}[[Template:Special wikitext/testcase.js|Special wikitext/testcase.js]]}} {{#tag:span||class=linenos|data-line=4}}{{))}} </div> |{{Special wikitext|preview=preview|Special wikitext/testcase.js}} |- !rowspan=4|嵌入包含一個特殊頁面 |嵌入[[Module:Module_wikitext/testcase]]:<br/> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}[[Template:Special wikitext|Special wikitext]] {{#tag:span||class=linenos|data-line=2}}{{0| }}{{Background color|#ffdfc4|2={{!}}[[Module:Module wikitext/testcase]]}} {{#tag:span||class=linenos|data-line=3}}{{))}} </div> |{{Special wikitext|Module:Module wikitext/testcase}} |- |嵌入[[Template:Special wikitext/testcase.json]]:<br/> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}[[Template:Special wikitext|Special wikitext]] {{#tag:span||class=linenos|data-line=2}}{{0| }}{{Background color|#ffdfc4|2={{!}}[[Template:Special wikitext/testcase.json|Special wikitext/testcase.json]]}} {{#tag:span||class=linenos|data-line=3}}{{))}} </div> |{{Special wikitext|Special wikitext/testcase.json}} |- |嵌入[[Template:Special wikitext/testcase.js]]:<br/> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}[[Template:Special wikitext|Special wikitext]] {{#tag:span||class=linenos|data-line=2}}{{0| }}{{Background color|#ffdfc4|2={{!}}[[Template:Special wikitext/testcase.js|Special wikitext/testcase.js]]}} {{#tag:span||class=linenos|data-line=3}}{{))}} </div> |{{Special wikitext|Special wikitext/testcase.js}} |- |對比一般的嵌入方式<br/>[[Template:Special wikitext/testcase.js]]:<br/> <div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}{{0| }}{{Background color|#ffdfc4|2=[[Template:Special wikitext/testcase.js|Special wikitext/testcase.js]]}}{{0| }}{{))}} </div> |{{Special wikitext/testcase.js}} |- !標記觸發預覽 |<div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}[[Template:Special wikitext|Special wikitext]] {{#tag:span||class=linenos|data-line=2}}{{0| }}{{Background color|#edf6fd|2={{!}}preview=js}} {{#tag:span||class=linenos|data-line=3}}{{0| }}{{Background color|#ffdfc4|2={{!}}[[Template:Special wikitext/testcase.js|Special wikitext/testcase.js]]}} {{#tag:span||class=linenos|data-line=4}}{{))}} </div> |{{Special wikitext|preview=js|Special wikitext/testcase.js}} |- !展示某個頁面的原始碼 |<div class="mw-highlight mw-highlight-lang-moin mw-content-ltr mw-highlight-lines" dir="ltr"> {{#tag:span||class=linenos|data-line=1}}</span>{{((}}[[Template:Special wikitext|Special wikitext]] {{#tag:span||class=linenos|data-line=2}}{{0| }}{{Background color|#edf6fd|2={{!}}lang=wikitext}} {{#tag:span||class=linenos|data-line=3}}{{0| }}{{Background color|#ffdfc4|2={{!}}[[Template:Ifsubst|Ifsubst]]}} {{#tag:span||class=linenos|data-line=4}}{{))}} </div> |{{Special wikitext|Ifsubst|lang=wikitext}} |} == 特殊頁面編輯提示 == Special Wikitext模塊也可以給Special命名空間的頁面提供Wikitext頁頂提示。 Special Wikitext模塊會給有定義於<code>Template:Editnotices/Page/Special:</code>的特殊頁面顯示頁頂提示,但判定條件是以該特殊頁面的全英文名稱進行判斷。 例如要給[[Special:Blankpage/SpecialWikitextSandbox]]這個特殊頁面添加頁頂提示,可以依照[[Template:Editnotices]]方式給這個特殊頁面添加頁頂提示(注意:大小寫敏感) 首先先確定該頁面的英文全名(包含命名空間前綴<code>Special:</code>頁面名稱和子頁面名稱)。由於Special命名空間無法編輯,因此無法使用在頁面放置{{tl|FULLPAGENAME}}的方式得到,不過可以用網頁的開發者模式,在主控台執行以下指令來得到全英文的頁面名稱: <syntaxhighlight lang=javascript>[['wgCanonicalNamespace','wgCanonicalSpecialPageName'].map(i=>mw.config.get(i)).join(':')].concat((mw.config.get('wgTitle')||'').split('/').slice(1)).join('/')</syntaxhighlight> 接著將得到的英語特殊頁面名稱來建立[[Template:Editnotices/Page]]的子頁面 以[[Special:Blankpage/SpecialWikitextSandbox]]為例,該指令碼輸出 :<code><nowiki>Special:Blankpage/SpecialWikitextSandbox</nowiki></code>(注意:大小寫敏感) 來建立頁面,也就是在[[Template:Editnotices/Page/Special:Blankpage/SpecialWikitextSandbox]]頁面填入內容,就會自動於[[Special:Blankpage/SpecialWikitextSandbox]]頁頂顯示 可用以下語法另其只在目標頁面顯示: <syntaxhighlight lang=wikitext> {{#ifeq:{{ROOTPAGENAME}}|Editnotices |<!--在 [[Template:Editnotices/Page]] 頁顯示的內容--> |<!--在目標頁面顯示的內容--> }} </syntaxhighlight> 參考範例[[Template:Editnotices/Page/Special:Blankpage/SpecialWikitextSandbox/SD]]、[[Special:Blankpage/SpecialWikitextSandbox/SD]]。 == 參數說明 == ;參數1: 要處理的特殊頁面名稱。若省略此參數則須提供原始碼<code>src</code>參數。 ;參數<code>src</code>: 要處理的特殊頁面內容模型之原始碼。若輸入了此參數則參數1將會無效。 ;參數<code>preview</code>: 決定特殊頁面的展示模式。 {| class=wikitable !模式名稱 !代碼 !功能 |- !完整模式 ||preview=<code>wiki</code>、<code>wikitext</code> |同時展示<code>_addText</code>與特殊頁面原始碼 |- !代碼模式 ||preview=<code>code</code> |僅展示特殊頁面原始碼 |- !預覽模式 ||preview=<code>preview</code> |僅展示<code>_addText</code> |- !小工具預覽模式 ||preview=<code>js</code>、<code>ajax</code> |展示特殊頁面原始碼,並向小工具請求發送預覽。 |- !預設模式 ||''(未輸入)'' |同完整模式,可當作特殊頁面的嵌入包含。 |} ;模板功能與參數總表: <templatedata> { "params": { "1": { "label": "頁面名稱", "description": "要嵌入或讀取_addText內容的頁面。如果省略此參數則需要加入原始碼(src)參數。", "type": "wiki-page-name" }, "preview": { "label": "預覽模式", "description": "控制輸出的預覽模式", "type": "string" }, "contentModel": { "label": "頁面內容模型", "description": "以指定的頁面內容模型來解析頁面原始碼。若省略則自動判斷。", "type": "string", "aliases": [ "lang" ] }, "src": { "label": "原始碼", "description": "從指定的原始碼中解析。(建議用<nowiki>包覆)", "type": "content" } }, "description": "嵌入包含一個特殊頁面內容模型之頁面" } </templatedata> == 子模板相依關係圖 == {{VT|code={{Tree chart/start}} {{Tree chart| | | | | | | | | | | TT | | | | | | | | | | | | | |boxstyle=background:#dfd;}} {{Tree chart| | |,|-|-|-|v|-|-|-|-|^| -|-| -|v|-|-|-|v|-|-|.| | | |}} {{Tree chart| | DCS | | DPD | | | | | | | DP | |DJSD | |!| | | |boxstyle=border:1px dashed;}} {{Tree chart| | |!| | | |!| |F|~|~|~|~ |7| |!| | | |!| | |!| |F|7|}} {{Tree chart| | TCS | | | TPD | | | | |:| TP | |TJSD | | TMT |:|boxstyle=background:#ddf;{{void| | ! ! : ! ! :|}}|boxstyle_ TMT =background:#fed;}} {{Tree chart| | |!| |,|-|-|^|-|-|.| | |:| ,|^|.| |,|^|-|.| | | |:|LTXT|boxstyle_LTXT=border:none;}} {{Tree chart| | | TC | | | | | | TCN |L|he| | TCD | | TGS | | |:|LGRE|boxstyle=background:#fff;{{void| | ! ! ! :|}}|boxstyle_ TGS =background:#fed;{{void| | ! ! ! :|}}|boxstyle_LGRE=border-width:2px 2px 0 2px;{{void| | ! ! ! :|}}background:#dfd;}} {{Tree chart| |,|-|^|-|.| | | |,|-|+|- |.| | | |!| | | | | | | |:|LBLU|boxstyle_LBLU=border-width:2px 2px 0 2px;{{void| | ! ! ! ! ! ! :|}}background:#ddf;}} {{Tree chart| TIN | | TIM | | TM |!| TMM | |TJSON|~|CJSON| | |:|LYLW|boxstyle=background:#fff;{{void| | ! ! :|}}|boxstyle_TJSON=background:#ffd;{{void| | ! ! :|}}|boxstyle_ TM =background:#fed;{{void| | ! ! :|}}|boxstyle_ TMM =background:#fed;{{void| | ! ! :|}}|boxstyle_CJSON=border:1px dashed;{{void| | ! ! :|}}background:inherit;{{void| | ! ! :|}}|boxstyle_LYLW=border-width:2px 2px 0 2px;{{void| | ! ! :|}}background:#ffd;}} {{Tree chart| | | | | | | | | | | |!| | | |,|-|^|-|.| | | | | |:|LORG|boxstyle_LORG=border-width:2px 2px 0 2px;{{void| | ! ! ! :|}}background:#fed;}} {{Tree chart| | |TTSCS|~| TTSC| | |!| | | TMJ | |JCSS | | | | |:|LGRA|boxstyle=background:#fff;{{void| | ! ! :|}}|boxstyle_ TMJ =background:#fed;{{void| | ! ! :|}}|boxstyle_TTSCS=background:#ddd;{{void| | ! ! :|}}|boxstyle_ TTSC=background:#ddd;{{void| | ! ! :|}}|boxstyle_LGRA=border-width:2px 2px 0 2px;{{void| | ! ! :|}}background:#ddd;}} {{Tree chart| | | | | |,|-|^|-|.| |fh|~|~| ~|~|~|~|~|~|~|~|~|~|~|J|LWHI|boxstyle=background:#fff;}} {{Tree chart| | | | | TT1 | | TCS | | | | | | | | | | | | | | | |boxstyle_ TT1 =background:#dfd;{{void| }}|boxstyle_ TCS =background:#ddf;}} {{Tree chart/end}}|CJSON=渲染JSON |LTXT={{nowrap|'''圖例'''}} |LGRE={{nowrap|模板本身}} |LYLW={{nowrap|1=<span style="font-size:0.75em;">可外部調用</span>}} |LBLU={{nowrap|主要模板}} |LORG={{nowrap|相依模組}} |LGRA={{nowrap|測試樣例}} |LWHI={{nowrap|內部模板}} |DCS=展示代碼|DPD=展示<code>_addText</code>|DP=展示特殊頁面|DJSD=請求預覽 |TT=[[Template:Special wikitext|Special wikitext]]|TT1=[[Template:Special wikitext#top|Template:#]] |TCS=[[Template:Special wikitext/codeshow|#/codeshow]] |TPD=[[Template:Special wikitext/previewdisplay|#/previewdisplay]] |TP=[[Template:Special wikitext/preview|#/preview]] |TJSD=[[Template:Special wikitext/jspreview|#/jspreview]] |TMT=[[Module:Special wikitext/Template|Module:#/Template]] |TMM=[[Module:Module wikitext|Module wikitext]] |TC=[[Template:Special wikitext/code|#/code]] |TCN=[[Template:Special wikitext/content|#/content]] |TCD=[[Template:Special wikitext/codedisplay|#/codedisplay]] |TGS=[[MediaWiki:Gadget-SpecialWikitext.js|Gadget:#.js]] |TIN=[[Template:Special wikitext/include|#/include]] |TIM=[[Template:Special wikitext/immcode|#/immcode]] |TM=[[Module:Special wikitext|Module:#]] |TJSON=[[Template:Special wikitext/JSON|#/JSON]] |TTSCS=[[Template:Special wikitext/testcases|#/testcases]] |TTSC=[[Template:Special wikitext/testcase|#/testcase]] |TMJ=[[Module:Special wikitext/JSON|Module:#/JSON]] |JCSS=[[Template:Special wikitext/JSON.css|#/JSON.css]] }} == 相依性 == 以下為[[MediaWiki:Gadget-SpecialWikitext.js]]的相依模板、模組與腳本。要讓本工具匯入至其他維基媒體站點,令其在其他維基運作,需要在其他維基站點備齊。 *[[MediaWiki:Gadget-SpecialWikitext.js]](完整引入) **''[[MediaWiki:Gadget-HanAssist.js]]''(需求函數conv) **[[Module:Special_wikitext/Template]](完整引入) **[[Module:Module_wikitext]](完整引入) **[[Module:Special_wikitext]](完整引入) **''[[MediaWiki:Gadgets-definition]]''(加入<syntaxhighlight lang=moin inline>*SpecialWikitext[ResourceLoader|default|dependencies=ext.gadget.site-lib,mediawiki.api|hidden|targets=desktop,mobile|type=general]|SpecialWikitext.js</syntaxhighlight>) *''[[MediaWiki:Clearyourcache]]''(末尾加上<syntaxhighlight lang=moin inline>{{#invoke:Special wikitext|displayWikitext}}</syntaxhighlight>) *''[[MediaWiki:Scribunto-doc-page-does-not-exist]]''(Doc引用改成<syntaxhighlight lang=moin inline>{{#invoke:documentation|nonexistent|_content={{ {{#invoke:documentation|contentTitle}}}}}}</syntaxhighlight>) **''[[Module:Documentation]]''(需求函數<syntaxhighlight lang=lua inline>p._getModuleWikitext</syntaxhighlight>與函數<syntaxhighlight lang=lua inline>p.nonexistent</syntaxhighlight>,並在<syntaxhighlight lang=lua inline>p._main</syntaxhighlight>中<syntaxhighlight lang=lua inline>root</syntaxhighlight>後方添加<syntaxhighlight lang=lua inline>:wikitext(p._getModuleWikitext(args, env))</syntaxhighlight>) == 參見 == *{{AnyLink|1=https://zh.wikipedia.org/w/index.php?title=Special:搜索&fulltext=1&ns0=1&ns1=1&ns10=1&ns100=1&ns101=1&ns102=1&ns103=1&ns11=1&ns118=1&ns119=1&ns12=1&ns13=1&ns14=1&ns15=1&ns2=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns710=1&ns711=1&ns8=1&ns828=1&ns829=1&ns9=1&profile=advanced&search=insource%3A%2F_addText%2F |2=Special:搜索/insource:/_addText/|type=ext}}:可能有使用Special wikitext的頁面。 <includeonly>{{Sandbox other||<!-- 本行下加入模板的分類 --> }}</includeonly>
摘要:
请注意,所有对Local Chinese Wikipedia的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Project:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
导航菜单
个人工具
未登录
讨论
贡献
创建账号
登录
命名空间
模板
讨论
大陆简体
不转换
简体
繁體
大陆简体
香港繁體
澳門繁體
大马简体
新加坡简体
臺灣正體
查看
阅读
编辑
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
工具
链入页面
相关更改
特殊页面
页面信息