Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -8,7 +8,10 @@ |
9 | 9 | # (default) generate HTML output |
10 | 10 | # pst apply pre-save transform |
11 | 11 | # msg apply message transform |
| 12 | +# cat add category links |
| 13 | +# ill add inter-language links |
12 | 14 | # subpage enable subpages (disabled by default) |
| 15 | +# title=[[XXX]] run test using article title XXX |
13 | 16 | # |
14 | 17 | # Tests can be disabled with the '!!disabled' flag. |
15 | 18 | # |
— | — | @@ -686,31 +689,7 @@ |
687 | 690 | </p> |
688 | 691 | !! end |
689 | 692 | |
690 | | -!! article |
691 | | -Category:MediaWiki User's Guide |
692 | | -!! text |
693 | | -blah |
694 | | -!! endarticle |
695 | | - |
696 | 693 | !! test |
697 | | -Link to category |
698 | | -!! input |
699 | | -[[:Category:MediaWiki User's Guide]] |
700 | | -!! result |
701 | | -<p><a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a> |
702 | | -</p> |
703 | | -!! end |
704 | | - |
705 | | -!! test |
706 | | -Link to image page |
707 | | -!! input |
708 | | -[[:Image:Ncwikicol.png]] |
709 | | -!! result |
710 | | -<p><a href="https://www.mediawiki.org/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a> |
711 | | -</p> |
712 | | -!! end |
713 | | - |
714 | | -!! test |
715 | 694 | Plain link to URL |
716 | 695 | !! input |
717 | 696 | [[http://www.example.org]] |
— | — | @@ -1152,7 +1131,7 @@ |
1153 | 1132 | ### Subpages |
1154 | 1133 | ### |
1155 | 1134 | !! article |
1156 | | -Parser test/subpage |
| 1135 | +Subpage test/subpage |
1157 | 1136 | !! text |
1158 | 1137 | foo |
1159 | 1138 | !! endarticle |
— | — | @@ -1160,22 +1139,22 @@ |
1161 | 1140 | !! test |
1162 | 1141 | Subpage link |
1163 | 1142 | !! options |
1164 | | -subpage |
| 1143 | +subpage title=[[Subpage test]] |
1165 | 1144 | !! input |
1166 | 1145 | [[/subpage]] |
1167 | 1146 | !! result |
1168 | | -<p><a href="https://www.mediawiki.org/wiki/Parser_test/subpage" title="Parser test/subpage">/subpage</a> |
| 1147 | +<p><a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> |
1169 | 1148 | </p> |
1170 | 1149 | !! end |
1171 | 1150 | |
1172 | 1151 | !! test |
1173 | 1152 | Subpage noslash link |
1174 | 1153 | !! options |
1175 | | -subpage |
| 1154 | +subpage title=[[Subpage test]] |
1176 | 1155 | !!input |
1177 | 1156 | [[/subpage/]] |
1178 | 1157 | !! result |
1179 | | -<p><a href="https://www.mediawiki.org/wiki/Parser_test/subpage" title="Parser test/subpage">subpage</a> |
| 1158 | +<p><a href="https://www.mediawiki.org/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a> |
1180 | 1159 | </p> |
1181 | 1160 | !! end |
1182 | 1161 | |
— | — | @@ -1189,6 +1168,50 @@ |
1190 | 1169 | </p> |
1191 | 1170 | !! end |
1192 | 1171 | |
| 1172 | +### |
| 1173 | +### Categories |
| 1174 | +### |
| 1175 | +!! article |
| 1176 | +Category:MediaWiki User's Guide |
| 1177 | +!! text |
| 1178 | +blah |
| 1179 | +!! endarticle |
| 1180 | + |
| 1181 | +!! test |
| 1182 | +Link to category |
| 1183 | +!! input |
| 1184 | +[[:Category:MediaWiki User's Guide]] |
| 1185 | +!! result |
| 1186 | +<p><a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a> |
| 1187 | +</p> |
| 1188 | +!! end |
| 1189 | + |
| 1190 | +!! test |
| 1191 | +Simple category |
| 1192 | +!! options |
| 1193 | +cat |
| 1194 | +!! input |
| 1195 | +[[Category: MediaWiki User's Guide]] |
| 1196 | +!! result |
| 1197 | +<a href="https://www.mediawiki.org/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a> |
| 1198 | +!! end |
| 1199 | + |
| 1200 | +### |
| 1201 | +### Inter-language links |
| 1202 | +### |
| 1203 | +!! test |
| 1204 | +Inter-language links |
| 1205 | +!! options |
| 1206 | +ill |
| 1207 | +!! input |
| 1208 | +[[es:Alimento]] |
| 1209 | +[[fr:Nourriture]] |
| 1210 | +[[zh:食品]] |
| 1211 | +!! result |
| 1212 | +es:Alimento fr:Nourriture zh:食品 |
| 1213 | +!! end |
| 1214 | + |
| 1215 | + |
1193 | 1216 | TODO: |
1194 | 1217 | more images |
1195 | 1218 | more tables |
Index: trunk/phase3/maintenance/parserTests.sql |
— | — | @@ -285,8 +285,9 @@ |
286 | 286 | KEY page_time (log_namespace, log_title, log_timestamp) |
287 | 287 | ); |
288 | 288 | |
289 | | -INSERT INTO parsertestinterwiki VALUES('MeatBall', |
290 | | - 'http://www.usemod.com/cgi-bin/mb.pl?$1', |
291 | | - 0 |
292 | | -); |
| 289 | +INSERT INTO parsertestinterwiki (iw_prefix,iw_url,iw_local) VALUES |
| 290 | + ('MeatBall','http://www.usemod.com/cgi-bin/mb.pl?$1',0), |
| 291 | + ('es','http://es.wikipedia.org/wiki/$1',1), |
| 292 | + ('fr','http://fr.wikipedia.org/wiki/$1',1), |
| 293 | + ('zh','http://zh.wikipedia.org/wiki/$1',1); |
293 | 294 | |
Index: trunk/phase3/maintenance/parserTests.php |
— | — | @@ -189,8 +189,15 @@ |
190 | 190 | $options->setUseTex(true); |
191 | 191 | } |
192 | 192 | |
| 193 | + if (preg_match('/title=\[\[(.*)\]\]/', $opts, $m)) { |
| 194 | + $titleText = $m[1]; |
| 195 | + } |
| 196 | + else { |
| 197 | + $titleText = 'Parser test'; |
| 198 | + } |
| 199 | + |
193 | 200 | $parser =& new Parser(); |
194 | | - $title =& Title::makeTitle( NS_MAIN, 'Parser_test' ); |
| 201 | + $title =& Title::makeTitle( NS_MAIN, $titleText ); |
195 | 202 | |
196 | 203 | if (preg_match('/pst/i', $opts)) { |
197 | 204 | $out = $parser->preSaveTransform( $input, $title, $user, $options ); |
— | — | @@ -205,12 +212,12 @@ |
206 | 213 | $op = new OutputPage(); |
207 | 214 | $op->replaceLinkHolders($out); |
208 | 215 | |
209 | | - #if (preg_match('/ill/i', $opts)) { |
210 | | - # $out .= $output->getLanguageLinks(); |
211 | | - #} |
212 | | - #if (preg_match('/cat/i', $opts)) { |
213 | | - # $out .= $output->getCategoryLinks(); |
214 | | - #} |
| 216 | + if (preg_match('/ill/i', $opts)) { |
| 217 | + $out .= implode( ' ', $output->getLanguageLinks() ); |
| 218 | + } |
| 219 | + if (preg_match('/cat/i', $opts)) { |
| 220 | + $out .= implode( ' ', $output->getCategoryLinks() ); |
| 221 | + } |
215 | 222 | |
216 | 223 | if ($GLOBALS['wgUseTidy']) { |
217 | 224 | $result = Parser::tidy($result); |