Add [Exports] from MonoTouch/MonoMac to the documentation index
authorMiguel de Icaza <miguel@gnome.org>
Thu, 12 Jan 2012 01:02:30 +0000 (20:02 -0500)
committerMiguel de Icaza <miguel@gnome.org>
Thu, 12 Jan 2012 01:02:39 +0000 (20:02 -0500)
mcs/tools/mod/mod.cs
mcs/tools/monodoc/Makefile
mcs/tools/monodoc/Monodoc/ecma-provider.cs
mcs/tools/monodoc/Monodoc/index.cs
mcs/tools/monodoc/Monodoc/provider.cs

index 9637170476b453e1b1fe9789778035c04db81eb5..28a8b3d5daeee9744ef20f96b42203343870ad4c 100644 (file)
@@ -9,13 +9,20 @@ namespace Monodoc
        {
                static void Main (string[] args)
                {
-                       if (args.Length != 1)
+                       if (args.Length < 1)
                        {
                                Console.WriteLine ("Usage: mod.exe Url");
                                return;
                        }
+                       bool index =  (args.Length == 2);
+                       
 
                        RootTree help_tree = RootTree.LoadTree ();
+                       if (index){
+                               Console.WriteLine ("Building index");
+                               RootTree.MakeIndex ();
+                               return;
+                       }
                        Node n;
                        Console.WriteLine (help_tree.RenderUrl (args[0], out n));
                }
index 8be717da0cf577e6e1ddb8d6a0a8909abae5f7ff..757f39a86f76ff641c8e1c1037d02a13c2ebdf92 100644 (file)
@@ -90,7 +90,7 @@ EXTRA_DISTFILES = \
 
 LIB_MCS_FLAGS = \
        /codepage:utf8                                                    \
-       /nowarn:169,164,162,168,219                                       \
+       /nowarn:169,164,162,168,219,618,612                                      \
        /r:Commons.Xml.Relaxng                                            \
        /resource:../../docs/monodoc.xml,monodoc.xml                      \
        /resource:Resources/base.css,base.css                             \
index b410c953884c4302ab1054832dd18dbfa97559ef..2d0421303fee767fd56c8897c98521ebfab380e7 100644 (file)
@@ -1820,7 +1820,10 @@ public class EcmaHelpSource : HelpSource {
        }
                                
        //
-       // Populates the index.
+       // Populates the searchable index.
+       //
+       // The idea of this index is to capture the most common search terms, the UI for this
+       // usually updates automatically as the user types.
        //
        public override void PopulateIndex (IndexMaker index_maker)
        {
@@ -1831,7 +1834,48 @@ public class EcmaHelpSource : HelpSource {
 
                                string doc_tag = GetKindFromCaption (type_node.Caption);
                                string url = "T:" + full;
-                                       
+
+
+                               //
+                               // Add MonoMac/MonoTouch [Export] attributes, those live only in classes
+                               //
+                               if (doc_tag == "Class" && (ns_node.Caption.StartsWith ("MonoTouch") || ns_node.Caption.StartsWith ("MonoMac"))){
+                                       try {
+                                               string rest;
+                                               var xdoc = GetXmlFromUrl (type_node.URL, out rest);
+                                               if (xdoc != null){
+                                                       var nodesWithExports = xdoc.SelectNodes ("/Type/Members/Member[contains (Attributes/Attribute/AttributeName, 'Foundation.Export') and (MemberType='Property' or MemberType='Method' or MemberType='Constructor')]");
+                                                       
+                                                       foreach (XmlNode n in nodesWithExports){
+                                                               string cref = EcmaDoc.GetCref ((XmlElement) n);
+                                                               
+                                                               var exports = n.SelectNodes ("Attributes/Attribute/AttributeName");
+                                                               foreach (XmlNode exportNode in exports){
+                                                                       var inner = exportNode.InnerText;
+                                                                       int p = inner.IndexOf ("Foundation.Export(\"");
+                                                                       if (p == -1){
+                                                                               Console.WriteLine ("Not found the Export attribute in {0}", inner);
+                                                                               continue;
+                                                                       }
+                                                                       var pa = inner.IndexOf ("\"", p);
+                                                                       if (pa == -1){
+                                                                               Console.WriteLine ("Export has no target in {0}", inner);
+                                                                               continue;
+                                                                       }
+                                                                       var end = inner.IndexOf ("\"", pa+1);
+                                                                       
+                                                                       var export = end == -1 ? inner.Substring (pa+1) : inner.Substring (pa+1, end-(pa+1));
+
+                                                                       Console.WriteLine ("{0} to {1}", export, cref);
+                                                                       index_maker.Add (export + " selector", export, cref);
+                                                               }
+                                                       }
+                                               }
+                                       } catch (Exception e){
+                                               Console.WriteLine ("Problem processing {0} for MonoTouch/MonoMac exports\n\n{0}", e);
+                                       }
+                               }
+
                                if (doc_tag == "Class" || doc_tag == "Structure" || doc_tag == "Interface"){
 
                                        index_maker.Add (type_node.Caption, typename, url);
index 84abbaca874fff799e3be46df4587db133b118aa..ad569ace33b7b39d15fae7c3bd849cd4de4de4f6 100644 (file)
@@ -2,9 +2,11 @@
 // index.cs: Handling of the index files
 //
 // Author:
-//   Miguel de Icaza (miguel@ximian.com)
+//   Miguel de Icaza (miguel@xamarin.com)
 //
 // (C) 2003 Ximian, Inc.
+// Copyright 2003-2011 Novell Inc
+// Copyright 2011 Xamarin Inc.
 //
 // Possible file format optimizations:
 //   * Do not use 4 bytes for each index entry, use 3 bytes
index 944b7c9b694752d42d3583879caafe1f22c3665b..100c5c2afb2df977a463f1737283aa8cba67666b 100644 (file)
@@ -889,7 +889,6 @@ public class RootTree : Tree {
                                }
                        }
                }
-               Console.WriteLine ("Basedir={0}", basedir);
 
                //
                // Load the layout
@@ -948,9 +947,8 @@ public class RootTree : Tree {
                //
                // Load the sources
                //
-               foreach (var sourceFile in sourceFiles){
+               foreach (var sourceFile in sourceFiles)
                        root.AddSourceFile (sourceFile);
-               }
                
                foreach (string path in UncompiledHelpSources) {
                        EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path);
@@ -1644,7 +1642,7 @@ public class RootTree : Tree {
                        // No octal in C#, how lame is that
                        chmod (path, 0x1a4);
                }
-               Console.WriteLine ("Documentation index updated");
+               Console.WriteLine ("Documentation index at {0} updated", path);
        }
 
        static bool IsUnix {