[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-patches
Subject:    [Mono-patches] r36864 - trunk/monodoc/browser
From:       "Miguel de Icaza" <miguel () mono-cvs ! ximian ! com>
Date:       2004-11-30 21:59:14
Message-ID: 20041130215914.D499094764 () mono-cvs ! ximian ! com
[Download RAW message or body]

Author: miguel
Date: 2004-11-30 16:59:14 -0500 (Tue, 30 Nov 2004)
New Revision: 36864

Modified:
   trunk/monodoc/browser/ChangeLog
   trunk/monodoc/browser/xhtml-provider.cs
Log:
2004-11-30  Miguel de Icaza  <miguel@ximian.com>

	* xhtml-provider.cs (GetAbsoluteLink): Avoid munging urls that
	start with our "magic" prefixes, keep them as they are.



Modified: trunk/monodoc/browser/ChangeLog
===================================================================
--- trunk/monodoc/browser/ChangeLog	2004-11-30 21:13:42 UTC (rev 36863)
+++ trunk/monodoc/browser/ChangeLog	2004-11-30 21:59:14 UTC (rev 36864)
@@ -1,3 +1,8 @@
+2004-11-30  Miguel de Icaza  <miguel@ximian.com>
+
+	* xhtml-provider.cs (GetAbsoluteLink): Avoid munging urls that
+	start with our "magic" prefixes, keep them as they are.
+
 2004-11-30  Atsushi Enomoto  <atsushi@ximian.com>
 
 	* configure.in,

Modified: trunk/monodoc/browser/xhtml-provider.cs
===================================================================
--- trunk/monodoc/browser/xhtml-provider.cs	2004-11-30 21:13:42 UTC (rev 36863)
+++ trunk/monodoc/browser/xhtml-provider.cs	2004-11-30 21:59:14 UTC (rev 36864)
@@ -89,28 +89,38 @@
 		return docToProcess;
 	}
 
-	public static string GetAbsoluteLink(string target, string url) {
-
+	public static string GetAbsoluteLink(string target, string url)
+	{
+			
 		string value = null;
-
-		if (!target.StartsWith("#")) {
-			int endp = target.IndexOf(':');
-
-			if (endp == -1)
-				endp = 0;
-			string protocol = target.Substring(0, endp);
-			switch (protocol) {
-			case "mailto": 
-				break;
-			case "http":
-				break;
-			case "ftp":
-				break;
-			default:
-
-				// handle absolute urls like: /html/en/images/empty.png
-				if (!target.StartsWith("/")) {
-
+		
+		if (target.StartsWith ("#") ||
+		    target.StartsWith ("T:") ||
+		    target.StartsWith ("M:") ||
+		    target.StartsWith ("P:") ||
+		    target.StartsWith ("T:") ||
+		    target.StartsWith ("E:") ||
+		    target.StartsWith ("F:") ||
+		    target.StartsWith ("O:") ||
+		    target.StartsWith ("api:"))
+			return null;
+		
+		int endp = target.IndexOf(':');
+		
+		if (endp == -1)
+			endp = 0;
+		string protocol = target.Substring(0, endp);
+		switch (protocol) {
+		case "mailto": 
+			break;
+		case "http":
+			break;
+		case "ftp":
+			break;
+		default:
+			// handle absolute urls like: /html/en/images/empty.png
+			if (!target.StartsWith("/")) {
+				
 				// url is something like "gnome/bindings/mono.html"
 				// This will get the path "gnome/bindings"
 				
@@ -136,17 +146,14 @@
 				
 				value = tmpurl + "/" + target;
 				
-				}
-				else {
-					value = target.Substring(1, target.Length - 1);
-				}
-				break;
-			}	
+			} else {
+				value = target.Substring(1, target.Length - 1);
+			}
+			break;
 		}
-		
 		return value;
 	}
-
+	
 	private XmlDocument RewriteLinks(XmlDocument docToProcess, string url)
 	{
                 XmlNodeList nodeList = docToProcess.GetElementsByTagName("a");

_______________________________________________
Mono-patches maillist  -  Mono-patches@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic