# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
Make sure the API docs also look good in Internet Explorer
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
diff -r 47b046f1ac58 ocaml/doc/apidoc.js
--- a/ocaml/doc/apidoc.js
+++ b/ocaml/doc/apidoc.js
@@ -68,9 +68,9 @@
return t[1] + ' record';
return t[1];
case "VSet":
- return '{' + t[1].map(function(v){return transform_default(v)})
+ '}';
+ return '{' + map(function(v){return transform_default(v)},
t[1]) + '}';
case "VMap":
- return '{' + t[1].map(function(v){return
transform_default(v[0]) + ' \u2192 ' + transform_default(v[1])}) + '}';
+ return '{' + map(function(v){return transform_default(v[0]) + '
\u2192 ' + transform_default(v[1])}, t[1]) + '}';
}
return 'Unknown[' + t + ']';
}
@@ -144,7 +144,7 @@
html += '<div><span class="inline-type">' +
(msg.msg_result != undefined ?
transform_type(msg.msg_result[0]) : 'void') +
'</span> <span class="field-name">' + name + '</span> <span
class="inline-params">(' +
- msg.msg_params.map(function(p){return
transform_type(p.param_type)}).join(', ') +
+ map(function(p){return transform_type(p.param_type)},
msg.msg_params).join(', ') +
')</span></div>';
html += '<div class="field-description">' + msg.msg_doc + '</div>';
@@ -191,11 +191,12 @@
function class_doc()
{
contents = clsdoc.contents;
- fields = contents.filter(function(f){return f[0] ==
"Field";}).map(function(f){return f[1];});
- fields.sort(function(a, b){return
a.field_name.toLowerCase().charCodeAt(0) -
b.field_name.toLowerCase().charCodeAt(0);});
+ fields = filter(function(f){return f[0] == "Field";}, contents);
+ fields = map(function(f){return f[1];}, fields);
+ fields.sort(function(a, b){return compare(a.field_name.toLowerCase(),
b.field_name.toLowerCase());});
messages = clsdoc.messages;
- messages = messages.filter(function(m){return m.msg_hide_from_docs ==
false;})
- messages.sort(function(a, b){return
a.msg_name.toLowerCase().charCodeAt(0) -
b.msg_name.toLowerCase().charCodeAt(0)});
+ 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())});
html = "";
html += '<input type="button" class="small-button" value="details"
onclick="showhide(document.getElementById(\'class_' + cls + '_details\'))" />';
@@ -248,9 +249,9 @@
else if (x.indexOf('message') > -1) return '2';
else return '3';
}
- a = change_to_num(a[0]) + element_to_num(a[0]) +
(a[1]+a[2]).toLowerCase();
- b = change_to_num(b[0]) + element_to_num(b[0]) +
(b[1]+b[2]).toLowerCase();
- return a > b;
+ x = change_to_num(a[0]) + element_to_num(a[0]) +
(a[1]+a[2]).toLowerCase();
+ y = change_to_num(b[0]) + element_to_num(b[0]) +
(b[1]+b[2]).toLowerCase();
+ return compare(x, y);
}
function release_doc()
@@ -288,7 +289,7 @@
{
html = '<h2 class="title">Classes</h2>';
- classes.sort(function(a, b){return a.toLowerCase().charCodeAt(0) -
b.toLowerCase().charCodeAt(0)});
+ classes.sort(function(a, b){return compare(a.toLowerCase(),
b.toLowerCase())});
for (i in classes) {
c = classes[i];
html += '<a href="?c=' + c + '">' + c + '</a><br>';
diff -r 47b046f1ac58 ocaml/doc/main.js
--- a/ocaml/doc/main.js
+++ b/ocaml/doc/main.js
@@ -47,3 +47,32 @@
obj.style.display = '';
}
+// functional stuff
+
+function filter(f, l)
+{
+ var x = [];
+ for (i in l) {
+ if (f(l[i]))
+ x.push(l[i]);
+ }
+ return x;
+}
+
+function map(f, l)
+{
+ var x = [];
+ for (i in l) {
+ x[i] = f(l[i]);
+ }
+ return x;
+}
+
+// compare function for sorting
+function compare(a, b)
+{
+ if (a < b) return -1;
+ if (a > b) return 1;
+ return 0;
+}
+
diff -r 47b046f1ac58 ocaml/doc/style.css
--- a/ocaml/doc/style.css
+++ b/ocaml/doc/style.css
@@ -64,6 +64,7 @@
}
#content {
+ color: black;
background-color: #ffffdd;
padding: 1.5em 1em;
margin: 0 22em 0 .5em;
@@ -118,17 +119,19 @@
font-size : 100%;
}
-#content h1, #content h2 {
- color: #900;
-}
+a, a:link, a:visited, a:active, a:hover { color : inherit; text-decoration:
none;}
+a:hover { color : inherit; text-decoration : underline }
+
+#sidebar a, #header a {color: white}
+#content a {color: black}
+
+#content h1, #content h2 {color: #900}
+#content h1 a {color: #900}
.title {
margin-top: 0;
}
-a, a:link, a:visited, a:active, a:hover { color : inherit; text-decoration:
none;}
-a:hover { color : inherit; text-decoration : underline }
-
hr {
border: 1px thin #666;
}
doc-ie-compat
Description: Text document
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|