Skip to content
Snippets Groups Projects
Commit 7bfe9929 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

[output] work around a pandoc/latex issue over anchors' names

parent 34619b9f
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,13 @@ let insert_remark_opt env anchor placeholder = ...@@ -10,6 +10,13 @@ let insert_remark_opt env anchor placeholder =
let insert_remark env anchor = insert_remark_opt env anchor [] let insert_remark env anchor = insert_remark_opt env anchor []
(* apparently, pandoc, or at least its latex output,
does not like anchors beginning with _ *)
let sanitize_anchor s =
if s = "" then "a"
else if s.[0] = '_' then "a" ^ s
else s
let all_eva_domains = let all_eva_domains =
[ "-eva-apron-box", "box domain of the Apron library"; [ "-eva-apron-box", "box domain of the Apron library";
"-eva-apron-oct", "octagon domain of the Apron library"; "-eva-apron-oct", "octagon domain of the Apron library";
...@@ -104,10 +111,11 @@ let section_stubs env = ...@@ -104,10 +111,11 @@ let section_stubs env =
(fun s -> String.length s <> 0 && s.[0] <> '@' && s.[0] <> '-') (fun s -> String.length s <> 0 && s.[0] <> '@' && s.[0] <> '-')
(fun s -> (fun s ->
let kf = Globals.Functions.find_by_name s in let kf = Globals.Functions.find_by_name s in
let anchor = sanitize_anchor s in
let content = let content =
if env.is_draft then insert_marks env s if env.is_draft then insert_marks env anchor
else begin else begin
let comment = insert_remark env s in let comment = insert_remark env anchor in
Block Block
[ Text [ Text
[Inline_code s; Plain "has the following specification"]; [Inline_code s; Plain "has the following specification"];
...@@ -116,14 +124,15 @@ let section_stubs env = ...@@ -116,14 +124,15 @@ let section_stubs env =
:: comment :: comment
end end
in in
H4 ([Inline_code s], Some s) :: content) H4 ([Inline_code s], Some anchor) :: content)
l l
in in
let describe_func kf = let describe_func kf =
let name = Kernel_function.get_name kf in let name = Kernel_function.get_name kf in
let anchor = sanitize_anchor name in
let loc = Kernel_function.get_location kf in let loc = Kernel_function.get_location kf in
let content = let content =
if env.is_draft then insert_marks env name if env.is_draft then insert_marks env anchor
else else
(Block (Block
[ Text [ Text
...@@ -134,9 +143,9 @@ let section_stubs env = ...@@ -134,9 +143,9 @@ let section_stubs env =
Printer.pp_global Printer.pp_global
(GFun (Kernel_function.get_definition kf,loc)) (GFun (Kernel_function.get_definition kf,loc))
]) ])
:: insert_remark env name :: insert_remark env anchor
in in
H4 ([Inline_code name], Some name) :: content H4 ([Inline_code name], Some anchor) :: content
in in
let content = let content =
if stubbed_kf <> [] then begin if stubbed_kf <> [] then begin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment