Skip to content

Commit ced94e3

Browse files
sim642jonludlam
authored andcommitted
Add test for tag content linking
1 parent 6e0932b commit ced94e3

File tree

8 files changed

+224
-0
lines changed

8 files changed

+224
-0
lines changed

test/generators/cases/tag_link.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let foo = ()
2+
3+
(** @deprecated {!foo}
4+
@param foo {!foo}
5+
@raise Foo {!foo}
6+
@return {!foo}
7+
@see "foo" {!foo}
8+
@before 0.0.1 {!foo} *)

test/generators/html/Tag_link.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head><title>Tag_link (Tag_link)</title>
4+
<link rel="stylesheet" href="odoc.css"/><meta charset="utf-8"/>
5+
<meta name="generator" content="odoc %%VERSION%%"/>
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
7+
<script src="highlight.pack.js"></script>
8+
<script>hljs.initHighlightingOnLoad();</script>
9+
</head>
10+
<body class="odoc">
11+
<header class="odoc-preamble">
12+
<h1>Module <code><span>Tag_link</span></code></h1>
13+
</header>
14+
<div class="odoc-content">
15+
<div class="odoc-spec">
16+
<div class="spec value anchored" id="val-foo">
17+
<a href="#val-foo" class="anchor"></a>
18+
<code><span><span class="keyword">val</span> foo : unit</span></code>
19+
</div>
20+
</div>
21+
<ul class="at-tags">
22+
<li class="deprecated"><span class="at-tag">deprecated</span>
23+
<p><a href="#val-foo"><code>foo</code></a></p>
24+
</li>
25+
</ul>
26+
<ul class="at-tags">
27+
<li class="parameter"><span class="at-tag">parameter</span>
28+
<span class="value">foo</span>
29+
<p><a href="#val-foo"><code>foo</code></a></p>
30+
</li>
31+
</ul>
32+
<ul class="at-tags">
33+
<li class="raises"><span class="at-tag">raises</span>
34+
<span class="value">Foo</span>
35+
<p><a href="#val-foo"><code>foo</code></a></p>
36+
</li>
37+
</ul>
38+
<ul class="at-tags">
39+
<li class="returns"><span class="at-tag">returns</span>
40+
<p><a href="#val-foo"><code>foo</code></a></p>
41+
</li>
42+
</ul>
43+
<ul class="at-tags">
44+
<li class="see"><span class="at-tag">see</span>
45+
<span class="value">foo</span>
46+
<p><a href="#val-foo"><code>foo</code></a></p>
47+
</li>
48+
</ul>
49+
<ul class="at-tags">
50+
<li class="before"><span class="at-tag">before</span>
51+
<span class="value">0.0.1</span>
52+
<p><a href="#val-foo"><code>foo</code></a></p>
53+
</li>
54+
</ul>
55+
</div>
56+
</body>
57+
</html>

test/generators/html/tag_link.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tag_link.html

test/generators/latex/Tag_link.tex

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
\section{Module \ocamlinlinecode{Tag\_\allowbreak{}link}}\label{module-Tag+u+link}%
2+
\label{module-Tag+u+link-val-foo}\ocamlcodefragment{\ocamltag{keyword}{val} foo : unit}\\
3+
\begin{description}\kern-\topsep
4+
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
5+
\item[{deprecated}]{\hyperref[module-Tag+u+link-val-foo]{\ocamlinlinecode{\ocamlinlinecode{foo}}[p\pageref*{module-Tag+u+link-val-foo}]}
6+
7+
}\end{description}%
8+
\begin{description}\kern-\topsep
9+
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
10+
\item[{parameter foo}]{\hyperref[module-Tag+u+link-val-foo]{\ocamlinlinecode{\ocamlinlinecode{foo}}[p\pageref*{module-Tag+u+link-val-foo}]}
11+
12+
}\end{description}%
13+
\begin{description}\kern-\topsep
14+
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
15+
\item[{raises Foo}]{\hyperref[module-Tag+u+link-val-foo]{\ocamlinlinecode{\ocamlinlinecode{foo}}[p\pageref*{module-Tag+u+link-val-foo}]}
16+
17+
}\end{description}%
18+
\begin{description}\kern-\topsep
19+
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
20+
\item[{returns}]{\hyperref[module-Tag+u+link-val-foo]{\ocamlinlinecode{\ocamlinlinecode{foo}}[p\pageref*{module-Tag+u+link-val-foo}]}
21+
22+
}\end{description}%
23+
\begin{description}\kern-\topsep
24+
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
25+
\item[{see foo}]{\hyperref[module-Tag+u+link-val-foo]{\ocamlinlinecode{\ocamlinlinecode{foo}}[p\pageref*{module-Tag+u+link-val-foo}]}
26+
27+
}\end{description}%
28+
\begin{description}\kern-\topsep
29+
\makeatletter\advance\@topsepadd-\topsep\makeatother% topsep is hardcoded
30+
\item[{before 0.0.1}]{\hyperref[module-Tag+u+link-val-foo]{\ocamlinlinecode{\ocamlinlinecode{foo}}[p\pageref*{module-Tag+u+link-val-foo}]}
31+
32+
}\end{description}%
33+
34+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tag_link.tex

test/generators/link.dune.inc

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,21 @@
467467
(action
468468
(run odoc link -o %{target} %{dep:stop_first_comment.odoc})))
469469

470+
(rule
471+
(target tag_link.cmt)
472+
(action
473+
(run ocamlc -c -bin-annot -o %{target} %{dep:cases/tag_link.ml})))
474+
475+
(rule
476+
(target tag_link.odoc)
477+
(action
478+
(run odoc compile -o %{target} %{dep:tag_link.cmt})))
479+
480+
(rule
481+
(target tag_link.odocl)
482+
(action
483+
(run odoc link -o %{target} %{dep:tag_link.odoc})))
484+
470485
(rule
471486
(target toplevel_comments.cmti)
472487
(action
@@ -6572,6 +6587,84 @@
65726587
(action
65736588
(diff stop_first_comment.targets stop_first_comment.targets.gen))))
65746589

6590+
(subdir
6591+
html
6592+
(rule
6593+
(targets Tag_link.html.gen)
6594+
(action
6595+
(run
6596+
odoc
6597+
html-generate
6598+
--indent
6599+
--flat
6600+
--extra-suffix
6601+
gen
6602+
-o
6603+
.
6604+
%{dep:../tag_link.odocl})))
6605+
(rule
6606+
(alias runtest)
6607+
(action
6608+
(diff Tag_link.html Tag_link.html.gen))))
6609+
6610+
(subdir
6611+
html
6612+
(rule
6613+
(action
6614+
(with-outputs-to
6615+
tag_link.targets.gen
6616+
(run odoc html-targets -o . %{dep:../tag_link.odocl} --flat))))
6617+
(rule
6618+
(alias runtest)
6619+
(action
6620+
(diff tag_link.targets tag_link.targets.gen))))
6621+
6622+
(subdir
6623+
latex
6624+
(rule
6625+
(targets Tag_link.tex.gen)
6626+
(action
6627+
(run odoc latex-generate -o . --extra-suffix gen %{dep:../tag_link.odocl})))
6628+
(rule
6629+
(alias runtest)
6630+
(action
6631+
(diff Tag_link.tex Tag_link.tex.gen))))
6632+
6633+
(subdir
6634+
latex
6635+
(rule
6636+
(action
6637+
(with-outputs-to
6638+
tag_link.targets.gen
6639+
(run odoc latex-targets -o . %{dep:../tag_link.odocl}))))
6640+
(rule
6641+
(alias runtest)
6642+
(action
6643+
(diff tag_link.targets tag_link.targets.gen))))
6644+
6645+
(subdir
6646+
man
6647+
(rule
6648+
(targets Tag_link.3o.gen)
6649+
(action
6650+
(run odoc man-generate -o . --extra-suffix gen %{dep:../tag_link.odocl})))
6651+
(rule
6652+
(alias runtest)
6653+
(action
6654+
(diff Tag_link.3o Tag_link.3o.gen))))
6655+
6656+
(subdir
6657+
man
6658+
(rule
6659+
(action
6660+
(with-outputs-to
6661+
tag_link.targets.gen
6662+
(run odoc man-targets -o . %{dep:../tag_link.odocl}))))
6663+
(rule
6664+
(alias runtest)
6665+
(action
6666+
(diff tag_link.targets tag_link.targets.gen))))
6667+
65756668
(subdir
65766669
html
65776670
(rule

test/generators/man/Tag_link.3o

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
.TH Tag_link 3 "" "Odoc" "OCaml Library"
3+
.SH Name
4+
Tag_link
5+
.SH Synopsis
6+
.sp
7+
.in 2
8+
\fBModule Tag_link\fR
9+
.in
10+
.sp
11+
.SH Documentation
12+
.sp
13+
.nf
14+
\f[CB]val\fR foo : unit
15+
.sp
16+
.fi
17+
@deprecated: \f[CI]foo\fR
18+
.br
19+
@parameter foo: \f[CI]foo\fR
20+
.br
21+
@raises Foo: \f[CI]foo\fR
22+
.br
23+
@returns: \f[CI]foo\fR
24+
.br
25+
@see foo: \f[CI]foo\fR
26+
.br
27+
@before 0\.0\.1: \f[CI]foo\fR
28+
.nf
29+

test/generators/man/tag_link.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tag_link.3o

0 commit comments

Comments
 (0)