summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexindent/LatexIndent
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-06-05 21:03:30 +0000
committerKarl Berry <karl@freefriends.org>2022-06-05 21:03:30 +0000
commit6508d94a133775c00a40256e3b31a49ece9abeec (patch)
treec6ec0f928c855f23bcbab513aaa34e424c832d51 /Master/texmf-dist/scripts/latexindent/LatexIndent
parent80aa3b5de37b11d9f895cf844adcd9bb8fc127d2 (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')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm7
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm4
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm32
3 files changed, 37 insertions, 6 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
index 24e1291e754..96577d28d0a 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
@@ -435,6 +435,13 @@ sub yaml_read_settings {
$logger->info(
"Not showing settings in the log file (see showEveryYamlRead and showAmalgamatedSettings).");
}
+
+ # warning to log file if modifyLineBreaks specified and m switch not active
+ if ( ${ $userSettings->[0] }{modifyLineBreaks} and !$is_m_switch_active ) {
+ $logger->warn("*modifyLineBreaks specified and m switch is *not* active");
+ $logger->warn("perhaps you intended to call");
+ $logger->warn(" latexindent.pl -m -l $settings ${$self}{fileName}");
+ }
}
else {
# otherwise print a warning that we can not read userSettings.yaml
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
index edbb6252aa5..5decf68ddd6 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
@@ -20,6 +20,6 @@ use warnings;
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.17.2';
-our $versionDate = '2022-04-14';
+our $versionNumber = '3.17.3';
+our $versionDate = '2022-06-05';
1
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};