From 2c658472272f8577af59e8939e371c4f39a366b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 27 Nov 2005 02:55:12 +0000 Subject: [PATCH] * Disable tidy while rendering Special:Cite to avoid whitespace problems * Use new hook registering syntax * Only display the cite link in the sidebar in the main namespace * Page => Article since it's only being shown in the main namespace --- SpecialCite.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/SpecialCite.php b/SpecialCite.php index 401da9e4..965d6cdf 100644 --- a/SpecialCite.php +++ b/SpecialCite.php @@ -33,7 +33,7 @@ function wfSpecialCite() { 'cite' => 'Cite', 'cite_page' => 'Page: ', 'cite_submit' => 'Cite', - 'cite_page_link' => 'Cite this page', + 'cite_article_link' => 'Cite this article', 'cite_text' => "* ''{{FULLPAGENAME}}'' (last modified {{CURRENTTIME}}," . ' {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} UTC).' . @@ -50,7 +50,12 @@ function wfSpecialCite() { } function execute( $par ) { - global $wgOut, $wgRequest; + global $wgOut, $wgRequest, $wgUseTidy; + + // Having tidy on causes whitespace and
 tags to
+			// be generated around the output of the CiteOutput
+			// class TODO FIXME.
+			$wgUseTidy = false;
 
 			$this->setHeaders();
 
@@ -133,7 +138,7 @@ function wfSpecialCite() {
 			$this->genParserOptions();
 			$this->genParser();
 
-			$wgParser->setHook( 'cite', 'CiteParse', $this, &$mParser );
+			$wgParser->setHook( 'cite', array( $this, 'CiteParse' ) );
 		}
 		
 		function execute() {
@@ -185,16 +190,18 @@ function wfSpecialCite() {
 }
 
 function wfSpecialCiteNav( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
-	if ( (int)$oldid  )
-		$nav_urls['cite'] = array(
-			'text' => wfMsg( 'cite_page_link' ),
-			'href' => ''
-		);
-	else if ( $revid !== 0 )
-		$nav_urls['cite'] = array(
-			'text' => wfMsg( 'cite_page_link' ),
-			'href' => $skintemplate->makeSpecialUrl( 'Cite/' . $skintemplate->thispage )
-		);
+	if ( $skintemplate->mTitle->getNamespace() === NS_MAIN ) {
+		if ( (int)$oldid  )
+			$nav_urls['cite'] = array(
+				'text' => wfMsg( 'cite_article_link' ),
+				'href' => ''
+			);
+		else if ( $revid !== 0 )
+			$nav_urls['cite'] = array(
+				'text' => wfMsg( 'cite_article_link' ),
+				'href' => $skintemplate->makeSpecialUrl( 'Cite/' . $skintemplate->thispage )
+			);
+	}
 
 	return true;
 }
@@ -202,11 +209,11 @@ function wfSpecialCiteNav( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
 function wfSpecialCiteToolbox( &$monobook ) {
 	if ( isset( $monobook->data['nav_urls']['cite'] ) )
 		if ( $monobook->data['nav_urls']['cite']['href'] == '' ) {
-			?>
  • msg( 'cite_page_link' ); ?>
  • msg( 'cite_article_link' ); ?>
  • - msg( 'cite_page_link' ); ?> + msg( 'cite_article_link' ); ?>