Check text direction when merging readings errietta/3970
Errietta Kostala [Wed, 27 May 2015 15:45:09 +0000 (15:45 +0000)]
base/lib/Text/Tradition/Collation.pm
base/lib/Text/Tradition/Collation/Reading.pm

index 0850ed9..7ad4543 100644 (file)
@@ -2239,6 +2239,11 @@ sub path_text {
        my @path = grep { !$_->is_meta } $self->reading_sequence( $start, $end, $wit );
        my $pathtext = '';
        my $last;
+
+       if ($self->direction eq 'RL') {
+               @path = reverse @path;
+       }
+
        foreach my $r ( @path ) {
                unless ( $r->join_prior || !$last || $last->join_next ) {
                        $pathtext .= ' ';
index 323bd76..4346e34 100644 (file)
@@ -293,7 +293,13 @@ sub is_combinable {
 # into this reading.
 sub _combine {
        my( $self, $other, $joinstr ) = @_;
-       $self->alter_text( join( $joinstr, $self->text, $other->text ) );
+
+       if ($self->collation->direction eq 'RL') {
+               $self->alter_text( join( $joinstr, $other->text, $self->text ) );
+       } else {
+               $self->alter_text( join( $joinstr, $self->text, $other->text ) );
+       }
+
        # Change this reading to a joining one if necessary
        $self->_set_join_next( $other->join_next );
 }