帮助:开发者文档:修订间差异

删除159字节 、​ 2020年11月10日 (星期二)
→‎mw.html.escape:​ // Edit via Wikiplus
无编辑摘要
→‎mw.html.escape:​ // Edit via Wikiplus
 
(未显示2个用户的2个中间版本)
第1行: 第1行:
{{不完整|一晚上就搬完不可能的}}
{{不完整|一晚上就搬完不可能的|只翻译了一半}}
{{帮助文档难度/困难}}
{{帮助文档难度/困难}}
{{浮动帮助菜单}}
{{浮动帮助菜单}}
第22行: 第22行:
其中大部分以 '''wg''' 为前缀。
其中大部分以 '''wg''' 为前缀。


For legacy reasons these names are exposed as global JavaScript variables 若<code>$wgLegacyJavaScriptGlobals</code>为真,所以需要一个前缀以防变量名冲突。
因为历史原因,这些变量是全局的js变量。若<code>$wgLegacyJavaScriptGlobals</code>为真,所以需要一个前缀以防变量名冲突。
*  A subset of these names correspond to $wg_variable in PHP, but others are unrelated.
*  A subset of these names correspond to $wg_variable in PHP, but others are unrelated.
Besides the names in this list, many extensions also set additional JavaScript config variables prefixed with 'wg'.
除了本列表中的名字意外,很多扩展还设置了额外的以wg开头的js配置变量。


你可以通过<code>mw.config</code>来访问这些值。
你可以通过<code>mw.config</code>来访问这些值。
第52行: 第52行:
|valign="top"|<code>wgArticlePath</code>
|valign="top"|<code>wgArticlePath</code>
|valign="top"|字符串
|valign="top"|字符串
|valign="top"| Local path, starting at the root, to reference articles, containing a "$1" placeholder that may be replaced by a page title to get a valid URL to that page.  Given a valid page title <code>title</code>, a valid URL may be constructed using <code>wgArticlePath.replace('$1', title)</code>.  See also $wgArticlePath.
|valign="top"|从根目录开始的本地路径, 用于引用文章。含有一个“$1”占位符,可以用页面标题替换来获取一个有效的页面URL。给定有效的页面标题<code>title</code>, 可以用<code>wgArticlePath.replace('$1', title)</code>获取有效URL。另见$wgArticlePath。
|valign="top"|MW 1.8+
|valign="top"|MW 1.8+
|-
|-
|valign="top"|<code>wgCaseSensitiveNamespaces</code>
|valign="top"|<code>wgCaseSensitiveNamespaces</code>
|valign="top"|数组
|valign="top"|数组
|valign="top"| The IDs of the namespaces treated as case-sensitive by MediaWiki.  Determined by the values of them <code>$wgCapitalLinks</code> and <code>$wgCapitalLinksOverrides</code> configuration variables.<!-- I'm assuming; it would be good to have someone confirm this -->
|valign="top"| MediaWiki中对大小写敏感的命名空间的ID。由<code>$wgCapitalLinks</code><code>$wgCapitalLinksOverrides</code> 这两个配置变量的值决定。<!-- I'm assuming; it would be good to have someone confirm this -->
|valign="top"|MW 1.18+ (90234)
|valign="top"|MW 1.18+ (90234)
|-
|-
第67行: 第67行:
|valign="top"|<code>wgContentNamespaces</code>
|valign="top"|<code>wgContentNamespaces</code>
|valign="top"|整数数组
|valign="top"|整数数组
|valign="top"| The IDs of the namespaces considered "content namespaces" by MediaWiki.  Equivalent to the value of the <code>$wgContentNamespaces</code> configuration variable, 没有加载好的话就是<code>0</code>。
|valign="top"| MediaWiki看作是“内容名字空间”的名字空间ID。和配置变量<code>$wgContentNamespaces</code>的值等价, 没有加载好的话就是<code>0</code>。
|valign="top"|MW 1.23+ <small>(Git: 3d87e3a86bcb39d444ef916129dd48bf80b5bb31)</small>
|valign="top"|MW 1.23+ <small>(Git: 3d87e3a86bcb39d444ef916129dd48bf80b5bb31)</small>
|-
|-
第82行: 第82行:
|valign="top"|<code>wgEnableWriteAPI</code>
|valign="top"|<code>wgEnableWriteAPI</code>
|valign="top"|布尔型
|valign="top"|布尔型
|valign="top"|如果mw的写入API启用则为<code>true</code>,反之为<code>false</code>。If <code>wgEnableAPI && !wgEnableWriteAPI</code>, only the read operations of the API are enabled.
|valign="top"|如果mw的写入API启用则为<code>true</code>,反之为<code>false</code>。如果<code>wgEnableAPI && !wgEnableWriteAPI</code>, 只有读取API会被启用。
|valign="top"|MW 1.12+
|valign="top"|MW 1.12+
|-
|-
第102行: 第102行:
|valign="top"|<code>wgScript</code>
|valign="top"|<code>wgScript</code>
|valign="top"|字符串
|valign="top"|字符串
|valign="top"| Full path to the main access point script, starting at the root, including the full script name with extension.  On WMF wikis, normally "/w/index.php".  See also $wgScript.
|valign="top"| 到达主要脚本接入点的完全路径,从根部开始。包括带着扩展名的脚本名。在WMF Wiki上,一般是"/w/index.php"。另见$wgScript。
|valign="top"|MW 1.11+
|valign="top"|MW 1.11+
|-
|-
|valign="top"|<code>wgScriptPath</code>
|valign="top"|<code>wgScriptPath</code>
|valign="top"|字符串
|valign="top"|字符串
|valign="top"|<code>wgScript</code>的路径部分,结尾不是"/"。This is the path to use for direct calls to the php access points such as <code>index.php</code> 或 <code>api.php</code>. See also $wgScriptPath.
|valign="top"|<code>wgScript</code>的路径部分,结尾不是"/"。这是用于直接调用php接入点(如<code>index.php</code>或<code>api.php</code>)的路径。另见$wgScriptPath。
|valign="top"|MW 1.8+
|valign="top"|MW 1.8+
|-
|-
|valign="top"|<code>wgServer</code>
|valign="top"|<code>wgServer</code>
|valign="top"|字符串
|valign="top"|字符串
|valign="top"|服务器链接,结尾不是"/"。The combination <code>wgServer + wgScriptPath + "/api.php"</code>, for instance, results in a valid URL to the API access point script.
|valign="top"|服务器链接,结尾不是"/"<code>wgServer + wgScriptPath + "/api.php"</code>。比如说,可以得到API脚本接入点的合法URL。
|valign="top"|MW 1.8+
|valign="top"|MW 1.8+
|-
|-
第355行: 第355行:
=== mw.html.escape ===
=== mw.html.escape ===
HTML转义。
HTML转义。
<pre>mw.html.escape( '< > \' & "' ); // Returns: &lt; &gt; &#039; &amp; &quot;</pre>
<pre>mw.html.escape( '< > \' & "' ); // Returns: &amp;lt; &amp;gt; &amp;#039; &amp;amp; &amp;quot;</pre>


== mw.msg ==
== mw.msg ==