diff options
author | Jonathan Pryor <jpryor@novell.com> | 2010-01-14 15:50:31 +0300 |
---|---|---|
committer | Jonathan Pryor <jpryor@novell.com> | 2010-01-14 15:50:31 +0300 |
commit | 52f97eb8ed415ce440a42eb68a4c25a950436cf4 (patch) | |
tree | 87981e90fc204299f1d490b0048f9c457c078100 /mcs/tools | |
parent | b51b58935fe9e6279ebdac6f47d7c29e183d256b (diff) |
* Monodoc/provider.cs, Monodoc/ecma-provider.cs: Improve cache support
by having EcmaHelpSource.GetTextFromUrl() look for cached contents.
This greatly speeds up type member listings (e.g. T:...List`1/*),
e.g. from ~2.0s to 0.06s.
* Mono.Documentation/XmlDocUtils.cs: XmlDocUtils.AddExtensionMethods()
wasn't adding extension methods which matched *interfaces* of base
classes. Result: Mono.Options.OptionSet (which inherits
System.Collections.ObjectModel.KeyedCollection`2 which inherits from
System.Collections.ObjectModel.Collection`1 which implements
System.Collections.Generic.IEnumerable`1) wasn't getting any of the
LINQ extension methods (which is bad). Fix this.
* Resources/mdoc-html-utils.xsl: Fix regression caused by 2009-12-02
commit adding GetLinkTargetHtml(). The problem was that when
running within ASP.NET/monodoc ~all extension method links would be
'javascript:alert("...")M:Foo.Method(...)', which is clearly wrong.
This occurred because $linkid's generation would always call
GetLinkTargetHtml() with a $cref value of '', thus the monodoc
GetLinkTarget() would return '', so GetLinkTargetHtml() would return
the javascript "not found" alert. Thus, we can't expect
GetLinkTargetHtml() with $cref='' to work under monodoc, but it's
~required to work sanely under 'mdoc export-html'.
Solution is to not call GetLinkTargetHtml() here UNLESS we're doing
'mdoc export-html' generation, which we assume to be the case if
$html-anchor is true.
svn path=/branches/mono-2-6/mcs/; revision=149553
Diffstat (limited to 'mcs/tools')
-rw-r--r-- | mcs/tools/monodoc/ChangeLog | 33 | ||||
-rw-r--r-- | mcs/tools/monodoc/Mono.Documentation/XmlDocUtils.cs | 7 | ||||
-rw-r--r-- | mcs/tools/monodoc/Monodoc/ecma-provider.cs | 7 | ||||
-rw-r--r-- | mcs/tools/monodoc/Monodoc/provider.cs | 4 | ||||
-rw-r--r-- | mcs/tools/monodoc/Resources/mdoc-html-utils.xsl | 6 |
5 files changed, 52 insertions, 5 deletions
diff --git a/mcs/tools/monodoc/ChangeLog b/mcs/tools/monodoc/ChangeLog index 55400a4881a..a1db250ea50 100644 --- a/mcs/tools/monodoc/ChangeLog +++ b/mcs/tools/monodoc/ChangeLog @@ -1,3 +1,36 @@ +2010-01-13 Jonathan Pryor <jpryor@novell.com> + + * Monodoc/provider.cs, Monodoc/ecma-provider.cs: Improve cache support + by having EcmaHelpSource.GetTextFromUrl() look for cached contents. + This greatly speeds up type member listings (e.g. T:...List`1/*), + e.g. from ~2.0s to 0.06s. + +2010-01-13 Jonathan Pryor <jpryor@novell.com> + + * Mono.Documentation/XmlDocUtils.cs: XmlDocUtils.AddExtensionMethods() + wasn't adding extension methods which matched *interfaces* of base + classes. Result: Mono.Options.OptionSet (which inherits + System.Collections.ObjectModel.KeyedCollection`2 which inherits from + System.Collections.ObjectModel.Collection`1 which implements + System.Collections.Generic.IEnumerable`1) wasn't getting any of the + LINQ extension methods (which is bad). Fix this. + +2010-01-13 Jonathan Pryor <jpryor@novell.com> + + * Resources/mdoc-html-utils.xsl: Fix regression caused by 2009-12-02 + commit adding GetLinkTargetHtml(). The problem was that when + running within ASP.NET/monodoc ~all extension method links would be + 'javascript:alert("...")M:Foo.Method(...)', which is clearly wrong. + This occurred because $linkid's generation would always call + GetLinkTargetHtml() with a $cref value of '', thus the monodoc + GetLinkTarget() would return '', so GetLinkTargetHtml() would return + the javascript "not found" alert. Thus, we can't expect + GetLinkTargetHtml() with $cref='' to work under monodoc, but it's + ~required to work sanely under 'mdoc export-html'. + Solution is to not call GetLinkTargetHtml() here UNLESS we're doing + 'mdoc export-html' generation, which we assume to be the case if + $html-anchor is true. + 2009-12-30 Jonathan Pryor <jpryor@novell.com> * Lucene.Net/Lucene.Net/QueryParser/QueryParser.cs: Fix crash when diff --git a/mcs/tools/monodoc/Mono.Documentation/XmlDocUtils.cs b/mcs/tools/monodoc/Mono.Documentation/XmlDocUtils.cs index e8ed6df8387..17af0c65585 100644 --- a/mcs/tools/monodoc/Mono.Documentation/XmlDocUtils.cs +++ b/mcs/tools/monodoc/Mono.Documentation/XmlDocUtils.cs @@ -133,12 +133,17 @@ namespace Mono.Documentation { { yield return "System.Object"; yield return GetEscapedPath (type, "Type/@FullName"); + + Hashtable h = new Hashtable (); + GetInterfaces (h, type, loader); + string s = GetEscapedPath (type, "Type/Base/BaseTypeName"); if (s != null) { yield return s; XmlDocument d; string p = s; while (s != null && (d = loader (s)) != null) { + GetInterfaces (h, d, loader); s = GetEscapedPath (d, "Type/Base/BaseTypeName"); if (p == s) break; @@ -146,8 +151,6 @@ namespace Mono.Documentation { } } - Hashtable h = new Hashtable (); - GetInterfaces (h, type, loader); foreach (object o in h.Keys) yield return o.ToString (); } diff --git a/mcs/tools/monodoc/Monodoc/ecma-provider.cs b/mcs/tools/monodoc/Monodoc/ecma-provider.cs index 4041340ed69..3b9d6da5bc1 100644 --- a/mcs/tools/monodoc/Monodoc/ecma-provider.cs +++ b/mcs/tools/monodoc/Monodoc/ecma-provider.cs @@ -1155,6 +1155,13 @@ public class EcmaHelpSource : HelpSource { string GetTextFromUrl (string url) { + if (nozip) { + string path = XmlDocUtils.GetCachedFileName (base_dir, url); + if (File.Exists (path)) + return File.OpenText (path).ReadToEnd (); + return null; + } + string rest, rest2; Node node; diff --git a/mcs/tools/monodoc/Monodoc/provider.cs b/mcs/tools/monodoc/Monodoc/provider.cs index 91ee1d0cdb1..73199e97651 100644 --- a/mcs/tools/monodoc/Monodoc/provider.cs +++ b/mcs/tools/monodoc/Monodoc/provider.cs @@ -443,8 +443,8 @@ public class HelpSource { DateTime zipFileWriteTime; string name; TraceLevel trace_level = TraceLevel.Warning; - bool nozip; - string base_dir; + protected bool nozip; + protected string base_dir; public HelpSource (string base_filename, bool create) { diff --git a/mcs/tools/monodoc/Resources/mdoc-html-utils.xsl b/mcs/tools/monodoc/Resources/mdoc-html-utils.xsl index 7bb26d9cfab..ebcaa982eaf 100644 --- a/mcs/tools/monodoc/Resources/mdoc-html-utils.xsl +++ b/mcs/tools/monodoc/Resources/mdoc-html-utils.xsl @@ -1864,7 +1864,7 @@ </xsl:choose> </xsl:variable> - <xsl:variable name="linkid"> + <xsl:variable name="linkfile"> <xsl:if test="not(parent::Members/@FullName = $TypeFullName)"> <xsl:call-template name="GetLinkTarget"> <xsl:with-param name="type"> @@ -1882,7 +1882,11 @@ <xsl:with-param name="cref" /> </xsl:call-template> </xsl:if> + </xsl:variable> + + <xsl:variable name="linkid"> <xsl:if test="$html-anchor"> + <xsl:value-of select="$linkfile" /> <xsl:text>#</xsl:text> </xsl:if> <xsl:value-of select="$local-id" /> |