使用MW
Eijux(讨论 | 贡献)2022年8月23日 (二) 11:02的版本 (创建页面,内容为“category:MediaWiki == 关于文章标题 == <span style="color: blue; font-size: 120%">'''不要使用“.php”之类的后缀作为文章标题!'''</span> <span style="color: blue; font-size: 120%">'''不要使用“.php”之类的后缀作为文章标题!'''</span> <span style="color: blue; font-size: 120%">'''不要使用“.php”之类的后缀作为文章标题!'''</span> '''“.php”等内容结尾的文章将被判断为 PHP 脚…”)
关于文章标题
不要使用“.php”之类的后缀作为文章标题! 不要使用“.php”之类的后缀作为文章标题! 不要使用“.php”之类的后缀作为文章标题! “.php”等内容结尾的文章将被判断为 PHP 脚本,而不能被显示!(nginx 404)
如何删除已提交的“.php”文章?
- 直接使用链接:
http://wiki.eijux.com/index.php?title=<.php文章名>&action=delete
- (可以通过其他文章页面获取操作链接)
目录控制
当文章中含有 3 个以上标题时,MediaWiki 将自动在第一个标题之前生成目录(这是默认的设置):
- 强制显示目录:在文章中加入“
__TOC__
”; - 强制隐藏目录:在文章中加入“
__NOTOC__
”;
- 以上标记不限制出现位置,但一般出现在文章第一个标题之前。
折叠显示
参考:https://zh.wikipedia.org/wiki/Help:折叠显示#新折叠效果 在当前使用的 MediaWiki 版本中: 1、上述页面中使用“NavFrame”、“collapsible”、“collapsed”等标签不再有效; 2、上述页面中使用“mw-collapsible”、“mw-collapsed”、“mw-collapsible-content”、“mw-customtoggle-<自定义名字>”等标签可用。(“新折叠效果”一节) 折叠效果可以用在:'''<div>、<table>、<ul>、<ol>'''等标签(或这些标签的嵌套使用)中,通过“class”属性来指定。
标签说明:
- “mw-collapsible”:表示元素可折叠;
- “mw-collapsed”:表示元素默认折叠;
- “mw-collapsible-content”:用于指定折叠部分;
- (与前两个元素配合使用)
- 示例:
<div class="darken mw-collapsible mw-collapsed"> 这里的文字不会被折叠 <div class="mw-collapsible-content">折叠文字 Four score and seven years ago our forefathers brought forth on this continent</div> </div>
- “mw-customtoggle-<自定义名字>”:用于设置自定义折叠按钮;
- (与前两个元素配合使用)
- 示例:
<span class="darken mw-customtoggle-huiji">折叠按钮A</span> <div class="darken mw-collapsible mw-collapsed" id="mw-customcollapsible-huiji">折叠的内容</div> <span class="darken mw-customtoggle-huiji">折叠按钮B</span>
- 【注意,内容行的 id 为“mw-customcollapsible-<自定义>”,按钮行的 class 为“mw-customtoggle-<自定义>”,二者不一样!】
使用
代码 效果 mw-collapsible mw-collapsed
“data-collapsetext”、“data-expandtext”用于设置折叠展开的文字: <div class="mw-collapsible" data-collapsetext="点此隐藏" data-expandtext="点此开启"> Lorem ipsum </div>
Lorem ipsum
默认折叠: <div class="mw-collapsible mw-collapsed"> Lorem ipsum </div>
Lorem ipsum
折叠嵌套: <div class="mw-collapsible mw-collapsed"> 第一个折叠 <div class="mw-collapsible" style="background:#eee"> 第一个子折叠 </div> <div class="mw-collapsible" style="background:#eee"> 第二个子折叠 </div> </div>
第一个折叠
第一个子折叠
第二个子折叠
Mediawiki 表格:标题行不会被折叠 {| class="wikitable sortable mw-collapsible" ! 你好 ! 世界 |- | 內容 | 会在 |- | 这里 | 出现 |}
你好 世界 內容 会在 这里 出现 也可用于 syntaxhighlight 标签: <syntaxhighlight lang="xml" highlight="" class=" mw-collapsible mw-collapsed"> <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> ... </ syntaxhighlight>
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> ...
html 的 <table> 标签的折叠:(用法更灵活复杂,但代码不如 Mediawiki 表格易读) <table class="wikitable"> <tr> <th>X</th> <th>Y</th> <th>Z</th> </tr> <tr> <td>下面的內容是预设隐藏的</td> <td>35</td> <td>91</td> </tr> <tr> <td class="mw-collapsible mw-collapsed">我是mw-collapsible的內容</td> <td>42</td> <td>63</td> </tr> </table>
X Y Z 下面的內容是预设隐藏的 35 91 我是mw-collapsible的內容 42 63 <ul> 标签折叠效果: <ul class="mw-collapsible"> <li>Lorem <li>Ipsum <li>Dolor </ul>
- Lorem
- Ipsum
- Dolor
<ol> 标签折叠效果: <ol class="mw-collapsible"> <li>One <li>Two is more than one <li>..a total of three items! </ol>
- One
- Two is more than one
- ..a total of three items!
mw-collapsible-content <div class="darken mw-collapsible mw-collapsed"> 这里的文字不会被折叠 <div class="mw-collapsible-content">折叠文字 Four score and seven years ago our forefathers brought forth on this continent</div> </div>
这里的文字不会被折叠
折叠文字 Four score and seven years ago our forefathers brought forth on this continent<div class="darken mw-collapsible mw-collapsed"> 这里的文字不会被折叠 <div class="mw-collapsible-content"> 被折叠的文字,和列表: <ul> <li>A <li>B <li>C <li>D </ul> </div> </div>
这里的文字不会被折叠
被折叠的文字,和列表:
- A
- B
- C
- D
mw-customtoggle-<自定义名字> - 每个页面仅能使用一次???
<span class="darken mw-customtoggle-huiji">折叠按钮A</span> <div class="darken mw-collapsible mw-collapsed" id="mw-customcollapsible-huiji">折叠的内容</div> <span class="darken mw-customtoggle-huiji">折叠按钮B</span>
折叠按钮A
折叠的内容折叠按钮B
<div class="mw-customtoggle-myTable">点此折叠表格</div> {| class="wikitable sortable mw-collapsible" id="mw-customcollapsible-myTable" ! Hello ! World |- | Content | Goes |- | In | Here |}
点此折叠表格Hello World Content Goes In Here <div class="mw-customtoggle-myList">折叠列表</div> <ul class="mw-collapsible" id="mw-customcollapsible-myList"> <li>A <li>B <li>C <li>D </ul>
折叠列表- A
- B
- C
- D
示例
代码:
: '''示例:'''<span class="mw-customtoggle-settings.xml.example"><font color="SandyBrown">(展开/隐藏)</font></span> <div class="mw-collapsible mw-collapsed" id="mw-customcollapsible-settings.xml.example"> : <syntaxhighlight lang="xml" highlight=""> <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"> ... </settings> </ syntaxhighlight> </div>
效果:
- 示例:(展开/隐藏)
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"> ... </settings>
代码:
: '''示例:'''<span class="mw-customtoggle-settings.xml.example2"><font color="SandyBrown">(展开/隐藏)</font></span> : <syntaxhighlight lang="xml" highlight="" class="mw-collapsible mw-collapsed" id="mw-customcollapsible-settings.xml.example2"> <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"> ... </settings> </ syntaxhighlight>
效果:
- 示例:(展开/隐藏)
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd"> ... </settings>