Skip to content

Commit 907a983

Browse files
committed
pdf-checker.raku: truncate long strings when tracing
1 parent cfdbe24 commit 907a983

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

bin/pdf-checker.raku

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ sub key-sort($_) {
3535
default {$_}
3636
}
3737

38+
multi sub gisty(Str $v where .chars > 500) {
39+
$v.substr(0..128) ~ '' ~ $v.substr(*-1);
40+
}
41+
42+
multi sub gisty($v) { $v }
43+
3844
sub display-item($_) {
3945
when Hash|Array {
4046
my $obj-num = .?obj-num;
@@ -43,12 +49,11 @@ sub display-item($_) {
4349
!! '...';
4450
}
4551
when PDF::COS::TextString { .Str.raku }
46-
when PDF::COS::TextString { .Str.raku }
4752
default {
4853
given to-ast($_) {
49-
.isa(Pair) && .key ~~ 'hex-string'
54+
gisty .isa(Pair) && .key ~~ 'hex-string'
5055
?? .value.raku
51-
!! $*writer.write($_)
56+
!! $*writer.write($_);
5257
}
5358
}
5459
}

0 commit comments

Comments
 (0)