r2973 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r2972 | r2973 (on ViewVC) | r2974 >
Date:04:02, 5 April 2004
Author:vibber
Status:new
Tags:
Comment:Add $wgCapitalLinks option; if set to false, titles won't be forced to
have an initial capital. This isn't recommended in general, as it will
make "[[Asteroid]]s are..." and "... like [[asteroid]]s." point to
different pages.

It is meant mainly for languages which use the latin alphabet but don't
capitalize at sentence start (mainly conlangs) or for special purposes
where this is needed. This can *break links* and should not be changed
on an existing wiki without careful attention.
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php	(revision 2972)
+++ trunk/phase3/includes/Title.php	(revision 2973)
@@ -580,7 +580,7 @@
 	#
 	/* private */ function secureAndSplit()
 	{
-		global $wgLang, $wgLocalInterwiki;
+		global $wgLang, $wgLocalInterwiki, $wgCapitalLinks;
 		$fname = "Title::secureAndSplit";
  		wfProfileIn( $fname );
 		
@@ -674,8 +674,10 @@
 		}
 
 		# Initial capital letter
-		if( $this->mInterwiki == "") $t = $wgLang->ucfirst( $r );
-
+		if( $wgCapitalLinks && $this->mInterwiki == "") {
+			$t = $wgLang->ucfirst( $r );
+		}
+		
 		# Fill fields
 		$this->mDbkeyform = $t;
 		$this->mUrlform = wfUrlencode( $t );
Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 2972)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 2973)
@@ -305,4 +305,12 @@
 $wgRightsPage = NULL;
 $wgRightsUrl = NULL;
 $wgRightsText = NULL;
+
+# Set this to false to avoid forcing the first letter of links
+# to capitals. WARNING: may break links! This makes links
+# COMPLETELY case-sensitive. Links appearing with a capital at
+# the beginning of a sentence will *not* go to the same place
+# as links in the middle of a sentence using a lowercase initial.
+$wgCapitalLinks = true;
+
 ?>
Views
Toolbox