[Mono-docs-list] monodocer System.ComponentModel patch

Greg Steffensen greg.steffensen at gmail.com
Thu Mar 30 17:06:11 EST 2006


Skipped content of type multipart/alternative-------------- next part --------------
Index: monodocer.cs
===================================================================
--- monodocer.cs	(revision 58819)
+++ monodocer.cs	(working copy)
@@ -9,6 +9,7 @@
 using System.Xml;
 
 using Mono.GetOptions;
+using System.ComponentModel;
 
 [assembly: AssemblyTitle("Monodocer - The Mono Documentation Tool")]
 [assembly: AssemblyCopyright("Copyright (c) 2004 Joshua Tauberer <tauberer at for.net>\nreleased under the GPL.")]
@@ -23,6 +24,7 @@
 	
 	static bool nooverrides = true, delete = false, ignoremembers = false;
 	static bool pretty = false;
+	static bool usedescriptions = false;
 	
 	static int additions = 0, deletions = 0;
 
@@ -62,6 +64,10 @@
 		
 		[Option("Indent the XML files nicely.")]
 		public bool pretty = false;
+
+		[Option("Use member descriptions provided via System.ComponentModel.DescriptionAttribute attributes")]
+		public bool usedescriptions = false;
+
 		
 	}
 	
@@ -83,6 +89,7 @@
 		ignoremembers = opts.ignoremembers;
 		name = opts.name;
 		pretty = opts.pretty;
+		usedescriptions = opts.usedescriptions;
 
 		try {
 			// PARSE BASIC OPTIONS AND LOAD THE ASSEMBLY TO DOCUMENT
@@ -757,6 +764,22 @@
 		string slashdocsig = MakeSlashDocMemberSig(mi);
 
 		MakeDocNode(me, paraminfo, returntype, returnisreturn, addremarks, slashdocsig);
+
+		// set the summary according to any DescriptionAttribute attrs,
+		// if the user asked us to
+		if (usedescriptions) {
+			object[] memberAttrs = mi.GetCustomAttributes(false);
+			XmlElement summary = (XmlElement)me.SelectSingleNode("Docs/summary");;
+			if (summary != null) {
+				foreach (object at in memberAttrs) {
+					if (at is DescriptionAttribute)  {
+						string desc = ((DescriptionAttribute)at).Description;
+						summary.InnerText = desc;
+					}
+				}
+			}
+		}
+
 		
 	}
 	


More information about the Mono-docs-list mailing list