File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -1151,10 +1151,31 @@ module Odoc_html_args = struct
11511151 let doc = " Remap an identifier to an external URL." in
11521152 Arg. (value & opt_all convert_remap [] & info [ " R" ] ~doc )
11531153
1154+ let remap_file =
1155+ let doc = " File containing remap rules." in
1156+ Arg. (value & opt (some file) None & info ~docv: " FILE" ~doc [ " remap-file" ])
1157+
11541158 let extra_args =
11551159 let config semantic_uris closed_details indent theme_uri support_uri
1156- search_uris flat as_json remap =
1160+ search_uris flat as_json remap remap_file =
11571161 let open_details = not closed_details in
1162+ let remap =
1163+ match remap_file with
1164+ | None -> remap
1165+ | Some f ->
1166+ let ic = open_in f in
1167+ let rec loop acc =
1168+ match input_line ic with
1169+ | exception _ ->
1170+ close_in ic;
1171+ acc
1172+ | line -> (
1173+ match Astring.String. cut ~sep: " :" line with
1174+ | Some (orig , mapped ) -> loop ((orig, mapped) :: acc)
1175+ | None -> loop acc)
1176+ in
1177+ loop []
1178+ in
11581179 let html_config =
11591180 Odoc_html.Config. v ~theme_uri ~support_uri ~search_uris ~semantic_uris
11601181 ~indent ~flat ~open_details ~as_json ~remap ()
@@ -1163,7 +1184,7 @@ module Odoc_html_args = struct
11631184 in
11641185 Term. (
11651186 const config $ semantic_uris $ closed_details $ indent $ theme_uri
1166- $ support_uri $ search_uri $ flat $ as_json $ remap)
1187+ $ support_uri $ search_uri $ flat $ as_json $ remap $ remap_file )
11671188end
11681189
11691190module Odoc_html = Make_renderer (Odoc_html_args )
Original file line number Diff line number Diff line change 1+ prefix/otherpkg/:https://mysite.org/bar/
2+ prefix/:https://mysite.org/foo/
3+
Original file line number Diff line number Diff line change @@ -25,3 +25,9 @@ The order shouldn't matter, the longest prefix ought to win
2525 $ grep Otherlib/ index . html _html3/ prefix / mypkg/ Test / index . html _html4/ prefix / mypkg/ Test / index . html
2626 _html3/ prefix / mypkg/ Test / index . html: <a href="https://mysite.org/bar/Otherlib/index.html#type-t" >Otherlib. t
2727 _html4/ prefix / mypkg/ Test / index . html: <a href="https://mysite.org/bar/Otherlib/index.html#type-t" >Otherlib. t
28+
29+ $ odoc html-generate -o _html5 -- indent _odoc/ prefix / mypkg/ test. odocl -- remap-file remap. txt
30+ $ grep Otherlib/ index . html _html5/ prefix / mypkg/ Test / index . html
31+ <a href="https://mysite.org/bar/Otherlib/index.html#type-t" >Otherlib. t
32+
33+
You can’t perform that action at this time.
0 commit comments