mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
Figure check
This commit is contained in:
17
cpdfua.ml
17
cpdfua.ml
@@ -46,14 +46,17 @@ let read_a pdf stnode =
|
|||||||
| Some _ -> []
|
| Some _ -> []
|
||||||
| None -> []
|
| None -> []
|
||||||
in
|
in
|
||||||
(* For now, stick /ID, /Alt in here too. *)
|
(* For now, stick /ID, /Alt, /ActualText in here too. Eventually, move to prevent crashes. *)
|
||||||
let alt =
|
let alt =
|
||||||
match Pdf.lookup_direct pdf "/Alt" stnode with | Some _ -> ["/Alt"] | None -> []
|
match Pdf.lookup_direct pdf "/Alt" stnode with | Some _ -> ["/Alt"] | None -> []
|
||||||
in
|
in
|
||||||
let id =
|
let id =
|
||||||
match Pdf.lookup_direct pdf "/ID" stnode with | Some _ -> ["/ID"] | None -> []
|
match Pdf.lookup_direct pdf "/ID" stnode with | Some _ -> ["/ID"] | None -> []
|
||||||
in
|
in
|
||||||
from_a @ id @ alt
|
let at =
|
||||||
|
match Pdf.lookup_direct pdf "/ActualText" stnode with | Some _ -> ["/ActualText"] | None -> []
|
||||||
|
in
|
||||||
|
from_a @ id @ at @ alt
|
||||||
|
|
||||||
let rec read_st_inner pdf stnode =
|
let rec read_st_inner pdf stnode =
|
||||||
let s =
|
let s =
|
||||||
@@ -371,7 +374,15 @@ let matterhorn_11_005 _ _ pdf = todo ()
|
|||||||
let matterhorn_11_006 _ _ pdf = todo ()
|
let matterhorn_11_006 _ _ pdf = todo ()
|
||||||
|
|
||||||
(* <Figure> tag alternative or replacement text missing. *)
|
(* <Figure> tag alternative or replacement text missing. *)
|
||||||
let matterhorn_13_004 _ _ pdf = todo ()
|
let matterhorn_13_004 _ st2 pdf =
|
||||||
|
let rec check_fig = function
|
||||||
|
| E2 ("/Figure", attrs, cs) ->
|
||||||
|
if not (mem "/Alt" attrs || mem "/ActualText" attrs) then merror ();
|
||||||
|
iter check_fig cs
|
||||||
|
| E2 (_, _, cs) ->
|
||||||
|
iter check_fig cs
|
||||||
|
in
|
||||||
|
check_fig st2
|
||||||
|
|
||||||
let is_hnum s =
|
let is_hnum s =
|
||||||
match explode s with
|
match explode s with
|
||||||
|
Reference in New Issue
Block a user