1- Blablabla
2- 
3-   $  cat  index . mld
4-   {0  Package page}
5-   
6-   Some image: 
7-   {% html :  <img src="img.jpg" / >% }
8- 
9- And we'll have a module  that  we'll put  underneath this package  page . 
10- 
11-   $  cat  test. mli
12-   (**  Humpf, let 's try  accessing the asset: 
13-     {% html :  <img src="../img.jpg" / >% }
14-     * )
15-   
16-   (**  Nevermind * )
17-   type t
18-   
19- 
20- 
21- 
22- 
231
242Compile the module  first 
253
@@ -32,83 +10,15 @@ Then we need to odoc-compile the package mld file, listing its children
3210
3311  $  odoc compile-asset -- name img -- parent-id page-test -- output-dir odoc
3412
35-   $  ls
36-   index . mld
37-   odoc
38-   page-index. odoc
39-   test. cmi
40-   test. cmti
41-   test. mli
42- 
43-   $  ls odoc
44-   page-test
45- 
46-   $  ls odoc/ page-test
47-   asset-img. odoc
48- 
49- 
50- This will  have produced a file called ' page-index.odoc' . 
51- Now we can  odoc-compile the module  odoc  file passing that file as  parent. 
52- 
53-   $  odoc compile test. cmti -I .  -- parent index 
54- 
55- Link and  generate the HTML (forgetting the asset! ): 
56- 
57-   $  for  i in *. odoc; do  odoc link  -I .  $ i ; done 
58-   $  for  i in *. odocl; do  odoc html-generate $ i  -o  html; done 
59-   File " img.jpg" : 
60-   Warning:  asset is  missing. 
61- 
62- Note that the html was generated despite the missing asset (there might be dead refs! )
63- 
64-   $  find html -type f |  sort 
65-   html/ index / Test / index . html
66-   html/ index / index . html
67- 
68- Which matches the output of  the targets command (which emits no  warning): 
69- 
70-   $  odoc html-targets page-index. odocl -o  html
71-   html/ index / index . html
72- 
73- Trying to  pass  an asset which doesn't exist: 
74- (also:  some sed magic due to  cmdliner output changing based on the version)
75- 
76-   $  odoc html-generate page-index. odocl -- asset img. jpg -o  html 2 > &1 |  \
77-   >  sed ' s/…/.../'   |  sed " s/\`/'/g" 
78-   odoc:  option ' --asset' :  no  ' img.jpg'   file or  directory
79-   Usage:  odoc html-generate [OPTION]...  FILE. odocl
80-   Try ' odoc html-generate --help'   or  ' odoc --help'   for  more information. 
81- 
82- Creating then passing the asset alongside an incorrect one : 
83- 
84-   $  touch img. jpg
85-   $  odoc html-generate page-index. odocl -- asset img. jpg -- asset test. mli -o  html
86-   File " test.mli" : 
87-   Warning:  this asset was not  declared as  a child of  index 
88- 
89- This time , the asset should have been copied at the right place: 
90- 
91-   $  find html -type f |  sort 
92-   html/ index / Test / index . html
93-   html/ index / img. jpg
94-   html/ index / index . html
95- 
96- Which once  again matches the output of  the targets command (still no  warning! ): 
97- 
98-   $  odoc html-targets page-index. odocl -- asset img. jpg -- asset test. mli -o  html
99-   html/ index / index . html
100-   html/ index / img. jpg
101- 
102- Let's make  sure the manpage and  latex renderers " work"   too
103- 
104-   $  for  i in *. odocl; do  odoc man-generate $ i  -o  man; odoc latex-generate $ i  -o  latex; done 
105- 
106-   $  find man -type f |  sort 
107-   man/ index . 3o
108-   man/ index / Test . 3o
109- 
110-   $  find latex -type f |  sort 
111-   latex/ index . tex
112-   latex/ index / Test . tex
113- 
114- Notice that the assets are * not *  there.  This should probably be fixed for  the latex backend. 
13+   $  tree 
14+   . 
15+   | --  index . mld ->  .. / .. / .. / .. / .. / .. / default / test/ pages/ new_assets. t/ index . mld
16+   | --  odoc
17+   |    `--  page-test
18+   |        `--  asset-img. odoc
19+   | --  page-index. odoc
20+   | --  test. cmi
21+   | --  test. cmti
22+   `--  test. mli ->  .. / .. / .. / .. / .. / .. / default / test/ pages/ new_assets. t/ test. mli
23+   
24+   3  directories, 6  files
0 commit comments