From 62dec72993fd6b7fc3919c5b574380f5e013db5f Mon Sep 17 00:00:00 2001
From: Wil Mahan
Date: Fri, 24 Sep 2004 21:49:56 +0000
Subject: [PATCH] Add an option for setting the title; add test for
interlanguage links; remove dupliate test
---
maintenance/parserTests.php | 21 ++++++----
maintenance/parserTests.sql | 9 +++--
maintenance/parserTests.txt | 81 ++++++++++++++++++++++++-------------
3 files changed, 71 insertions(+), 40 deletions(-)
diff --git a/maintenance/parserTests.php b/maintenance/parserTests.php
index 6e1422ebeb..db567055cf 100644
--- a/maintenance/parserTests.php
+++ b/maintenance/parserTests.php
@@ -189,8 +189,15 @@ class ParserTest {
$options->setUseTex(true);
}
+ if (preg_match('/title=\[\[(.*)\]\]/', $opts, $m)) {
+ $titleText = $m[1];
+ }
+ else {
+ $titleText = 'Parser test';
+ }
+
$parser =& new Parser();
- $title =& Title::makeTitle( NS_MAIN, 'Parser_test' );
+ $title =& Title::makeTitle( NS_MAIN, $titleText );
if (preg_match('/pst/i', $opts)) {
$out = $parser->preSaveTransform( $input, $title, $user, $options );
@@ -205,12 +212,12 @@ class ParserTest {
$op = new OutputPage();
$op->replaceLinkHolders($out);
- #if (preg_match('/ill/i', $opts)) {
- # $out .= $output->getLanguageLinks();
- #}
- #if (preg_match('/cat/i', $opts)) {
- # $out .= $output->getCategoryLinks();
- #}
+ if (preg_match('/ill/i', $opts)) {
+ $out .= implode( ' ', $output->getLanguageLinks() );
+ }
+ if (preg_match('/cat/i', $opts)) {
+ $out .= implode( ' ', $output->getCategoryLinks() );
+ }
if ($GLOBALS['wgUseTidy']) {
$result = Parser::tidy($result);
diff --git a/maintenance/parserTests.sql b/maintenance/parserTests.sql
index e93be58071..26e22af67a 100644
--- a/maintenance/parserTests.sql
+++ b/maintenance/parserTests.sql
@@ -285,8 +285,9 @@ CREATE TEMPORARY TABLE parsertestlogging (
KEY page_time (log_namespace, log_title, log_timestamp)
);
-INSERT INTO parsertestinterwiki VALUES('MeatBall',
- 'http://www.usemod.com/cgi-bin/mb.pl?$1',
- 0
-);
+INSERT INTO parsertestinterwiki (iw_prefix,iw_url,iw_local) VALUES
+ ('MeatBall','http://www.usemod.com/cgi-bin/mb.pl?$1',0),
+ ('es','http://es.wikipedia.org/wiki/$1',1),
+ ('fr','http://fr.wikipedia.org/wiki/$1',1),
+ ('zh','http://zh.wikipedia.org/wiki/$1',1);
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 86e1ae7f06..f68ca941ca 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -8,7 +8,10 @@
# (default) generate HTML output
# pst apply pre-save transform
# msg apply message transform
+# cat add category links
+# ill add inter-language links
# subpage enable subpages (disabled by default)
+# title=[[XXX]] run test using article title XXX
#
# Tests can be disabled with the '!!disabled' flag.
#
@@ -686,30 +689,6 @@ Piped link to namespace
!! end
-!! article
-Category:MediaWiki User's Guide
-!! text
-blah
-!! endarticle
-
-!! test
-Link to category
-!! input
-[[:Category:MediaWiki User's Guide]]
-!! result
-Category:MediaWiki User's Guide
-
-!! end
-
-!! test
-Link to image page
-!! input
-[[:Image:Ncwikicol.png]]
-!! result
-Image:Ncwikicol.png
-
-!! end
-
!! test
Plain link to URL
!! input
@@ -1152,7 +1131,7 @@ Link to image page
### Subpages
###
!! article
-Parser test/subpage
+Subpage test/subpage
!! text
foo
!! endarticle
@@ -1160,22 +1139,22 @@ foo
!! test
Subpage link
!! options
-subpage
+subpage title=[[Subpage test]]
!! input
[[/subpage]]
!! result
-/subpage
+
/subpage
!! end
!! test
Subpage noslash link
!! options
-subpage
+subpage title=[[Subpage test]]
!!input
[[/subpage/]]
!! result
-subpage
+
subpage
!! end
@@ -1189,6 +1168,50 @@ Disabled subpages
!! end
+###
+### Categories
+###
+!! article
+Category:MediaWiki User's Guide
+!! text
+blah
+!! endarticle
+
+!! test
+Link to category
+!! input
+[[:Category:MediaWiki User's Guide]]
+!! result
+Category:MediaWiki User's Guide
+
+!! end
+
+!! test
+Simple category
+!! options
+cat
+!! input
+[[Category: MediaWiki User's Guide]]
+!! result
+MediaWiki User's Guide
+!! end
+
+###
+### Inter-language links
+###
+!! test
+Inter-language links
+!! options
+ill
+!! input
+[[es:Alimento]]
+[[fr:Nourriture]]
+[[zh:食品]]
+!! result
+es:Alimento fr:Nourriture zh:é£å
+!! end
+
+
TODO:
more images
more tables
--
2.20.1