Skip to content
Browse files

[Bind] Make documentation output closer to previous xslt implementation

  • Loading branch information...
1 parent 9012101 commit 8001d6259925ade3182a20a42714e2b54d9518d8 @thefiddler thefiddler committed Mar 31, 2014
Showing with 34 additions and 6 deletions.
  1. +34 −6 Source/Bind/CSharpSpecWriter.cs
View
40 Source/Bind/CSharpSpecWriter.cs
@@ -329,8 +329,24 @@ void WriteDocumentation(BindStreamWriter sw, Function f)
category = String.Format("[requires: {0}]", "v" + f.Version + " or " + f.Category);
}
- sw.WriteLine("/// <summary>{0}{1} {2}</summary>",
- category, warning, docs.Summary);
+ // Write function summary
+ sw.Write("/// <summary>");
+ if (!String.IsNullOrEmpty(category) || !String.IsNullOrEmpty(warning))
+ {
+ sw.Write(WriteOptions.NoIndent, "{0}{1}", category, warning);
+ if (!String.IsNullOrEmpty(docs.Summary))
+ {
+ sw.WriteLine();
+ sw.WriteLine("/// {0}", docs.Summary);
+ sw.WriteLine("/// </summary>");
+ }
+ else
+ {
+ sw.WriteLine(WriteOptions.NoIndent, "</summary>");
+ }
+ }
+
+ // Write function parameters
for (int i = 0; i < f.Parameters.Count; i++)
{
var param = f.Parameters[i];
@@ -357,14 +373,26 @@ void WriteDocumentation(BindStreamWriter sw, Function f)
{
Console.Error.WriteLine(
"[Warning] Parameter '{0}' in function '{1}' has incorrect doc name '{2}'",
- param.Name, f.Name, docparam.Name);
+ param.RawName, f.Name, docparam.Name);
}
-
// Note: we use param.Name, because the documentation sometimes
// uses different names than the specification.
- sw.WriteLine("/// <param name=\"{0}\">{1} {2}</param>",
- param.Name, length, docparam.Documentation);
+ sw.Write("/// <param name=\"{0}\">", param.Name);
+ if (!String.IsNullOrEmpty(length))
+ {
+ sw.Write(WriteOptions.NoIndent, "{0}", length);
+ }
+ if (!String.IsNullOrEmpty(docparam.Documentation))
+ {
+ sw.WriteLine(WriteOptions.NoIndent, " ");
+ sw.WriteLine("/// {0}", docparam.Documentation);
+ sw.WriteLine("/// </param>");
+ }
+ else
+ {
+ sw.WriteLine(WriteOptions.NoIndent, "</param>");
+ }
}
else
{

0 comments on commit 8001d62

Please sign in to comment.
Something went wrong with that request. Please try again.