Skip to content

Commit

Permalink
Rename and clarify 'pp_disambiguating_prefix'
Browse files Browse the repository at this point in the history
Co-authored-by: Paul-Elliot <[email protected]>
  • Loading branch information
Julow and panglesd committed Sep 4, 2024
1 parent 67d8eae commit e8329f9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/document/url.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module Path = struct

let pp_kind fmt kind = Format.fprintf fmt "%s" (string_of_kind kind)

let pp_kind_prefix_for_output fmt = function
let pp_disambiguating_prefix fmt = function
| `Module | `Page | `LeafPage | `File | `SourcePage -> ()
| kind -> Format.fprintf fmt "%s-" (string_of_kind kind)

Expand Down
5 changes: 3 additions & 2 deletions src/document/url.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ module Path : sig

val string_of_kind : kind -> string

val pp_kind_prefix_for_output : Format.formatter -> kind -> unit
(** Print the ["kind-"] prefix used in output files. *)
val pp_disambiguating_prefix : Format.formatter -> kind -> unit
(** Print the ["kind-"] prefix used to disambiguate urls in "flat modes":
e.g. latex labels and output files in [--flat] HTML and man output *)

type t = { kind : kind; parent : t option; name : string }

Expand Down
2 changes: 1 addition & 1 deletion src/html/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ end

module Page = struct
let on_sub = function
| `Page _ -> None
| `Pge _ -> None
| `Include x -> (
match x.Include.status with
| `Closed | `Open | `Default -> None
Expand Down
2 changes: 1 addition & 1 deletion src/html/link.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Path = struct
let for_printing url = List.map snd @@ Url.Path.to_list url

let segment_to_string (kind, name) =
Format.asprintf "%a%s" Url.Path.pp_kind_prefix_for_output kind name
Format.asprintf "%a%s" Url.Path.pp_disambiguating_prefix kind name

let is_leaf_page url = url.Url.Path.kind = `LeafPage

Expand Down
2 changes: 1 addition & 1 deletion src/latex/generator.ml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Link = struct
| None -> ()
in
Format.fprintf ppf "%a%a%s" pp_parent x.parent
Url.Path.pp_kind_prefix_for_output x.kind x.name
Url.Path.pp_disambiguating_prefix x.kind x.name

let page p = Format.asprintf "%a" flatten_path p

Expand Down
2 changes: 1 addition & 1 deletion src/manpage/link.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ open Odoc_document
let for_printing url = List.map snd @@ Url.Path.to_list url

let segment_to_string (kind, name) =
Format.asprintf "%a%s" Url.Path.pp_kind_prefix_for_output kind name
Format.asprintf "%a%s" Url.Path.pp_disambiguating_prefix kind name

let as_filename ?(add_ext = true) (url : Url.Path.t) =
let components = Url.Path.to_list url in
Expand Down

0 comments on commit e8329f9

Please sign in to comment.