Skip to content

Commit ffdfac8

Browse files
Octachronjonludlam
authored andcommitted
tune latex escaping rule for labels
1 parent b6223d8 commit ffdfac8

39 files changed

+361
-362
lines changed

src/latex/raw.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ module Escape = struct
4646
for i = 0 to String.length s - 1 do
4747
match s.[i] with
4848
| '~' -> Fmt.pf ppf "+t+"
49-
| '_' -> Fmt.pf ppf "+u+"
5049
| '+' -> Fmt.pf ppf "+++"
5150
| c -> Fmt.pf ppf "%c" c
5251
done
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
\section{Class \ocamlinlinecode{Bugs\_\allowbreak{}post\_\allowbreak{}406.\allowbreak{}let\_\allowbreak{}open'}}\label{module-Bugs+u+post+u+406-class-let+u+open'}%
1+
\section{Class \ocamlinlinecode{Bugs\_\allowbreak{}post\_\allowbreak{}406.\allowbreak{}let\_\allowbreak{}open'}}\label{module-Bugs_post_406-class-let_open'}%
22

33

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
\section{Module \ocamlinlinecode{Bugs\_\allowbreak{}post\_\allowbreak{}406}}\label{module-Bugs+u+post+u+406}%
1+
\section{Module \ocamlinlinecode{Bugs\_\allowbreak{}post\_\allowbreak{}406}}\label{module-Bugs_post_406}%
22
Let-open in class types, https://github.com/ocaml/odoc/issues/543 This was added to the language in 4.06
33

4-
\label{module-Bugs+u+post+u+406-class-type-let+u+open}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{type} \hyperref[module-Bugs+u+post+u+406-class-type-let+u+open]{\ocamlinlinecode{let\_\allowbreak{}open}}}\ocamlcodefragment{ = \ocamltag{keyword}{object}}\begin{ocamlindent}\end{ocamlindent}%
4+
\label{module-Bugs_post_406-class-type-let_open}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{type} \hyperref[module-Bugs_post_406-class-type-let_open]{\ocamlinlinecode{let\_\allowbreak{}open}}}\ocamlcodefragment{ = \ocamltag{keyword}{object}}\begin{ocamlindent}\end{ocamlindent}%
55
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
6-
\label{module-Bugs+u+post+u+406-class-let+u+open'}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Bugs+u+post+u+406-class-let+u+open']{\ocamlinlinecode{let\_\allowbreak{}open'}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
6+
\label{module-Bugs_post_406-class-let_open'}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Bugs_post_406-class-let_open']{\ocamlinlinecode{let\_\allowbreak{}open'}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
77

88
\input{Bugs_post_406.let_open'.tex}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
\section{Module \ocamlinlinecode{Bugs\_\allowbreak{}pre\_\allowbreak{}410}}\label{module-Bugs+u+pre+u+410}%
2-
\label{module-Bugs+u+pre+u+410-type-opt'}\ocamlcodefragment{\ocamltag{keyword}{type} 'a opt' = int option}\\
3-
\label{module-Bugs+u+pre+u+410-val-foo'}\ocamlcodefragment{\ocamltag{keyword}{val} foo' : ?bar:\ocamltag{type-var}{'a} \ocamltag{arrow}{$\rightarrow$} unit \ocamltag{arrow}{$\rightarrow$} unit}\begin{ocamlindent}Similar to \ocamlinlinecode{Bugs}, but the printed type of \ocamlinlinecode{\textasciitilde{}bar} should be \ocamlinlinecode{int}, not \ocamlinlinecode{'a}. This probably requires fixing in the compiler. See \href{https://github.com/ocaml/odoc/pull/230\#issuecomment-433226807}{https://github.com/ocaml/odoc/pull/230\#issuecomment-433226807}\footnote{\url{https://github.com/ocaml/odoc/pull/230\#issuecomment-433226807}}.\end{ocamlindent}%
1+
\section{Module \ocamlinlinecode{Bugs\_\allowbreak{}pre\_\allowbreak{}410}}\label{module-Bugs_pre_410}%
2+
\label{module-Bugs_pre_410-type-opt'}\ocamlcodefragment{\ocamltag{keyword}{type} 'a opt' = int option}\\
3+
\label{module-Bugs_pre_410-val-foo'}\ocamlcodefragment{\ocamltag{keyword}{val} foo' : ?bar:\ocamltag{type-var}{'a} \ocamltag{arrow}{$\rightarrow$} unit \ocamltag{arrow}{$\rightarrow$} unit}\begin{ocamlindent}Similar to \ocamlinlinecode{Bugs}, but the printed type of \ocamlinlinecode{\textasciitilde{}bar} should be \ocamlinlinecode{int}, not \ocamlinlinecode{'a}. This probably requires fixing in the compiler. See \href{https://github.com/ocaml/odoc/pull/230\#issuecomment-433226807}{https://github.com/ocaml/odoc/pull/230\#issuecomment-433226807}\footnote{\url{https://github.com/ocaml/odoc/pull/230\#issuecomment-433226807}}.\end{ocamlindent}%
44
\medbreak
55

66

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
\section{Class \ocamlinlinecode{Class.\allowbreak{}empty\_\allowbreak{}virtual'}}\label{module-Class-class-empty+u+virtual'}%
1+
\section{Class \ocamlinlinecode{Class.\allowbreak{}empty\_\allowbreak{}virtual'}}\label{module-Class-class-empty_virtual'}%
22

33

test/generators/latex/Class.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ \section{Module \ocamlinlinecode{Class}}\label{module-Class}%
77
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
88
\label{module-Class-class-mutually'}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Class-class-mutually']{\ocamlinlinecode{mutually'}}}\ocamlcodefragment{ : \hyperref[module-Class-class-type-mutually]{\ocamlinlinecode{mutually}}}\\
99
\label{module-Class-class-recursive'}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Class-class-recursive']{\ocamlinlinecode{recursive'}}}\ocamlcodefragment{ : \hyperref[module-Class-class-type-recursive]{\ocamlinlinecode{recursive}}}\\
10-
\label{module-Class-class-type-empty+u+virtual}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{type} \ocamltag{keyword}{virtual} \hyperref[module-Class-class-type-empty+u+virtual]{\ocamlinlinecode{empty\_\allowbreak{}virtual}}}\ocamlcodefragment{ = \ocamltag{keyword}{object}}\begin{ocamlindent}\end{ocamlindent}%
10+
\label{module-Class-class-type-empty_virtual}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{type} \ocamltag{keyword}{virtual} \hyperref[module-Class-class-type-empty_virtual]{\ocamlinlinecode{empty\_\allowbreak{}virtual}}}\ocamlcodefragment{ = \ocamltag{keyword}{object}}\begin{ocamlindent}\end{ocamlindent}%
1111
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
12-
\label{module-Class-class-empty+u+virtual'}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{virtual} \hyperref[module-Class-class-empty+u+virtual']{\ocamlinlinecode{empty\_\allowbreak{}virtual'}}}\ocamlcodefragment{ : \hyperref[module-Class-class-type-empty]{\ocamlinlinecode{empty}}}\\
12+
\label{module-Class-class-empty_virtual'}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{virtual} \hyperref[module-Class-class-empty_virtual']{\ocamlinlinecode{empty\_\allowbreak{}virtual'}}}\ocamlcodefragment{ : \hyperref[module-Class-class-type-empty]{\ocamlinlinecode{empty}}}\\
1313
\label{module-Class-class-type-polymorphic}\ocamlcodefragment{\ocamltag{keyword}{class} \ocamltag{keyword}{type} 'a \hyperref[module-Class-class-type-polymorphic]{\ocamlinlinecode{polymorphic}}}\ocamlcodefragment{ = \ocamltag{keyword}{object}}\begin{ocamlindent}\end{ocamlindent}%
1414
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
1515
\label{module-Class-class-polymorphic'}\ocamlcodefragment{\ocamltag{keyword}{class} 'a \hyperref[module-Class-class-polymorphic']{\ocamlinlinecode{polymorphic'}}}\ocamlcodefragment{ : \ocamltag{type-var}{'a} \hyperref[module-Class-class-type-polymorphic]{\ocamlinlinecode{polymorphic}}}\\
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
\section{Class \ocamlinlinecode{Class\_\allowbreak{}comments.\allowbreak{}c}}\label{module-Class+u+comments-class-c}%
2-
\ocamlcodefragment{\ocamltag{keyword}{inherit} \hyperref[module-Class+u+comments-class-x]{\ocamlinlinecode{x}}}\begin{ocamlindent}Inherit.\end{ocamlindent}%
1+
\section{Class \ocamlinlinecode{Class\_\allowbreak{}comments.\allowbreak{}c}}\label{module-Class_comments-class-c}%
2+
\ocamlcodefragment{\ocamltag{keyword}{inherit} \hyperref[module-Class_comments-class-x]{\ocamlinlinecode{x}}}\begin{ocamlindent}Inherit.\end{ocamlindent}%
33
\medbreak
44
\ocamlcodefragment{ \ocamltag{keyword}{constraint} \ocamltag{type-var}{'a} = int}\begin{ocamlindent}Constraint.\end{ocamlindent}%
55
\medbreak
66
Floating comment.
77

8-
\label{module-Class+u+comments-class-c-method-bar}\ocamlcodefragment{\ocamltag{keyword}{method} bar : int}\\
8+
\label{module-Class_comments-class-c-method-bar}\ocamlcodefragment{\ocamltag{keyword}{method} bar : int}\\
99

1010

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
\section{Module \ocamlinlinecode{Class\_\allowbreak{}comments}}\label{module-Class+u+comments}%
2-
\label{module-Class+u+comments-class-x}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Class+u+comments-class-x]{\ocamlinlinecode{x}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
3-
\label{module-Class+u+comments-class-c}\ocamlcodefragment{\ocamltag{keyword}{class} 'a \hyperref[module-Class+u+comments-class-c]{\ocamlinlinecode{c}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
1+
\section{Module \ocamlinlinecode{Class\_\allowbreak{}comments}}\label{module-Class_comments}%
2+
\label{module-Class_comments-class-x}\ocamlcodefragment{\ocamltag{keyword}{class} \hyperref[module-Class_comments-class-x]{\ocamlinlinecode{x}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
3+
\label{module-Class_comments-class-c}\ocamlcodefragment{\ocamltag{keyword}{class} 'a \hyperref[module-Class_comments-class-c]{\ocamlinlinecode{c}}}\ocamlcodefragment{ : \ocamltag{keyword}{object} .\allowbreak{}.\allowbreak{}.\allowbreak{} \ocamltag{keyword}{end}}\\
44

55
\input{Class_comments.x.tex}
66
\input{Class_comments.c.tex}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
\section{Class \ocamlinlinecode{Class\_\allowbreak{}comments.\allowbreak{}x}}\label{module-Class+u+comments-class-x}%
1+
\section{Class \ocamlinlinecode{Class\_\allowbreak{}comments.\allowbreak{}x}}\label{module-Class_comments-class-x}%
22

33

test/generators/latex/Functor.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ \section{Module \ocamlinlinecode{Functor}}\label{module-Functor}%
33
\end{ocamlindent}%
44
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
55
\label{module-Functor-module-type-S1}\ocamlcodefragment{\ocamltag{keyword}{module} \ocamltag{keyword}{type} \hyperref[module-Functor-module-type-S1]{\ocamlinlinecode{S1}}}\ocamlcodefragment{ = \ocamltag{keyword}{sig}}\begin{ocamlindent}\subsubsection{Parameters\label{parameters}}%
6-
\label{module-Functor-module-type-S1-argument-1-+u+}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Functor-module-type-S1-argument-1-+u+]{\ocamlinlinecode{\_\allowbreak{}}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\label{module-Functor-module-type-S1-argument-1-+u+-type-t}\ocamlcodefragment{\ocamltag{keyword}{type} t}\\
6+
\label{module-Functor-module-type-S1-argument-1-_}\ocamlcodefragment{\ocamltag{keyword}{module} \hyperref[module-Functor-module-type-S1-argument-1-_]{\ocamlinlinecode{\_\allowbreak{}}}}\ocamlcodefragment{ : \ocamltag{keyword}{sig}}\begin{ocamlindent}\label{module-Functor-module-type-S1-argument-1-_-type-t}\ocamlcodefragment{\ocamltag{keyword}{type} t}\\
77
\end{ocamlindent}%
88
\ocamlcodefragment{\ocamltag{keyword}{end}}\\
99
\subsubsection{Signature\label{signature}}%

0 commit comments

Comments
 (0)