Skip to content

Commit 11047e6

Browse files
committed
map tagged pdf Space{Before/After} {Start/End}Indent to css margins
1 parent 3f72b59 commit 11047e6

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/CSS/TagSet/TaggedPDF.rakumod

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ our %Layout = %(
6666
},
6767
# Custom properties which don't map well to CSS standard properties
6868
'SpaceBefore'|'SpaceAfter'|'StartIndent'|'EndIndent' => -> Str $prop, Num() $pt {
69-
'-pdf-' ~ snake-case($prop) => :$pt;
69+
my Str:D $margin = {
70+
:SpaceBefore<top>,
71+
:SpaceAfter<bottom>,
72+
:StartIndent<left>,
73+
:EndIndent<right>,
74+
}{$prop};
75+
('margin-' ~ $margin) => :$pt;
7076
},
7177
# Todo: BBox BlockAlign InlineAlign TBorderStyle TPadding TextDecorationColor TextDecorationThickness RubyAlign RubyPosition GlyphOrientationVertical
7278
);

t/tag-set-pdf.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ is $tag-set.tag-style('H3'), 'display:block; font-size:1.17em; font-weig
1111
is $tag-set.tag-style('Code'), 'font:0.85em monospace; white-space:pre;', '<Code/>';
1212
is $tag-set.tag-style('LI'), 'display:list-item; list-style:none; margin-left:40px; page-break-after:avoid;', '<LI/>';
1313
is $tag-set.tag-style('Span', :BorderStyle<Dotted>), 'border:dotted;', '<Dotted/>';
14-
is $tag-set.tag-style('Span', :SpaceBefore(5)), '-pdf-space-before:5pt;', '<Span SpaceBefore=...>';
14+
is $tag-set.tag-style('Span', :SpaceBefore(5)), 'margin-top:5pt;', '<Span SpaceBefore=...>';
1515

1616
is $tag-set.tag-style('Code'), 'font:0.85em monospace; white-space:pre;', 'Base Code style';
1717

0 commit comments

Comments
 (0)