WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

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

To: xen-api@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-API] [PATCH 2 of 5] HTML API docs: display fields in namespaces
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
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1276866474@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1276866474@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.4.3
 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