This commit is contained in:
John Whitington 2024-07-01 17:30:32 +01:00
parent 4b59f3e4ae
commit 4a3f830202
1 changed files with 7 additions and 2 deletions

View File

@ -302,6 +302,11 @@ let matterhorn_09_005 st st2 pdf =
(* A TOC-related structure element is used in a way that does not conform to (* A TOC-related structure element is used in a way that does not conform to
Table 333 in ISO 32000-1. *) Table 333 in ISO 32000-1. *)
let print_children (E (n, cs)) =
Printf.printf "%S: " n;
iter (fun (E (n, _)) -> Printf.printf "%S " n) cs;
flprint "\n"
(* We test two things: a) everything under a TOC is correct; and b) There is no (* We test two things: a) everything under a TOC is correct; and b) There is no
TOCI except under a TOC. *) TOCI except under a TOC. *)
let matterhorn_09_006 st st2 pdf = let matterhorn_09_006 st st2 pdf =
@ -319,13 +324,13 @@ let matterhorn_09_006 st st2 pdf =
let rec check_toc_toci = function let rec check_toc_toci = function
| E ("/TOC", cs) -> | E ("/TOC", cs) ->
if if
List.exists (function E (("/TOC " | "/TOCI"), _) -> false | _ -> true) cs List.exists (function E (("/TOC" | "/TOCI"), _) -> false | _ -> true) cs
then then
merror_str "/TOC children must be /TOC or /TOCI"; merror_str "/TOC children must be /TOC or /TOCI";
iter check_toc_toci cs iter check_toc_toci cs
| E ("/TOCI", cs) -> | E ("/TOCI", cs) ->
if if
List.exists (function E (("/TOC " | "/Lbl" | "/Reference" | "/P" | "/NonStruct"), _) -> false | _ -> true) cs List.exists (function E (("/TOC" | "/Lbl" | "/Reference" | "/P" | "/NonStruct"), _) -> false | _ -> true) cs
then then
merror_str "Bad child of /TOCI"; merror_str "Bad child of /TOCI";
iter check_toc_toci cs iter check_toc_toci cs