Skip to content

Commit

Permalink
[Bind] Make documentation output closer to previous xslt implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
thefiddler committed Mar 31, 2014
1 parent 9012101 commit 8001d62
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions Source/Bind/CSharpSpecWriter.cs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -329,8 +329,24 @@ void WriteDocumentation(BindStreamWriter sw, Function f)
category = String.Format("[requires: {0}]", "v" + f.Version + " or " + f.Category); category = String.Format("[requires: {0}]", "v" + f.Version + " or " + f.Category);
} }


sw.WriteLine("/// <summary>{0}{1} {2}</summary>", // Write function summary
category, warning, docs.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++) for (int i = 0; i < f.Parameters.Count; i++)
{ {
var param = f.Parameters[i]; var param = f.Parameters[i];
Expand All @@ -357,14 +373,26 @@ void WriteDocumentation(BindStreamWriter sw, Function f)
{ {
Console.Error.WriteLine( Console.Error.WriteLine(
"[Warning] Parameter '{0}' in function '{1}' has incorrect doc name '{2}'", "[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 // Note: we use param.Name, because the documentation sometimes
// uses different names than the specification. // uses different names than the specification.
sw.WriteLine("/// <param name=\"{0}\">{1} {2}</param>", sw.Write("/// <param name=\"{0}\">", param.Name);
param.Name, length, docparam.Documentation); 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 else
{ {
Expand Down

0 comments on commit 8001d62

Please sign in to comment.