[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-API] [PATCH 2 of 5] HTML API docs: display fields in namespaces


  • To: xen-api@xxxxxxxxxxxxxxxxxxx
  • From: Rob Hoes <rob.hoes@xxxxxxxxxx>
  • Date: Fri, 18 Jun 2010 14:07:56 +0100
  • Delivery-date: Fri, 18 Jun 2010 06:16:44 -0700
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>

 ocaml/doc/apidoc.js |  13 +++++++++----
 ocaml/doc/main.js   |   8 ++++++++
 2 files changed, 17 insertions(+), 4 deletions(-)


# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
# Date 1276866460 -3600
# Node ID 27da7dd543d2f12de21015ebba468bd4e5ed2af6
# Parent  c1d171ee6584e9b0e2326d80bda780c5868f40c1
HTML API docs: display fields in namespaces

Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>

diff -r c1d171ee6584 -r 27da7dd543d2 ocaml/doc/apidoc.js
--- a/ocaml/doc/apidoc.js
+++ b/ocaml/doc/apidoc.js
@@ -133,7 +133,7 @@
 
 function make_field(fld, n)
 {
-       name = fld.field_name;
+       name = fld.full_name.join('_');
 
        html = "";      
        html = '<div class="field' + toggle(n) + '">';
@@ -211,10 +211,15 @@
 
 function class_doc()
 {      
-       contents = clsdoc.contents;
-       fields = filter(function(f){return f[0] == "Field";}, contents);
+       contents = clsdoc.contents;     
+       fields = fold(function(a, x){
+               if (x[0] == "Field") a.push(x);
+               else a = a.concat(x[2]);
+               return a;
+               }, [], contents);
        fields = map(function(f){return f[1];}, fields);
-       fields.sort(function(a, b){return compare(a.field_name.toLowerCase(), 
b.field_name.toLowerCase());});
+       
+       fields.sort(function(a, b){return 
compare(a.full_name.join('_').toLowerCase(), 
b.full_name.join('_').toLowerCase());});
        messages = clsdoc.messages;
        messages = filter(function(m){return m.msg_hide_from_docs == false;}, 
messages);
        messages.sort(function(a, b){return compare(a.msg_name.toLowerCase(), 
b.msg_name.toLowerCase())});
diff -r c1d171ee6584 -r 27da7dd543d2 ocaml/doc/main.js
--- a/ocaml/doc/main.js
+++ b/ocaml/doc/main.js
@@ -68,6 +68,14 @@
        return x;
 }
 
+function fold(f, a, l)
+{
+       if (l.length == 0)
+               return a;
+       else
+               return fold(f, f(a, l[0]), l.slice(1));
+}
+
 // compare function for sorting
 function compare(a, b)
 {
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.