From: Errietta Kostala Date: Wed, 27 May 2015 15:45:09 +0000 (+0000) Subject: Check text direction when merging readings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fd613f7e272e616a958b88ffdbe85f64b9715099;p=scpubgit%2Fstemmatology.git Check text direction when merging readings --- diff --git a/base/lib/Text/Tradition/Collation.pm b/base/lib/Text/Tradition/Collation.pm index 0850ed9..7ad4543 100644 --- a/base/lib/Text/Tradition/Collation.pm +++ b/base/lib/Text/Tradition/Collation.pm @@ -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 .= ' '; diff --git a/base/lib/Text/Tradition/Collation/Reading.pm b/base/lib/Text/Tradition/Collation/Reading.pm index 323bd76..4346e34 100644 --- a/base/lib/Text/Tradition/Collation/Reading.pm +++ b/base/lib/Text/Tradition/Collation/Reading.pm @@ -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 ); }