Skip to content

Commit

Permalink
[mdoc] Fix export-msxdoc regression, updated expected output.
Browse files Browse the repository at this point in the history
Commit 44b2b4a completely broke `mdoc export-msxdoc` because
EcmaDoc.GetCref() was removed. Expected:

	<member name="C:Mono.DocTest.DocAttribute(System.String)">

Actual:

	<member name="Mono.DocTest.DocAttribute..ctor">

i.e. useless.

The fix: bring back GetCref(), this time within monodocs2slashdoc.cs.

Commit 0ad6ffd changed the HTML-generating stylesheet and moved some
@id attributes around, thus breaking the mdoc unit tests (expected
output likewise changed). Fix the monodoc XSLTs so that we don't emit
id="" attributes (id's with no value).

Update mdoc's expected output so that tests pass[*].

[*]: tests will NOT actually pass, as 04bf9ad -- attempted fix for
an OS X stackoverflow caused by 3d3fe6a -- results in a gigantic
216MB diff because String.get_Chars() is repeated over and over and
over... The updated expected output in this commit is the "ideal"
update needed after locally reverting 3d3fe6a and 04bf9ad.)
  • Loading branch information
jonpryor committed May 29, 2013
1 parent 773aaf7 commit 9f21616
Show file tree
Hide file tree
Showing 34 changed files with 262 additions and 219 deletions.
8 changes: 5 additions & 3 deletions mcs/class/monodoc/Resources/mdoc-sections-css.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,11 @@
<xsl:param name="id" />
<h2>Syntax</h2>
<div class="Signature">
<xsl:attribute name="id">
<xsl:copy-of select="$id" />
</xsl:attribute>
<xsl:if test="$id != ''">
<xsl:attribute name="id">
<xsl:copy-of select="$id" />
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="$content" />
</div>
</xsl:template>
Expand Down
48 changes: 44 additions & 4 deletions mcs/tools/mdoc/Mono.Documentation/monodocs2slashdoc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,10 @@ private static void Process (string basepath, Dictionary<string, XmlElement> out
XmlElement members = outputfiles [assemblyname];
if (members == null) continue; // assembly is strangely not listed in the index

//CreateMember(EcmaDoc.GetCref (type.DocumentElement), type.DocumentElement, members);
CreateMember (GetCref (type.DocumentElement), type.DocumentElement, members);

foreach (XmlElement memberdoc in type.SelectNodes("Type/Members/Member")) {
//string name = EcmaDoc.GetCref (memberdoc);
// FIXME
string name = ns + "." + typename + "." + memberdoc.GetAttribute ("MemberName");
string name = GetCref (memberdoc);
CreateMember(name, memberdoc, members);
}
}
Expand All @@ -133,6 +131,48 @@ private static void Process (string basepath, Dictionary<string, XmlElement> out
AddNamespaceSummary(nsSummaries, basepath, nsnode.GetAttribute("Name"));
}
}

static string GetCref (XmlElement member)
{
string typeName = XmlDocUtils.ToEscapedTypeName (member.SelectSingleNode("/Type/@FullName").InnerText);
if (member.Name == "Type")
return "T:" + typeName;
string memberType = member.SelectSingleNode("MemberType").InnerText;
switch (memberType) {
case "Constructor":
return "C:" + typeName + MakeArgs(member);
case "Event":
return "E:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName"));
case "Field":
return "F:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName"));
case "Method": {
string name = "M:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName")) + MakeArgs(member);
if (member.GetAttribute("MemberName") == "op_Implicit" || member.GetAttribute("MemberName") == "op_Explicit")
name += "~" + XmlDocUtils.ToTypeName (member.SelectSingleNode("ReturnValue/ReturnType").InnerText, member);
return name;
}
case "Property":
return "P:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName")) + MakeArgs(member);
default:
throw new NotSupportedException ("MemberType '" + memberType + "' is not supported.");
}
}

static string MakeArgs (XmlElement member)
{
XmlNodeList parameters = member.SelectNodes ("Parameters/Parameter");
if (parameters.Count == 0)
return "";
StringBuilder args = new StringBuilder ();
args.Append ("(");
args.Append (XmlDocUtils.ToTypeName (parameters [0].Attributes ["Type"].Value, member));
for (int i = 1; i < parameters.Count; ++i) {
args.Append (",");
args.Append (XmlDocUtils.ToTypeName (parameters [i].Attributes ["Type"].Value, member));
}
args.Append (")");
return args.ToString ();
}

private static void AddNamespaceSummary(XmlDocument nsSummaries, string basepath, string currentNs) {
foreach (var filename in new [] {
Expand Down
3 changes: 2 additions & 1 deletion mcs/tools/mdoc/Resources/defaulttemplate.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
<xsl:template name="create-index">
<xsl:if test="
count(PageTitle/@id) &gt; 0 and
count(Signature/@id) &gt; 0 and
(count(Signature/@id) &gt; 0 or count(Signature/div/@id) &gt; 0) and
count(Remarks/@id) &gt; 0 and
count(Members/@id) &gt; 0
">
Expand All @@ -249,6 +249,7 @@
<xsl:attribute name="href">
<xsl:text>#</xsl:text>
<xsl:value-of select="Signature/@id" />
<xsl:value-of select="Signature/div/@id" />
</xsl:attribute>
<xsl:text>Signature</xsl:text>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@
</div>
<h1 class="PageTitle" id="T:Mono.DocTest.Generic.Extensions">Extensions Class</h1>
<p class="Summary" id="T:Mono.DocTest.Generic.Extensions:Summary">extension methods!</p>
<div id="T:Mono.DocTest.Generic.Extensions:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">public static class <b>Extensions</b></div>
<div class="Signature" id="T:Mono.DocTest.Generic.Extensions:Signature">public static class <b>Extensions</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.Extensions:Docs">
<h2 class="Section">Remarks</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.Func`2">Func&lt;TArg,TRet&gt; G
<p class="Summary" id="T:Mono.DocTest.Generic.Func`2:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.Func`2:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">[Mono.DocTest.Doc("method")]<br />[return:Mono.DocTest.Doc("return", Field=false)]<br />public delegate <i title="return type, with attributes!">TRet</i> <b>Func&lt;[Mono.DocTest.Doc("arg!")] TArg, [Mono.DocTest.Doc("ret!")] TRet&gt;</b> ([Mono.DocTest.Doc("arg-actual")] <i title="argument type, with attributes!">TArg</i> a)<br /> where TArg : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Exception">Exception</a><br /> where TRet : </div>
<div class="Signature" id="T:Mono.DocTest.Generic.Func`2:Signature">[Mono.DocTest.Doc("method")]<br />[return:Mono.DocTest.Doc("return", Field=false)]<br />public delegate <i title="return type, with attributes!">TRet</i> <b>Func&lt;[Mono.DocTest.Doc("arg!")] TArg, [Mono.DocTest.Doc("ret!")] TRet&gt;</b> ([Mono.DocTest.Doc("arg-actual")] <i title="argument type, with attributes!">TArg</i> a)<br /> where TArg : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Exception">Exception</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.Func`2:Docs">
<h4 class="Subsection">Type Parameters</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs">Gen
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">public class <b>GenericBase&lt;U&gt;.FooEventArgs</b> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventArgs">EventArgs</a></div>
<div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Signature">public class <b>GenericBase&lt;U&gt;.FooEventArgs</b> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventArgs">EventArgs</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Docs">
<h2 class="Section">Remarks</h2>
Expand All @@ -237,7 +237,7 @@ <h2 class="Section">Public Constructors</h2>
<td>
<div>
<b>
<a href="#C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs">GenericBase</a>
<a href="#C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs()">GenericBase</a>
</b>()</div>
</td>
<td>
Expand Down Expand Up @@ -268,19 +268,19 @@ <h2 class="Section">Extension Methods</h2>
<div class="Members" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
<h3 id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs">GenericBase Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:member">
<h3 id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs()">GenericBase Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>GenericBase</b> ()</div>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Remarks">
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Version Information">
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">protected struct <b>GenericBase&lt;U&gt;.NestedCollection.Enumerator</b></div>
<div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Signature">protected struct <b>GenericBase&lt;U&gt;.NestedCollection.Enumerator</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Docs">
<h2 class="Section">Remarks</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection"
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">public class <b>GenericBase&lt;U&gt;.NestedCollection</b></div>
<div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Signature">public class <b>GenericBase&lt;U&gt;.NestedCollection</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Docs">
<h2 class="Section">Remarks</h2>
Expand All @@ -237,7 +237,7 @@ <h2 class="Section">Public Constructors</h2>
<td>
<div>
<b>
<a href="#C:Mono.DocTest.Generic.GenericBase`1.NestedCollection">GenericBase</a>
<a href="#C:Mono.DocTest.Generic.GenericBase`1.NestedCollection()">GenericBase</a>
</b>()</div>
</td>
<td>
Expand Down Expand Up @@ -268,19 +268,19 @@ <h2 class="Section">Extension Methods</h2>
<div class="Members" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
<h3 id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection">GenericBase Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection:member">
<h3 id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection()">GenericBase Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>GenericBase</b> ()</div>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Remarks">
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Version Information">
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.GenericBase`1">GenericBase&lt;U
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.GenericBase`1:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">public class <b>GenericBase&lt;U&gt;</b></div>
<div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1:Signature">public class <b>GenericBase&lt;U&gt;</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
Expand Down Expand Up @@ -247,7 +247,7 @@ <h2 class="Section">Public Constructors</h2>
<td>
<div>
<b>
<a href="#C:Mono.DocTest.Generic.GenericBase`1">GenericBase</a>
<a href="#C:Mono.DocTest.Generic.GenericBase`1()">GenericBase</a>
</b>()</div>
</td>
<td>
Expand Down Expand Up @@ -384,19 +384,19 @@ <h2 class="Section">Extension Methods</h2>
<div class="Members" id="T:Mono.DocTest.Generic.GenericBase`1:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
<h3 id="C:Mono.DocTest.Generic.GenericBase`1">GenericBase Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.GenericBase`1:member">
<h3 id="C:Mono.DocTest.Generic.GenericBase`1()">GenericBase Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.GenericBase`1():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>GenericBase</b> ()</div>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1:Remarks">
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1:Version Information">
<div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.IFoo`1">IFoo&lt;T&gt; Generic I
<p class="Summary" id="T:Mono.DocTest.Generic.IFoo`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.IFoo`1:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">public interface <b>IFoo&lt;T&gt;</b></div>
<div class="Signature" id="T:Mono.DocTest.Generic.IFoo`1:Signature">public interface <b>IFoo&lt;T&gt;</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.IFoo`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ <h1 class="PageTitle" id="T:Mono.DocTest.Generic.MyList`1.Helper`2">MyList&lt;T&
<p class="Summary" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Signature">
<div>
<h2>Syntax</h2>
<div class="Signature">public class <b>MyList&lt;T, U, V&gt;</b></div>
<div class="Signature" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Signature">public class <b>MyList&lt;T, U, V&gt;</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Docs">
<h4 class="Subsection">Type Parameters</h4>
Expand Down Expand Up @@ -251,7 +251,7 @@ <h2 class="Section">Public Constructors</h2>
<td>
<div>
<b>
<a href="#C:Mono.DocTest.Generic.MyList`1.Helper`2">MyList</a>
<a href="#C:Mono.DocTest.Generic.MyList`1.Helper`2()">MyList</a>
</b>()</div>
</td>
<td>
Expand Down Expand Up @@ -299,19 +299,19 @@ <h2 class="Section">Extension Methods</h2>
<div class="Members" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
<h3 id="C:Mono.DocTest.Generic.MyList`1.Helper`2">MyList Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.MyList`1.Helper`2:member">
<h3 id="C:Mono.DocTest.Generic.MyList`1.Helper`2()">MyList Constructor</h3>
<blockquote id="C:Mono.DocTest.Generic.MyList`1.Helper`2():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>MyList</b> ()</div>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2:Remarks">
<div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2:Version Information">
<div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
Expand Down
Loading

0 comments on commit 9f21616

Please sign in to comment.