# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
# Date 1257330033 0
# Node ID 8828db3bbdf94804a1ffad02fb65876a729d9b92
# Parent 024f541bfe08116a6291e1bc97bf3de0985734dc
[ocamldoc] Initial search functionality: searching module names
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/index.html
--- a/ocaml/doc/index.html Wed Nov 04 10:20:33 2009 +0000
+++ b/ocaml/doc/index.html Wed Nov 04 10:20:33 2009 +0000
@@ -8,7 +8,8 @@
<script>
for (z in components)
document.write('<script src="content/',
components[z], '/index.json" type="text/JavaScript"><\/script>');
- document.write('<script src="content/', component, '/',
module_chain[0], '.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>
@@ -19,7 +20,10 @@
<ul id="menu">
<script>
document.write('<li><a
href="index.html">Component Index</a></li>');
- document.write('<li><a
href="index.html?c=' + component + '">Module 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>
</ul>
</div>
diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/ocamldoc.js
--- a/ocaml/doc/ocamldoc.js Wed Nov 04 10:20:33 2009 +0000
+++ b/ocaml/doc/ocamldoc.js Wed Nov 04 10:20:33 2009 +0000
@@ -53,6 +53,41 @@
component_modules[components[i]] = eval('modules_' +
components[i].replaceAll('-', ''));
component_deps[components[i]] = eval('deps_' +
components[i].replaceAll('-', ''));
}
+}
+
+function do_search()
+{
+ query = document.getElementById('search_box').value.toLowerCase();
+
+ // search modules
+ html = '<h2>Modules</h2>';
+ for (z in components) {
+ c = components[z];
+ 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/>';
+ }
+ }
+
+ document.getElementById('results').innerHTML = html;
+}
+
+function search_key(event)
+{
+ if (event.keyCode == 13)
+ do_search();
+}
+
+function search_page()
+{
+ html = "";
+ html += '<h1 class="title">Search</h1>';
+ html += '<input type="text" id="search_box" size="50"
onkeydown="search_key(event)" /><input type="button" value="Find"
onclick="do_search()" />';
+ html += '<div id="results"></div>';
+ set_content(html);
+
+ set_sidebar("");
}
function find_component_for_module(m)
@@ -132,8 +167,8 @@
html += '<table>';
for (c in v.params) {
n = v.params[c].name;
- html += '<tr><td width="20%">' + (n == "" ? '(no name)' :
v.params[c].name) + '</td>';
- html += '<td>' + v.params[c].type + '</td></tr>';
+ html += '<tr><td width="20%" style="padding: 0 0 .2em">' + (n
== "" ? '(no name)' : v.params[c].name) + '</td>';
+ html += '<td style="padding: 0 0 .2em">' + v.params[c].type +
'</td></tr>';
}
html += '</table>';
html += '</td></tr>';
@@ -278,7 +313,7 @@
function comment(m)
{
- append_content(m);
+ append_content('<div>' + m + '</div>');
}
function parse_structure(structure)
diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/odoc_json.ml
--- a/ocaml/doc/odoc_json.ml Wed Nov 04 10:20:33 2009 +0000
+++ b/ocaml/doc/odoc_json.ml Wed Nov 04 10:20:33 2009 +0000
@@ -1,4 +1,3 @@
-
(* Copyright (C) 2009 Citrix Systems Inc.
*)
(* Copyright (C) 2005 Institut National de Recherche en Informatique et
*)
(* en Automatique.
*)
diff -r 024f541bfe08 -r 8828db3bbdf9 ocaml/doc/style.css
--- a/ocaml/doc/style.css Wed Nov 04 10:20:33 2009 +0000
+++ b/ocaml/doc/style.css Wed Nov 04 10:20:33 2009 +0000
@@ -155,7 +155,7 @@
}
#menu li a {
-padding: 15px 0 0 20px;
+padding: 15px 0 0 2em;
font-size: 1.3em;
font-weight: bold;
}
@@ -238,9 +238,8 @@
margin: .7em 0;
}
-.field-table {
-// margin-left: 3em;
-// width: 90%;
+.field-table td {
+ padding: .3em 0;
}
.small-button {
xen-api.hg-3.patch
Description: Text Data
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|