[Mono-docs-list] Monodoc layout loading patch

Peter Williams peter@newton.cx
Fri, 16 Jul 2004 18:35:09 -0400


--=-mjLr0z8KPp82P0ocXAD8
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi all,

Following up on my previous mail, here's a patch to allow a limited form
of what I wanted. It will allow you to put <node> elements in the
.sources file for a source; new nodes will be created below the
"Various" tree and your docs can land there.

This avoids the thornier issues of figuring out how to put sources in
the right order, although it also means that nodes without a source will
find their way into the tree. (For instance, I don't have the handbook
installed, so the Mono Handbook node in my monodoc is useless.)

Peter

-- 
Peter Williams                          peter@newton.cx

"[Ninjas] are cool; and by cool, I mean totally sweet."
                              -- REAL Ultimate Power

--=-mjLr0z8KPp82P0ocXAD8
Content-Disposition: attachment; filename=third-party-docs.diff
Content-Type: text/x-patch; name=third-party-docs.diff; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Index: browser/ChangeLog
===================================================================
RCS file: /cvs/public/monodoc/browser/ChangeLog,v
retrieving revision 1.130
diff -u -r1.130 ChangeLog
--- browser/ChangeLog	15 Jul 2004 22:02:28 -0000	1.130
+++ browser/ChangeLog	16 Jul 2004 21:30:21 -0000
@@ -1,3 +1,9 @@
+2004-07-16  Peter Williams  <peter@newton.cx>
+
+	* provider.cs: Allow sources to add nodes into the "Various" branch of the
+	documentation tree, so third-party libraries can show documentation in Monodoc
+	without needing to hack monodoc.xml
+
 2004-07-15  Peter Williams  <peter@newton.cx>
 
 	* ecmaspec-html.xsl: There are nested lists in the ECMA spec: see ecma334/10.8.xml.
Index: browser/provider.cs
===================================================================
RCS file: /cvs/public/monodoc/browser/provider.cs,v
retrieving revision 1.64
diff -u -r1.64 provider.cs
--- browser/provider.cs	21 Jun 2004 22:52:59 -0000	1.64
+++ browser/provider.cs	16 Jul 2004 21:30:21 -0000
@@ -692,6 +692,12 @@
 		root.name_to_node ["root"] = root;
 		root.Populate (root, nodes);
 
+		Node third_party = root.LookupEntryPoint ("various");
+		if (third_party == null) {
+			Console.Error.WriteLine ("No 'various' doc node! Check monodoc.xml!");
+			third_party = root;
+		}
+
 		//
 		// Load the sources
 		//
@@ -709,6 +715,11 @@
 				Console.Error.WriteLine ("Error: Could not load source file {0}", file);
 				continue;
 			}
+
+			XmlNodeList extra_nodes = doc.SelectNodes ("/monodoc/node");
+			if (extra_nodes.Count > 0)
+				root.Populate (third_party, extra_nodes);
+
 			XmlNodeList sources = doc.SelectNodes ("/monodoc/source");
 			if (sources == null){
 				Console.Error.WriteLine ("Error: No <source> section found in the {0} file", file);
@@ -807,7 +818,7 @@
 				root.help_sources.Add (hs);
 				root.name_to_hs [path] = hs;
 
-				Node parent = (Node) root.name_to_node [path];
+				Node parent = root.LookupEntryPoint (path);
 				if (parent == null){
 					Console.Error.WriteLine ("node `{0}' is not defined on the documentation map", path);
 					continue;

--=-mjLr0z8KPp82P0ocXAD8--