Skip to content

Commit

Permalink
More PDF 2.0 corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Sep 29, 2024
1 parent 36e70f8 commit 5f2a1cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/PDF/Attributes/List.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ also does ISO_32000_2::Table_382-Standard_list_attributes;
use PDF::COS::Tie;
use PDF::COS::Name;

my subset Numbering of PDF::COS::Name where 'None'|'Unordered'|'Description'|'Disc'|'Circle'|'Square'|'Decimal'|'UpperRoman'|'LowerRoman'|'UpperAlpha'|'LowerAlpha';
my subset Numbering of PDF::COS::Name where 'None'|'Unordered'|'Ordered'|'Description'|'Disc'|'Circle'|'Square'|'Decimal'|'UpperRoman'|'LowerRoman'|'UpperAlpha'|'LowerAlpha';

has Numbering $.ListNumbering is entry(:default<None>); # (Optional; inheritable) The numbering system used to generate the content of the Lbl (Label) elements in an autonumbered list, or the symbol used to identify each item in an unnumbered list. The value of the ListNumbering is one of the following, and is applied as described here.
# None No autonumbering; Lbl elements (if present) contain arbitrary text not subject to any numbering scheme
Expand Down
17 changes: 16 additions & 1 deletion lib/PDF/StructTreeRoot.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,22 @@ our subset StandardStructureType of PDF::COS::Name where

has StandardStructureType %.RoleMap is entry; # A dictionary that shall map the names of structure types used in the document to their approximate equivalents in the set of standard structure types.

has PDF::Attributes %.ClassMap is entry(:coerce(&coerce-attributes)); # A dictionary that shall map name objects designating attribute classes to the corresponding attribute objects
my subset AttributeList of List where .elems == 0 || .[0] ~~ PDF::Attributes;
my subset ClassMap where PDF::Attributes|AttributeList;

multi sub coerce-classmap(List $l is rw, ClassMap) {
coerce-attributes($l[$_], PDF::Attributes) for (^$l.elems);
}

multi sub coerce-classmap(Hash $a is rw, ClassMap) {
coerce-attributes($a, PDF::Attributes);
}

multi sub coerce-classmap($_, ClassMap) {
fail "Unable to coerce .raku to a class-map";
}

has ClassMap %.ClassMap is entry(:coerce(&coerce-classmap)); # A dictionary that shall map name objects designating attribute classes to the corresponding attribute objects

has PDF::Namespace @.Namespaces is entry(:indirect); # (Required if any structure elements have namespace identifiers; PDF 2.0) An array of namespaces used within the document

Expand Down

0 comments on commit 5f2a1cc

Please sign in to comment.