-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paul-Elliot <[email protected]>
- Loading branch information
Showing
13 changed files
with
152 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{0 Package page} | ||
|
||
A {{!asset-"caml.gif"}reference} to an asset. | ||
|
||
And a reference using a page parent: {!page-other_page.asset-"caml_not.gif"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{0 Another page with an asset} | ||
|
||
Hello darkness my old {!asset-"caml.gif"}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
In this file, we test the resolving of asset references. | ||
|
||
More precisely we test resolving an an asset reference where the asset lives: | ||
- in the current page (index.mld references ocaml.gif) | ||
- in a parent page (test.mli references ocaml.gif) | ||
- in a sibling page (test.mli references ocaml_not.gif, through page-other_page.ocaml_not.gif) | ||
|
||
Compile the module first | ||
|
||
$ ocamlc -c -bin-annot test.mli | ||
|
||
Then we need to odoc-compile the package mld file, listing its | ||
children. If we omit the asset child, all assets reference resolving fail: | ||
|
||
$ odoc compile index.mld --child module-test --child page-other_page | ||
$ odoc compile other_page.mld -I . --parent index | ||
$ odoc compile test.cmti -I . --parent index | ||
$ for i in *.odoc; do odoc link -I . $i; done | ||
File "index.mld", line 5, characters 37-76: | ||
Warning: Failed to resolve reference unresolvedroot(other_page).caml_not.gif Couldn't find asset "caml_not.gif" | ||
File "index.mld", line 3, characters 2-32: | ||
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif" | ||
File "other_page.mld", line 3, characters 22-41: | ||
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif" | ||
File "test.mli", line 4, characters 39-78: | ||
Warning: Failed to resolve reference unresolvedroot(other_page).caml_not.gif Couldn't find asset "caml_not.gif" | ||
File "test.mli", line 2, characters 4-34: | ||
Warning: Failed to resolve reference unresolvedroot(caml.gif) Couldn't find asset "caml.gif" | ||
|
||
We should pass the asset as child of a page. | ||
|
||
$ odoc compile index.mld --child module-test --child asset-caml.gif --child page-other_page | ||
$ odoc compile test.cmti -I . --parent index | ||
$ odoc compile other_page.mld --child asset-caml_not.gif -I . --parent index | ||
|
||
Link and generate the HTML (forgetting the asset!): | ||
|
||
$ for i in *.odoc; do odoc link -I . $i; done | ||
$ for i in *.odocl; do odoc html-generate --indent $i -o html; done | ||
File "caml.gif": | ||
Warning: asset is missing. | ||
File "caml_not.gif": | ||
Warning: asset is missing. | ||
|
||
Note that the html links are correct (there are dead links due to missing assets) | ||
|
||
$ grep caml.gif html/index/index.html | ||
<p>A <a href="caml.gif" title="caml.gif">reference</a> to an asset.</p> | ||
$ grep caml_not.gif html/index/index.html | ||
<a href="other_page/caml_not.gif"><code>caml_not.gif</code></a> | ||
$ grep caml.gif html/index/Test/index.html | ||
<p>A <a href="../caml.gif" title="caml.gif">reference</a> to an asset</p> | ||
$ grep caml_not.gif html/index/Test/index.html | ||
<a href="../other_page/caml_not.gif"><code>caml_not.gif</code></a> | ||
$ grep caml.gif html/index/other_page/index.html | ||
<p>Hello darkness my old <a href="../caml.gif"><code>caml.gif</code></a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(** | ||
A {{!asset-"caml.gif"}reference} to an asset | ||
And a reference using a page parent: {!page-other_page.asset-"caml_not.gif"} | ||
*) |