|
|
|
|
|
|
|
|
|
|
xen-api
[Xen-API] [PATCH] [ocamldoc] Links to source code on module pages
# HG changeset patch
# User Rob Hoes <rob.hoes@xxxxxxxxxx>
[ocamldoc] Links to source code on module pages
Signed-off-by: Rob Hoes <rob.hoes@xxxxxxxxxx>
diff -r 22784973b624 ocaml/doc/ocamldoc.js
--- a/ocaml/doc/ocamldoc.js Wed Jan 13 12:13:48 2010 +0000
+++ b/ocaml/doc/ocamldoc.js Wed Jan 13 15:56:30 2010 +0000
@@ -19,10 +19,12 @@
var component = getQuerystring('c');
var components = executables.concat(libraries).concat(packages);
-var component_modules = {}
-var component_stats = {}
-var component_deps = {}
+var component_modules = {};
+var component_stats = {};
+var component_deps = {};
+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_)
@@ -452,12 +454,30 @@
'&m=' + module_chain.slice(0,i+1).join('.') + '">' +
module_chain[i] + '</a>';
html += chain.join('.') + '</h1>\n';
- html += '<div class="defined">Defined in ' + mod.file + ' (' +
component + ')</div>';
+
html += '<div class="description">';
if (mod.info.description != undefined)
html += mod.info.description + '</div>';
else
html += '<span class="empty">to be completed!</span></div>';
+
+ html += '<div class="defined"><table class="field-table">';
+ html += '<tr><td><b>Component</b>:</td><td><a href="?c=' + component +
'">' + component + '</td><td> </td></tr>';
+ r = new RegExp(root + '([^\|]*)\|\d*');
+ if (mod.location.interface != 'unknown') {
+ if_file = r.exec(mod.location.interface)[1];
+ x = /([\.\-\w]*)\/([^\|]*)/.exec(if_file);
+ url = code_url + x[1] + '?raw-file/tip/' + x[2];
+ html += '<tr><td><b>Interface file:</b></td><td><a href="' +
url + '" target="_blank">' + if_file + '</a></td></tr>';
+ }
+ if (mod.location.implementation != 'unknown') {
+ im_file = r.exec(mod.location.implementation)[1];
+ x = /([\.\-\w]*)\/([^\|]*)/.exec(im_file);
+ url = code_url + x[1] + '?raw-file/tip/' + x[2];
+ html += '<tr><td><b>Implementation file:</b></td><td><a href="'
+ url + '" target="_blank">' + im_file + '</a></td></tr>';
+ }
+ html += '</table></div>';
+
set_content(html);
if (mod.module_structure != undefined)
diff -r 22784973b624 ocaml/doc/odoc_json.ml
--- a/ocaml/doc/odoc_json.ml Wed Jan 13 12:13:48 2010 +0000
+++ b/ocaml/doc/odoc_json.ml Wed Jan 13 15:56:30 2010 +0000
@@ -132,18 +132,21 @@
let escape_json s =
let len = String.length s in
- let buf = Buffer.create len in
- for i = 0 to len - 1 do
- match s.[i] with
- | '\"' -> Buffer.add_string buf "\\\""
- | '\\' -> Buffer.add_string buf "\\\\"
- | '\b' -> Buffer.add_string buf "\\b"
- | '\n' -> Buffer.add_string buf "\\n"
- | '\r' -> Buffer.add_string buf "\\r"
- | '\t' -> Buffer.add_string buf "\\t"
- | c -> Buffer.add_char buf c
- done;
- Buffer.contents buf
+ if len > 0 then begin
+ let buf = Buffer.create len in
+ for i = 0 to len - 1 do
+ match s.[i] with
+ | '\"' -> Buffer.add_string buf "\\\""
+ | '\\' -> Buffer.add_string buf "\\\\"
+ | '\b' -> Buffer.add_string buf "\\b"
+ | '\n' -> Buffer.add_string buf "\\n"
+ | '\r' -> Buffer.add_string buf "\\r"
+ | '\t' -> Buffer.add_string buf "\\t"
+ | c -> Buffer.add_char buf c
+ done;
+ Buffer.contents buf
+ end
+ else ""
type json =
| Object of (string * json) list
diff -r 22784973b624 ocaml/doc/style.css
--- a/ocaml/doc/style.css Wed Jan 13 12:13:48 2010 +0000
+++ b/ocaml/doc/style.css Wed Jan 13 15:56:30 2010 +0000
@@ -187,8 +187,9 @@
}
.defined {
- font-style: italic;
margin: 1em 0;
+ padding: 0 .5em;
+ background-color: #ffcc66;
}
.description {
doc-code
Description: Text document
_______________________________________________
xen-api mailing list
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-API] [PATCH] [ocamldoc] Links to source code on module pages,
Rob Hoes <=
|
|
|
|
|