Browse Source

* Subtitle::SSA::Style->to_string() : fix fields separator

master
Alex 'AdUser' Z 8 years ago
parent
commit
9442904a09
  1. 8
      lib/Subtitle/SSA/Style.pm

8
lib/Subtitle/SSA/Style.pm

@ -81,15 +81,19 @@ sub to_string {
my ($self) = @_; my ($self) = @_;
my @fields = $self->fields(); my @fields = $self->fields();
my $string = "Style: "; my $string = "Style: ";
my @values = ();
foreach my $field (@fields) { foreach my $field (@fields) {
my $d = $STYLE_DEFAULTS{$field}; my $d = $STYLE_DEFAULTS{$field};
my $v = $self->{$f} // $d->{value};
if ($d->{type} eq 'x') { if ($d->{type} eq 'x') {
$fmt = ($self->{_vers} eq 'ass') ? '&H%08X' : '%d'; $fmt = ($self->{_vers} eq 'ass') ? '&H%08X' : '%d';
$string .= sprintf $fmt, $self->{$f}; $v = sprintf $fmt, $v;
} else { } else {
$string .= $self->{$f} // $d->{value}; # use as is
} }
push @values, $v;
} }
$string .= join(',', @values);
return $string; return $string;
} }

Loading…
Cancel
Save