summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm
index 9370f55886d..f2120ee7f87 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Sentence.pm
@@ -192,18 +192,19 @@ sub one_sentence_per_line{
my $trailing = ($5?$5:q()).($6?$6:q()).($7?$7:q());
my $lineBreaksAtEnd = ($6? 1 : ($7?1:0) );
my $trailingComments = q();
- # remove trailing comments from within the body of the sentence
if (${$mainSettings{modifyLineBreaks}{oneSentencePerLine}}{removeSentenceLineBreaks}){
+ # remove trailing comments from within the body of the sentence
while($middle =~ m|$trailingCommentRegExp|){
$middle =~ s|\h*($trailingCommentRegExp)||s;
$trailingComments .= $1;
}
+ # remove line breaks from within a sentence
+ $middle =~ s|
+ (?!\A) # not at the *beginning* of a match
+ (\h*)\R # possible horizontal space, then line break
+ |$1?$1:" ";|esgx
}
- # remove line breaks from within a sentence
- $middle =~ s|
- (?!\A) # not at the *beginning* of a match
- (\h*)\R # possible horizontal space, then line break
- |$1?$1:" ";|esgx if ${$mainSettings{modifyLineBreaks}{oneSentencePerLine}}{removeSentenceLineBreaks};
+ $middle =~ s|\h{2,}| |sg if ${$mainSettings{modifyLineBreaks}{oneSentencePerLine}}{multipleSpacesToSingle};
$middle =~ s|$tokens{blanklines}\h*\R?|$tokens{blanklines}\n|sg;
$logger->trace("follows: $beginning") if $is_tt_switch_active;
$logger->trace("sentence: $middle") if $is_tt_switch_active;