[Mono-dev] [PATCH] Monodoc. Fix rendering of masteroverview for monodocer output

Mario Sopena <[email protected]>
Newsgroups gmane.comp.gnome.mono.devel,gmane.comp.gnome.mono.documentation
Message-ID <[email protected]>
Hey,

    I don't know if someone has noticed that the master overview of
the docs produced by monodocer (and loaded via the --edit command)
doesn't show at all. Also, the link at the home page for that content
is broken.

This patch fix those issues, although the master overview showed is
just a list of  namespaces (without summary or remmarks).

Any comments before submitting?

Mario.

_______________________________________________
Mono-devel-list mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/mono-devel-list
engine.diff (text/plain, 2.3 KB)
Index: engine/provider.cs
===================================================================
--- engine/provider.cs	(revision 51172)
+++ engine/provider.cs	(working copy)
@@ -895,7 +895,9 @@
 		foreach (string path in UncompiledHelpSources) {
 			EcmaUncompiledHelpSource hs = new EcmaUncompiledHelpSource(path);
 			root.help_sources.Add (hs);
-			Node hsn = root.CreateNode(hs.Name, "extra-help-source-" + hs.Name);
+			string epath = "extra-help-source-" + hs.Name;
+			Node hsn = root.CreateNode (hs.Name, "root:/" + epath);
+			root.name_to_hs [epath] = hs;
 			hsn.EnsureNodes ();
 			foreach (Node n in hs.Tree.Nodes){
 				hsn.AddNode (n);
Index: engine/ecma-provider.cs
===================================================================
--- engine/ecma-provider.cs	(revision 51172)
+++ engine/ecma-provider.cs	(working copy)
@@ -1005,7 +1005,7 @@
 		return Htmlize(ecma_xml, null);
 	}
 	
-	static string Htmlize (IXPathNavigable ecma_xml, XsltArgumentList args)
+	public static string Htmlize (IXPathNavigable ecma_xml, XsltArgumentList args)
 	{
 		EnsureTransform ();
 		
@@ -1842,7 +1842,32 @@
 	public override string GetText (string url, out Node match_node) {
 		if (url == "root:") {
 			match_node = null;
-			return null;
+			
+			//load index.xml
+			XmlDocument index = new XmlDocument ();
+			index.Load (Path.Combine (basedir.FullName, "index.xml"));
+			XmlNodeList nodes = index.SelectNodes ("/Overview/Types/Namespace");
+			
+			//recreate masteroverview.xml
+			XmlDocument summary = new XmlDocument ();
+			XmlElement elements = summary.CreateElement ("elements");
+			foreach (XmlNode node in nodes) {
+				XmlElement ns = summary.CreateElement ("namespace");
+				XmlAttribute attr = summary.CreateAttribute ("ns");
+				attr.Value = node.Attributes["Name"].Value;
+				ns.Attributes.Append (attr);
+				elements.AppendChild (ns);
+			}
+			summary.AppendChild (elements);
+
+			XmlReader reader = new XmlTextReader (new StringReader (summary.OuterXml));
+
+			//transform the recently created masteroverview.xml
+			XsltArgumentList args = new XsltArgumentList();
+			args.AddExtensionObject("monodoc://extensions", ExtObject);
+			args.AddParam("show", "", "masteroverview");
+			string s = EcmaHelpSource.Htmlize(new XPathDocument (reader), args);
+			return BuildHtml (css_ecma_code, s); 
 		}
 		return base.GetText(url, out match_node);
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.