diff options
author | Karl Berry <karl@freefriends.org> | 2022-06-05 21:03:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-06-05 21:03:30 +0000 |
commit | 6508d94a133775c00a40256e3b31a49ece9abeec (patch) | |
tree | c6ec0f928c855f23bcbab513aaa34e424c832d51 /Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm | |
parent | 80aa3b5de37b11d9f895cf844adcd9bb8fc127d2 (diff) |
latexindent (5jun22)
git-svn-id: svn://tug.org/texlive/trunk@63492 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm')
-rw-r--r-- | Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm index 1850a83c90d..7f3d026a4e6 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm @@ -249,12 +249,36 @@ sub text_wrap { # initiate the trailing comments storage my $trailingComments = q(); - # grab all *internal* trailing comments from the block - while ( $textWrapBlockStorageValue =~ m|$trailingCommentRegExp| ) { - $textWrapBlockStorageValue =~ s|(\h*$trailingCommentRegExp)||s; - $trailingComments .= $1; + # about trailing comments + # + # - trailing comments that do *not* have leading space instruct the text + # wrap routine to connect the lines *without* space + # + # - multiple trailing comments will be connected at the end of the text wrap block + # + # - the number of spaces between the end of the text wrap block and + # the (possibly combined) trailing comments is determined by the + # spaces (if any) at the end of the text wrap block + + # for trailing comments that + # + # do *NOT* have a leading space + # do have a trailing line break + # + # then we *remove* the trailing line break + while ( $textWrapBlockStorageValue =~ m|\H$trailingCommentRegExp\h*\R|s ) { + $textWrapBlockStorageValue =~ s|(\H)($trailingCommentRegExp)\h*\R|$1$2|s; + } + + # now we put all of the trailing comments together + while ( $textWrapBlockStorageValue =~ m|$trailingCommentRegExp|s ) { + $textWrapBlockStorageValue =~ s|($trailingCommentRegExp)||s; + $trailingComments = $trailingComments . $1; } + $trailingComments =~ s/\h{2,}/ /sg + if ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{multipleSpacesToSingle}; + # determine if text wrapping will remove paragraph line breaks my $removeBlockLineBreaks = ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{removeBlockLineBreaks}; |