Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[monkeydoc] Let XHTML have its node sorted by .Element rather than .C…

…aption
  • Loading branch information...
commit b90647e38087cad95c170c2dab6f23c8412e75a9 1 parent ccb7307
@garuma garuma authored
View
11 mcs/tools/monkeydoc/MonkeyDoc/HelpSource.cs
@@ -10,6 +10,11 @@
namespace MonkeyDoc
{
+ public enum SortType {
+ Caption,
+ Element
+ }
+
//
// The HelpSource class keeps track of the archived data, and its
// tree
@@ -121,6 +126,12 @@ public HelpSource ()
return "dummy:";
}
}
+
+ public virtual SortType SortType {
+ get {
+ return SortType.Caption;
+ }
+ }
/// <summary>
/// Returns a stream from the packaged help source archive
View
7 mcs/tools/monkeydoc/MonkeyDoc/Node.cs
@@ -16,6 +16,7 @@ public class Node : IComparable<Node>, IComparable
Node parent;
List<Node> nodes;
Dictionary<string, Node> childrenLookup;
+ bool elementSort;
/* Address has three types of value,
* _ 0 is for no on-disk representation
* _ >0 is a valid address that is loaded immediately
@@ -33,6 +34,7 @@ internal Node (Tree tree, string caption, string element)
this.tree = tree;
this.caption = caption;
this.element = element;
+ this.elementSort = tree.HelpSource != null && tree.HelpSource.SortType == SortType.Element;
}
/// <summary>
@@ -47,6 +49,7 @@ internal Node (Tree tree, int address)
{
this.address = address;
this.tree = tree;
+ this.elementSort = tree.HelpSource != null && tree.HelpSource.SortType == SortType.Element;
if (address > 0)
LoadNode ();
}
@@ -303,8 +306,8 @@ int CompareToInternal (Node other)
EnsureLoaded ();
other.EnsureLoaded ();
- var cap1 = caption;
- var cap2 = other.caption;
+ var cap1 = elementSort ? element : caption;
+ var cap2 = elementSort ? other.element : other.caption;
/* Some node (notably from ecmaspec) have number prepended to them
* which we need to sort better by padding them to the same number
View
6 mcs/tools/monkeydoc/MonkeyDoc/providers/xhtml-provider.cs
@@ -52,6 +52,12 @@ public XhtmlHelpSource (string base_file, bool create) : base (base_file, create
return XhtmlPrefix;
}
}
+
+ public override SortType SortType {
+ get {
+ return SortType.Element;
+ }
+ }
public override DocumentType GetDocumentTypeForId (string id, out Dictionary<string, string> extraArgs)
{
Please sign in to comment.
Something went wrong with that request. Please try again.