|
| 1 | +A page can have source children. |
| 2 | + |
| 3 | + $ odoc compile -c module-a -c module-b -c src-source root.mld |
| 4 | + |
| 5 | + $ printf "lib/main.ml\nlib/b/b.ml\nlib/a/a.ml\n" > source.map |
| 6 | + $ odoc source-tree -I . --parent page-root source.map |
| 7 | + |
| 8 | +Compile the modules: |
| 9 | + |
| 10 | + $ ocamlc -c lib/a/a.ml -bin-annot |
| 11 | + $ ocamlc -c lib/b/b.ml -bin-annot |
| 12 | + $ ocamlc -c lib/main.ml -bin-annot |
| 13 | + |
| 14 | +Now, compile the pages with the --source option. The source-name must be included in the source-children of the source-parent: |
| 15 | + |
| 16 | + $ odoc compile -I . --source-name lib/a/a.ml --source-parent-file src-source.odoc lib/a/a.cmt |
| 17 | + $ odoc compile -I . --source-name lib/b/b.ml --source-parent-file src-source.odoc lib/b/b.cmt |
| 18 | + $ odoc compile -I . --source-name lib/main.ml --source-parent-file src-source.odoc lib/main.cmt |
| 19 | + $ odoc link -I . -I lib/a -I lib/b -I lib page-root.odoc |
| 20 | + $ odoc link -I . lib/a/a.odoc |
| 21 | + $ odoc link -I . lib/b/b.odoc |
| 22 | + $ odoc link -I . lib/main.odoc |
| 23 | + $ odoc link -I . src-source.odoc |
| 24 | + $ odoc html-generate --indent -o html page-root.odocl |
| 25 | + $ odoc html-generate --indent -o html src-source.odocl |
| 26 | + $ odoc html-generate --source-root . --indent -o html lib/a/a.odocl |
| 27 | + $ odoc html-generate --source-root . --indent -o html lib/b/b.odocl |
| 28 | + $ odoc html-generate --source-root . --indent -o html lib/main.odocl |
| 29 | + |
| 30 | +Source pages and source directory pages are generated: |
| 31 | + |
| 32 | + $ find html | sort |
| 33 | + html |
| 34 | + html/A |
| 35 | + html/A/index.html |
| 36 | + html/B |
| 37 | + html/B/index.html |
| 38 | + html/Main |
| 39 | + html/Main/index.html |
| 40 | + html/root |
| 41 | + html/root/index.html |
| 42 | + html/root/source |
| 43 | + html/root/source/index.html |
| 44 | + html/root/source/lib |
| 45 | + html/root/source/lib/a |
| 46 | + html/root/source/lib/a/a.ml.html |
| 47 | + html/root/source/lib/a/index.html |
| 48 | + html/root/source/lib/b |
| 49 | + html/root/source/lib/b/b.ml.html |
| 50 | + html/root/source/lib/b/index.html |
| 51 | + html/root/source/lib/index.html |
| 52 | + html/root/source/lib/main.ml.html |
| 53 | + |
| 54 | +A directory simply list its children: |
| 55 | + |
| 56 | + $ cat html/root/source/lib/index.html |
| 57 | + <!DOCTYPE html> |
| 58 | + <html xmlns="http://www.w3.org/1999/xhtml"> |
| 59 | + <head><title>lib (root.source.lib)</title> |
| 60 | + <link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/> |
| 61 | + <meta name="generator" content="odoc %%VERSION%%"/> |
| 62 | + <meta name="viewport" content="width=device-width,initial-scale=1.0"/> |
| 63 | + <script src="../../../highlight.pack.js"></script> |
| 64 | + <script>hljs.initHighlightingOnLoad();</script> |
| 65 | + </head> |
| 66 | + <body class="odoc"> |
| 67 | + <nav class="odoc-nav"><a href="../index.html">Up</a> – |
| 68 | + <a href="../../index.html">root</a> » |
| 69 | + <a href="../index.html">source</a> » lib |
| 70 | + </nav><header class="odoc-preamble"></header> |
| 71 | + <div class="odoc-content"><h1>./lib/</h1> |
| 72 | + <ul class="odoc-folder-list"> |
| 73 | + <li><span class="odoc-directory"><a href="a/index.html">a</a></span></li> |
| 74 | + <li><span class="odoc-directory"><a href="b/index.html">b</a></span></li> |
| 75 | + <li><span class="odoc-file"><a href="main.ml.html">main.ml</a></span> |
| 76 | + </li> |
| 77 | + </ul> |
| 78 | + </div> |
| 79 | + </body> |
| 80 | + </html> |
0 commit comments