Signed-off-by: Rob Hoes <[email protected]>
ocaml/doc/apidoc.html | 86 ++++++++++++++++++++ ocaml/doc/apidoc.js | 207 +++++++++++++++++++++++++++++++++++++++++++++++++ ocaml/doc/codedoc.html | 52 ++++++++++++ ocaml/doc/index.html | 32 ++---- ocaml/doc/jsapi.ml | 2 +- ocaml/doc/main.js | 49 +++++++++++ ocaml/doc/ocamldoc.js | 68 +++------------- ocaml/doc/style.css | 24 +++++ 8 files changed, 443 insertions(+), 77 deletions(-)
# HG changeset patch # User Rob Hoes <[email protected]> # Date 1274793987 -3600 # Node ID 7dedd3aba112c1653bbb22b7d057978a06bd6357 # Parent 16c80b1f9915e5955a3978d687464e4a5c8def0d Integrate API docs with OCamlDoc web interface Signed-off-by: Rob Hoes <[email protected]> diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/apidoc.html --- /dev/null +++ b/ocaml/doc/apidoc.html @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>OCamlDoc</title> + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> + <script type="text/javascript" src="main.js"></script> + <script type="text/javascript" src="api/index.json"></script> + <script type="text/javascript" src="apidoc.js"></script> + <script> + if (cls != "") + document.write('<script src="api/', cls, '.json" type="text/JavaScript"><\/script>'); + </script> + <link rel="stylesheet" href="style.css" /> + </head> + <body onload="build();"> + <div id="wrap"> + <div id="header"> + <h1 style="float:left"><a href="index.html" style="text-decoration: none"> + Xapi – XenAPI Documentation + </a></h1> + <ul id="menu"> + <li><a href="apidoc.html">XenAPI Docs</a></li> + <li><a href="codedoc.html">Code Docs</a></li> + </ul> + </div> + <div id="main"> + <div id="container"><div id="content"> + <h1 class="title">XenAPI Classes</h1> + <p>Click on a class to view the associated fields and messages.</p> + + <img src="classes.png" usemap="#graph" border="0" /> + <map id="graph" name="graph"> + <area shape="poly" href="?c=task" title="an asynchronous server-side task" alt="" coords="408,233 406,227 402,222 395,217 387,214 378,213 369,214 360,217 354,222 349,227 348,233 349,240 354,245 360,250 369,252 378,253 387,252 395,250 402,245 406,240"/> + <area shape="poly" href="?c=event" title="allows event registration and reading" alt="" coords="408,296 406,289 402,284 395,279 387,277 378,276 369,277 360,279 354,284 349,289 348,296 349,302 354,307 360,312 369,315 378,316 387,315 395,312 402,307 406,302"/> + <area shape="poly" href="?c=pool" title="a Resource Pool" alt="" coords="470,78 469,72 464,66 458,62 449,59 440,58 431,59 422,62 416,66 411,72 410,78 411,84 416,90 422,94 431,97 440,98 449,97 458,94 464,90 469,84"/> + <area shape="rect" href="?c=session" title="an authenticated session" alt="" coords="92,211,152,251"/> + <area shape="rect" href="?c=user" title="a user" alt="" coords="6,201,66,241"/> + <area shape="rect" href="?c=host" title="a physical host" alt="" coords="187,223,247,263"/> + <area shape="rect" href="?c=VM" title="a Virtual Machine" alt="" coords="508,279,568,319"/> + <area shape="poly" href="?c=VM_metrics" title="dynamic VM configuration information" alt="" coords="673,301 671,295 665,289 656,285 644,282 631,281 618,282 607,285 597,289 591,295 589,301 591,307 597,313 607,317 618,320 631,321 644,320 656,317 665,313 671,307"/> + <area shape="poly" href="?c=VM_guest_metrics" title="dynamic information from inside the guest" alt="" coords="670,360 667,354 658,348 645,344 628,341 610,340 592,341 575,344 562,348 553,354 550,360 553,366 562,372 575,376 592,379 610,380 628,379 645,376 658,372 667,366"/> + <area shape="poly" href="?c=crashdump" title="VM crashdump" alt="" coords="650,246 648,239 642,234 633,229 622,227 609,226 596,227 585,229 576,234 570,239 568,246 570,252 576,257 585,262 596,265 609,266 622,265 633,262 642,257 648,252"/> + <area shape="poly" href="?c=console" title="location information for a guest's console" alt="" coords="590,387 589,380 584,375 577,370 569,368 559,367 549,368 540,370 533,375 529,380 527,387 529,393 533,398 540,403 549,406 559,407 569,406 577,403 584,398 589,393"/> + <area shape="rect" href="?c=PBD" title="the connection between an SR and a host" alt="" coords="244,147,304,187"/> + <area shape="poly" href="?c=host_metrics" title="dynamic host information" alt="" coords="202,307 199,300 193,295 183,290 170,288 156,287 141,288 128,290 118,295 112,300 109,307 112,313 118,318 128,323 141,326 156,327 170,326 183,323 193,318 199,313"/> + <area shape="poly" href="?c=host_cpu" title="a physical CPU on a host" alt="" coords="206,164 204,158 199,153 191,148 182,145 171,144 160,145 151,148 143,153 138,158 136,164 138,171 143,176 151,181 160,183 171,184 182,183 191,181 199,176 204,171"/> + <area shape="rect" href="?c=network" title="an ethernet network" alt="" coords="331,331,391,371"/> + <area shape="rect" href="?c=VIF" title="a network interface for a Virtual Machine" alt="" coords="423,334,483,374"/> + <area shape="poly" href="?c=VIF_metrics" title="IO stats and configuration information for a virtual interface" alt="" coords="498,451 496,445 490,439 481,435 470,432 457,431 444,432 432,435 423,439 417,445 415,451 417,457 423,463 432,467 444,470 457,471 470,470 481,467 490,463 496,457"/> + <area shape="rect" href="?c=PIF" title="a network interface for a physical host" alt="" coords="241,306,301,346"/> + <area shape="poly" href="?c=PIF_metrics" title="IO stats and configuration information for a physical interface" alt="" coords="274,412 272,406 266,400 257,396 245,393 232,392 219,393 208,396 198,400 193,406 191,412 193,418 198,424 208,428 219,431 232,432 245,431 257,428 266,424 272,418"/> + <area shape="rect" href="?c=SR" title="Storage Repository, a container for virtual disk images (VDIs)" alt="" coords="323,97,383,137"/> + <area shape="rect" href="?c=VDI" title="a virtual disk image" alt="" coords="412,124,472,164"/> + <area shape="poly" href="?c=SM" title="storage manager plugin module" alt="" coords="377,26 375,19 371,14 364,9 356,7 347,6 337,7 329,9 322,14 318,19 317,26 318,32 322,37 329,42 337,45 347,46 356,45 364,42 371,37 375,32"/> + <area shape="rect" href="?c=VBD" title="a virtual block device" alt="" coords="486,181,546,221"/> + <area shape="poly" href="?c=VBD_metrics" title="IO stats and configuration information for a virtual block device" alt="" coords="623,128 620,122 614,116 604,112 592,109 578,108 564,109 551,112 541,116 535,122 533,128 535,134 541,140 551,144 564,147 578,148 592,147 604,144 614,140 620,134"/> + </map> + <h1>Classes, Fields and Messages</h1> + <p>Classes have both <i>fields</i> and <i>messages.</i> Messages are either <i>implicit</i> or <i>explicit</i> where an implicit message is one of:</p> + <ul> + <li> a constructor (usually called "create");</li> + <li> a destructor (usually called "destroy");</li> + <li> "get_by_name_label";</li> + <li> "get_by_uuid"</li> + <li> "get_record"; and</li> + <li> "get_all".</li> + </ul> + <p>Explicit messages include all the rest, more class-specific messages (e.g. "VM.start", "VM.clone")</p> + <p>Every field has at least one <i>accessor</i> depending both on its type and whether it is read-only or read-write. Accessors for a field named "X" would be a proper subset of:</p> + <ul> + <li> set_X: change the value of field X (only if it is read-write);</li> + <li> get_X: retrieve the value of field X;</li> + <li> add_to_X: add a key/value pair (only if field has type set or map); and</li> + <li> remove_from_X: remove a key (only if a field has type set or map).</li> + </ul> + + </p> + </div></div> + <div id="sidebar"></div> + <div id="footer"></div> + </div> + </div> + </body> +</html> + diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/apidoc.js --- /dev/null +++ b/ocaml/doc/apidoc.js @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2006-2009 Citrix Systems Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +// global variables + +var cls = getQuerystring('c'); + +function qualifier(q) +{ + if (q == 'DynamicRO' || q == 'StaticRO') + return 'read-only'; + else + return 'read/write'; +} + +function transform_type(t) +{ + switch (t) { + case "String": + case "Int": + case "Float": + case "Bool": + case "DateTime": + return t.toLowerCase(); + } + + switch (t[0]) { + case "Ref": + return '<a href="?c=' + t[1] + '">' + t[1] + '</a> ref'; + case "Record": + return t[1] + ' record'; + case "Enum": + return t[1]; + case "Set": + return transform_type(t[1]) + ' set'; + case "Map": + return '(' + transform_type(t[1]) + ' \u2192 ' + transform_type(t[2]) + ') map'; + } + return 'Unknown[' + t + ']'; +} + +function transform_default(t) +{ + switch (t[0]) { + case "VString": + return '"' + t[1] + '"'; + case "VInt": + case "VFloat": + case "VBool": + case "VDateTime": + case "VEnum": + return t[1]; + case "VRef": + return (t[1] == "" ? "Null" : t[1]); + case "VRecord": + return t[1] + ' record'; + return t[1]; + case "VSet": + return '{' + t[1].map(function(v){return transform_default(v)}) + '}'; + case "VMap": + return '{' + t[1].map(function(v){return transform_default(v[0]) + ' \u2192 ' + transform_default(v[1])}) + '}'; + } + return 'Unknown[' + t + ']'; +} + +function make_field(fld, n) +{ + name = fld.field_name; + + html = ""; + html = '<div class="field' + toggle(n) + '">'; + html += '<input type="button" class="small-button" value="details" onclick="showhide(document.getElementById(\'' + name + '_details\'))" />'; + html += '<div><span class="inline-type">' + transform_type(fld.ty) + '</span> <span class="field-name">' + name + '</span> <span class="inline-qualifier">[' + qualifier(fld.qualifier) + ']</span></div>'; + + html += '<div id="' + name + '_details" style="display: none">'; + html += '<div class="field-description">' + fld.field_description + '</div>'; + + html += '<table class="field-table">'; + if (fld.release != undefined) { + html += '<tr><td width="130px"><span class="field-head">Introduced in:</span></td><td>' + fld.release.internal[1] + '</td></tr>'; + if (fld.release.internal_deprecated_since != undefined) + html += '<tr><td width="130px"><span class="field-head">Deprecated since:</span></td><td>' + fld.release.internal_deprecated_since + '</td></tr>'; + } + if (fld.default_value != undefined) + html += '<tr><td width="130px"><span class="field-head">Default value:</span></td><td>' + transform_default(fld.default_value) + '</td></tr>'; + + html += '</table>'; + html += '</div></div>'; + + return html; +} + +function make_message(msg, n) +{ + name = msg.msg_name; + + html = ""; + + html += '<div class="field' + toggle(n) + '">'; + html += '<input type="button" class="small-button" value="details" onclick="showhide(document.getElementById(\'' + name + '_details\'))" />'; + 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(', ') + + ')</span></div>'; + + html += '<div class="field-description">' + msg.msg_doc + '</div>'; + + html += '<div id="' + name + '_details" style="display: none">'; + html += '<table class="field-table">'; + + html += '<tr id="' + name + '_params"><td width="130px"><span class="field-head">Parameters:</span></td><td>'; + html += '<table>'; + for (i in msg.msg_params) { + p = msg.msg_params[i]; + html += '<tr><td style="padding: 0 .4em 0 0">' + transform_type(p.param_type) + ' ' + p.param_name + '</td>'; + html += '<td style="padding: 0 0 0 .4em">' + p.param_doc + '</td></tr>'; + } + html += '</table></td></tr>'; + + html += '<tr><td><span class="field-head">Minimum role:</span></td><td>' + msg.msg_allowed_roles[msg.msg_allowed_roles.length - 1] + '</td></tr>'; + if (msg.msg_result != undefined) + html += '<tr><td><span class="field-head">Result:</span></td><td>' + msg.msg_result[1] + '</td></tr>'; + if (msg.msg_errors != undefined && msg.msg_errors.length > 0) { + html += '<tr><td><span class="field-head">Errors:</span></td><td>' + html += '<table>'; + for (i in msg.msg_errors) { + e = msg.msg_errors[i]; + html += '<tr><td style="padding: 0 .4em 0 0">' + e.err_name + '</td>'; + html += '<td style="padding: 0 0 0 .4em">' + e.err_doc + '</td></tr>'; + } + html += '</table></td></tr>'; + } + if (msg.msg_release != undefined) { + html += '<tr><td><span class="field-head">Introduced in:</span></td><td>' + msg.msg_release.internal[1] + '</td></tr>'; + if (msg.msg_release.internal_deprecated_since != undefined) + html += '<tr><td><span class="field-head">Deprecated since:</span></td><td>' + msg.msg_release.internal_deprecated_since + '</td></tr>'; + } + html += '</table>'; + + html += '</div></div>'; + + return html; +} + +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);}); + 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)}); + + html = ""; + html += '<h1 class="title">Class: ' + cls + '</h1>\n'; + + html += '<div class="description">' + clsdoc.description + '</div>'; + + html += '<h2>Fields</h2>'; + if (fields.length > 0) { + for (i in fields) + html += make_field(fields[i], i); + } + else + html += '<p>None.</p>'; + + html += '<h2>Messages</h2>'; + if (messages.length > 0) { + for (i in messages) + html += make_message(messages[i], i); + } + else + html += '<p>None.</p>'; + + set_content(html); +} + +function build() +{ + html = ""; + html = '<h2 class="title">Classes</h2>'; + + classes.sort(function(a, b){return a.toLowerCase().charCodeAt(0) - b.toLowerCase().charCodeAt(0)}); + for (i in classes) { + c = classes[i]; + html += '<a href="?c=' + c + '">' + c + '</a><br>'; + } + + append_sidebar(html); + + if (cls != "") { + class_doc(); + } +} + diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/codedoc.html --- /dev/null +++ b/ocaml/doc/codedoc.html @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> + <head> + <title>OCamlDoc</title> + <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> + <script type="text/javascript" src="main.js"></script> + <script type="text/javascript" src="components.js"></script> + <script type="text/javascript" src="ocamldoc.js"></script> + <script> + for (z in components) + document.write('<script src="content/', components[z], '/index.json" type="text/JavaScript"><\/script>'); + if (component != "" && module != "") + document.write('<script src="content/', component, '/', module_chain[0], '.json" type="text/JavaScript"><\/script>'); + </script> + <link rel="stylesheet" href="style.css" /> + </head> + <body onload="build();"> + <div id="wrap"> + <div id="header"> + <h1 style="float:left"><a href="index.html" style="text-decoration: none"> + Xapi – OCaml Code Documentation + </a></h1> + <ul id="menu"> + <li><a href="apidoc.html">XenAPI Docs</a></li> + <li><a href="codedoc.html">Code Docs</a></li> + </ul> + </div> + <div id="main"> + <div id="container"><div id="content"> + <h1 class="title">Introduction</h1> + <p>These pages contain source documentation of the main libraries and executables related to xapi. The documentation is automatically generated from the OCaml source files via a custom generator for <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html" target="_blank">OCamlDoc</a>. Below is a list of all components that are covered, the most important one being the <a href="codedoc.html?c=xapi">xapi</a> executable itself. Clicking on a component name will bring up an overview of the OCaml modules contained in it. Clicking further will reveal the internals of a module.</p> + <p>The OCaml source code contains special comments that are displayed in the documentation, which explain the use of modules, functions etc. We are working hard to add such comments wherever they are needed, but a lot of work still needs to be done. We encourage everyone who contributes to xapi to help out and include good documentation! :)</p> + <p>Details on how to generate the documentation yourself, and how to properly document the source code, are described on <a href="http://wiki.xensource.com/xenwiki/OCaml_Doc" target="_blank">this</a> wiki page.</p> + </div></div> + <div id="sidebar"> + <div id="sidemenu"> + <!--h2 class="title">Menu</h2--> + <script> + if (module != "") { + document.write('<a href="codedoc.html?c=' + component + '">Module Index</a><br>'); + } + </script> + <a href="#" onclick="search_page()">Search</a> + </div> + </div> + <div id="footer"></div> + </div> + </div> + </body> +</html> + diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/index.html --- a/ocaml/doc/index.html +++ b/ocaml/doc/index.html @@ -2,38 +2,28 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> - <title>OCamlDoc</title> + <title>Xapi Toolstack</title> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> - <script type="text/javascript" src="components.js"></script> - <script type="text/javascript" src="ocamldoc.js"></script> - <script> - for (z in components) - document.write('<script src="content/', components[z], '/index.json" type="text/JavaScript"><\/script>'); - if (component != "" && module != "") - document.write('<script src="content/', component, '/', module_chain[0], '.json" type="text/JavaScript"><\/script>'); - </script> <link rel="stylesheet" href="style.css" /> </head> <body onload="build();"> <div id="wrap"> <div id="header"> - <h1 style="float:left">Xapi – OCaml Code Documentation</h1> + <h1 style="float:left">Xapi Toolstack Documentation</h1> <ul id="menu"> - <script> - document.write('<li><a href="index.html">Component Index</a></li>'); - if (component != "") { - document.write('<li><a href="index.html?c=' + component + '">Module Index</a></li>'); - } - document.write('<li><a href="#" onclick="search_page()">Search</a></li>'); - </script> + <li><a href="apidoc.html">XenAPI Docs</a></li> + <li><a href="codedoc.html">Code Docs</a></li> </ul> </div> <div id="main"> <div id="container"><div id="content"> - <h1 class="title">Introduction</h1> - <p>These web pages contain source documentation of the main libraries and executables related to xapi. The documentation is automatically generated from the OCaml source files via a custom generator for <a href="http://caml.inria.fr/pub/docs/manual-ocaml/manual029.html" target="_blank">OCamlDoc</a>. Below is a list of all components that are covered, the most important one being the <a href="index.html?c=xapi">xapi</a> executable itself. Clicking on a component name will bring up an overview of the OCaml modules contained in it. Clicking further will reveal the internals of a module.</p> - <p>The OCaml source code contains special comments that are displayed in the documentation, which explain the use of modules, functions etc. We are working hard to add such comments wherever they are needed, but a lot of work still needs to be done. We encourage everyone who contributes to xapi to help out and include good documentation! :)</p> - <p>Details on how to generate the documentation yourself, and how to properly document the source code, are described on <a href="http://wiki.xensource.com/xenwiki/OCaml_Doc" target="_blank">this</a> wiki page.</p> + <h1 class="title">Welcome</h1> + <p>These pages contain documentation of the Xapi toolstack, part of the Xen Cloud Platform, and the API it provides. + <ul> + <li><a href="apidoc.html">XenAPI Documentation</a></li> + <li><a href="codedoc.html">Xapi Code Documentation</a></li> + </ul> + <p>The documentation is automatically generated from comments in the source code. </div></div> <div id="sidebar"></div> <div id="footer"></div> diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/jsapi.ml --- a/ocaml/doc/jsapi.ml +++ b/ocaml/doc/jsapi.ml @@ -18,7 +18,7 @@ let create_json obj = let name = obj.Datamodel_types.name in let s = Jsonrpc.to_string (Datamodel_types.rpc_of_obj obj) in - Unixext.write_string_to_file ("api/" ^ name ^ ".json") s; + Unixext.write_string_to_file ("api/" ^ name ^ ".json") ("clsdoc = " ^ s); name in let names = List.map create_json objs in diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/main.js --- /dev/null +++ b/ocaml/doc/main.js @@ -0,0 +1,49 @@ +// function from http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx +function getQuerystring(key, default_) +{ + if (default_ == null) default_ = ""; + key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); + var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); + var qs = regex.exec(window.location.href); + if (qs == null) + return default_; + else + return qs[1]; +} + +function set_content(html) +{ + document.getElementById('content').innerHTML = html; +} + +function append_content(html) +{ + document.getElementById('content').innerHTML += html; +} + +function set_sidebar(html) +{ + document.getElementById('sidebar').innerHTML = html; +} + +function append_sidebar(html) +{ + document.getElementById('sidebar').innerHTML += html; +} + +function toggle(i) +{ + if (i % 2 == 0) + return "" + else + return "2" +} + +function showhide(obj) +{ + if (obj.style.display == '') + obj.style.display = 'none'; + else + obj.style.display = ''; +} + diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/ocamldoc.js --- a/ocaml/doc/ocamldoc.js +++ b/ocaml/doc/ocamldoc.js @@ -25,19 +25,6 @@ var root = '/bind/myrepos/'; var code_url = 'http://xenbits.xen.org/xapi/'; - -// function from http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx -function getQuerystring(key, default_) -{ - if (default_ == null) default_ = ""; - key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); - var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); - var qs = regex.exec(window.location.href); - if (qs == null) - return default_; - else - return qs[1]; -} function fill_components() { @@ -59,7 +46,7 @@ for (y in component_modules[c]) { m = component_modules[c][y].name; if (m.toLowerCase().indexOf(query) > -1) - html += '<a href="index.html?c=' + c + '&m=' + m + '">' + m + ' (' + c + ')</a><br/>'; + html += '<a href="codedoc.html?c=' + c + '&m=' + m + '">' + m + ' (' + c + ')</a><br/>'; } } @@ -101,19 +88,11 @@ return ""; } -function toggle(i) -{ - if (i % 2 == 0) - return "" - else - return "2" -} - function construct_url(mod, fn) { comp = find_component_for_module(mod.split('.')[0]); if (comp != "") - return 'index.html?c=' + comp + '&m=' + mod + '#' + fn; + return 'codedoc.html?c=' + comp + '&m=' + mod + '#' + fn; else return '#'; } @@ -161,7 +140,7 @@ html = '<div class="field' + toggle(n) + '">'; if (v.params.length > 0) - html += '<input type="button" class="small-button" value="show parameters" onclick="document.getElementById(\'' + name + '_params\').style.display=\'\';" />'; + html += '<input type="button" class="small-button" value="parameters" onclick="showhide(document.getElementById(\'' + name + '_params\'))" />'; html += '<div class="field-type"><a name="' + name + '">[value]</a></div>'; html += '<div class="field-name">' + name + '</div>'; @@ -309,7 +288,7 @@ name = l[l.length - 1]; html = '<div class="field' + toggle(n) + '">'; - html += '<input type="button" class="small-button" value="show details" onclick="location=\'index.html?c=' + component + '&m=' + v.name + '\'" />'; + html += '<input type="button" class="small-button" value="show details" onclick="location=\'codedoc.html?c=' + component + '&m=' + v.name + '\'" />'; html += '<div class="field-type"><a name="' + name + '">[module]</a></div>'; html += '<div class="field-name">' + name + '</div>'; html += '<div class="field-description">'; @@ -418,7 +397,7 @@ uses = deps.uses.sort(); - html = '<h2 class="title">Dependencies</h2>'; + html = '<h2>Dependencies</h2>'; html += '<h3>Uses</h3>'; for (i in uses) { c = find_component_for_module(uses[i]) @@ -443,14 +422,13 @@ function moduledoc(mod) { - set_sidebar(""); make_dependencies(mod.dependencies); html = ""; html += '<h1 class="title">Module: '; chain = []; for (i in module_chain) - chain[i] = '<a href="index.html?c=' + component + + chain[i] = '<a href="codedoc.html?c=' + component + '&m=' + module_chain.slice(0,i+1).join('.') + '">' + module_chain[i] + '</a>'; html += chain.join('.') + '</h1>\n'; @@ -551,7 +529,7 @@ // Sidebar - html = '<h2 class="title">Module Groups</h2>'; + html = '<h2>Module Groups</h2>'; if (group_names.length > 0) { for (i in group_names) html += '<a href="#' + group_names[i] + '">' + group_names[i] + '</a><br />'; @@ -570,7 +548,7 @@ html += '<h3>Libraries</h3>'; for (i in libs) { if (libraries.indexOf(libs[i]) > -1) - html += '<a href="index.html?c=' + libs[i] + '">' + libs[i] + '</a><br />'; + html += '<a href="codedoc.html?c=' + libs[i] + '">' + libs[i] + '</a><br />'; else html += '<span class="grey">' + libs[i] + '</span><br />'; } @@ -582,13 +560,13 @@ html += '<h3>Packages</h3>'; for (i in packs) { if (packages.indexOf(packs[i]) > -1) - html += '<a href="index.html?c=' + packs[i] + '">' + packs[i] + '</a><br />'; + html += '<a href="codedoc.html?c=' + packs[i] + '">' + packs[i] + '</a><br />'; else html += '<span class="grey">' + packs[i] + '</span><br />'; } } - set_sidebar(html); + append_sidebar(html); } function component_index() @@ -602,7 +580,7 @@ stats = component_stats[executables[i]]; total_descr_cnt += stats.descr_cnt; total_completed_descr_cnt += stats.completed_descr_cnt; - html += '<a href="index.html?c=' + executables[i] + '">' + executables[i] + '</a>'; + html += '<a href="codedoc.html?c=' + executables[i] + '">' + executables[i] + '</a>'; html += ' <span class="stat">(' + Math.round(100 * stats.completed_descr_cnt / stats.descr_cnt) + '\%)</span><br />'; } @@ -610,7 +588,7 @@ libraries.sort() for (i in libraries) { stats = component_stats[libraries[i]]; - html += '<a href="index.html?c=' + libraries[i] + '">' + libraries[i] + '</a>'; + html += '<a href="codedoc.html?c=' + libraries[i] + '">' + libraries[i] + '</a>'; html += ' <span class="stat">(' + Math.round(100 * stats.completed_descr_cnt / stats.descr_cnt) + '\%)</span><br />'; } @@ -618,7 +596,7 @@ packages.sort() for (i in packages) { stats = component_stats[packages[i]]; - html += '<a href="index.html?c=' + packages[i] + '">' + packages[i] + '</a>'; + html += '<a href="codedoc.html?c=' + packages[i] + '">' + packages[i] + '</a>'; html += ' <span class="stat">(' + Math.round(100 * stats.completed_descr_cnt / stats.descr_cnt) + '\%)</span><br />'; } @@ -654,23 +632,3 @@ } } -function set_content(html) -{ - document.getElementById('content').innerHTML = html; -} - -function append_content(html) -{ - document.getElementById('content').innerHTML += html; -} - -function set_sidebar(html) -{ - document.getElementById('sidebar').innerHTML = html; -} - -function append_sidebar(html) -{ - document.getElementById('sidebar').innerHTML += html; -} - diff -r 16c80b1f9915 -r 7dedd3aba112 ocaml/doc/style.css --- a/ocaml/doc/style.css +++ b/ocaml/doc/style.css @@ -161,6 +161,16 @@ text-decoration: none; } +#sidemenu { + padding-top: 1em; + padding-bottom: 1em; +// border-bottom: 1px solid white; + font-size: 1em; + text-align: center; + font-weight: bold; + background-color: #ee4400; +} + .grey { color: #ccc; } @@ -250,6 +260,20 @@ padding: .3em .5em .3em 0; } +.inline-type { + margin-right: .5em; +} + +.inline-qualifier { + font-size: 70%; + vertical-align: top; + margin-left: .5em; +} + +.inline-params { + margin-left: .5em; +} + .small-button { font-size: 70%; // text-align: right;
_______________________________________________ xen-api mailing list [email protected] http://lists.xensource.com/mailman/listinfo/xen-api
