summaryrefslogtreecommitdiff
path: root/support/latexindent
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-03-16 03:01:42 +0000
committerNorbert Preining <norbert@preining.info>2023-03-16 03:01:42 +0000
commit7126e67439fccc8851427298ecccd01727575864 (patch)
tree20f4e53f9be699907a58dc835b816da74604aec0 /support/latexindent
parentbb077b85d20ee236d733a6d34ce144bd825fcc26 (diff)
CTAN sync 202303160301
Diffstat (limited to 'support/latexindent')
-rw-r--r--support/latexindent/LatexIndent/AlignmentAtAmpersand.pm57
-rw-r--r--support/latexindent/LatexIndent/Document.pm2
-rw-r--r--support/latexindent/LatexIndent/Else.pm4
-rw-r--r--support/latexindent/LatexIndent/Indent.pm315
-rw-r--r--support/latexindent/LatexIndent/Version.pm4
-rw-r--r--support/latexindent/README2
-rw-r--r--support/latexindent/bin/linux/latexindentbin6163427 -> 6163721 bytes
-rw-r--r--support/latexindent/bin/macos/latexindentbin6392634 -> 6392927 bytes
-rw-r--r--support/latexindent/defaultSettings.yaml2
-rw-r--r--support/latexindent/documentation/latexindent-yaml-schema.json2
-rw-r--r--support/latexindent/documentation/latexindent.pdfbin1242139 -> 1243932 bytes
-rwxr-xr-xsupport/latexindent/latexindent.pl2
12 files changed, 209 insertions, 181 deletions
diff --git a/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm b/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm
index 0cdfad7dd8..6d3b076c6b 100644
--- a/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm
+++ b/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm
@@ -155,9 +155,9 @@ sub align_at_ampersand {
$logger->trace("*dontMeasure routine, row mode") if ( ${$self}{dontMeasure} and $is_t_switch_active );
+ #
# initial loop for column storage and measuring
- # initial loop for column storage and measuring
- # initial loop for column storage and measuring
+ #
foreach ( split( "\n", ${$self}{body} ) ) {
$rowCounter++;
@@ -387,9 +387,9 @@ sub align_at_ampersand {
# main formatting loop
$self->main_formatting;
+ #
# final \\ loop
- # final \\ loop
- # final \\ loop
+ #
foreach (@formattedBody) {
# reset the padding
@@ -511,9 +511,9 @@ sub main_formatting {
${$self}{maximumRowWidth} = 0;
+ #
# objective (1): padding
- # objective (1): padding
- # objective (1): padding
+ #
$logger->trace("*formatted rows for: ${$self}{name}") if ($is_t_switch_active);
@@ -536,18 +536,18 @@ sub main_formatting {
# the placement of the padding is dependent on the value of justification
if ( ${$self}{justification} eq "left" ) {
+ #
# LEFT:
- # LEFT:
- # LEFT:
+ #
# <cell entry> <individual padding> <group padding> ...
$tmpRow .= ${$cell}{entry};
$tmpRow .= " " x ${$cell}{individualPadding};
$tmpRow .= " " x ${$cell}{groupPadding};
}
else {
+ #
# RIGHT:
- # RIGHT:
- # RIGHT:
+ #
# <group padding> <individual padding> <cell entry> ...
$tmpRow .= " " x ${$cell}{groupPadding};
$tmpRow .= " " x ${$cell}{individualPadding};
@@ -583,9 +583,9 @@ sub main_formatting {
# store this formatted row
${ $formattedBody[$rowCount] }{row} = $tmpRow;
+ #
# objective (2): calculate row width and update maximumRowWidth
- # objective (2): calculate row width and update maximumRowWidth
- # objective (2): calculate row width and update maximumRowWidth
+ #
my $rowWidth = &get_column_width($tmpRow);
# possibly update rowWidth if there are hidden children; see test-cases/alignment/hidden-child1.tex and friends
@@ -784,9 +784,9 @@ sub individual_padding {
# we count the maximum number of columns
my $maximumNumberOfColumns = 0;
+ #
# maximum column width loop
- # maximum column width loop
- # maximum column width loop
+ #
$logger->trace("*dontMeasure routine, cell mode") if ( ${$self}{dontMeasure} and $is_t_switch_active );
@@ -871,9 +871,9 @@ sub individual_padding {
$maximumNumberOfColumns = $j if ( $j > $maximumNumberOfColumns );
}
+ #
# individual padding and gap filling loop
- # individual padding and gap filling loop
- # individual padding and gap filling loop
+ #
# row loop
foreach my $row (@cellStorage) {
@@ -1100,9 +1100,9 @@ sub multicolumn_padding {
# and groupPadding accordingly
my $justificationOffset = ( ${$self}{justification} eq "left" ? $j + $multiColumnSpan - 1 : $j );
+ #
# phase (1)
- # phase (1)
- # phase (1)
+ #
# *inner* row loop
my $innerRowCount = -1;
@@ -1173,9 +1173,9 @@ sub multicolumn_padding {
}
+ #
# phase (2)
- # phase (2)
- # phase (2)
+ #
# now that the maxGroupingWidth has been established, loop back
# through and update groupingWidth for the appropriate cells
@@ -1208,9 +1208,9 @@ sub multicolumn_padding {
my $groupingWidth = ${ $cellStorage[$innerRowCount][$justificationOffset] }{groupingWidth};
+ #
# phase (3)
- # phase (3)
- # phase (3)
+ #
# there are two possible cases:
#
@@ -1457,7 +1457,20 @@ sub double_back_slash_else {
# logfile information
logName => "double-back-slash-block (for align at ampersand, see lookForAlignDelims)",
+
+ # we don't want to store these "\\" blocks as demonstrated in test-cases/alignment/issue-426.tex
+ storage => 0,
);
+
+ # can return if no "\\" blocks were found
+ return unless defined ${$self}{children};
+
+ # now loop back through and put the "\\" blocks back in, accounting for all poly-switches
+ while ( ${ ${$self}{children}[-1] }{storage} == 0 ) {
+ my $child = ${$self}{children}[-1];
+ $self->replace_id_with_begin_body_end( $child, -1 );
+ last if scalar( @{ ${$self}{children} } ) == 0;
+ }
}
# possible hidden children, see test-cases/alignment/issue-162.tex and friends
diff --git a/support/latexindent/LatexIndent/Document.pm b/support/latexindent/LatexIndent/Document.pm
index 8982509445..d365388679 100644
--- a/support/latexindent/LatexIndent/Document.pm
+++ b/support/latexindent/LatexIndent/Document.pm
@@ -42,7 +42,7 @@ use LatexIndent::TrailingComments
qw/remove_trailing_comments put_trailing_comments_back_in add_comment_symbol construct_trailing_comment_regexp/;
use LatexIndent::HorizontalWhiteSpace qw/remove_trailing_whitespace remove_leading_space/;
use LatexIndent::Indent
- qw/indent wrap_up_statement determine_total_indentation indent_begin indent_body indent_end_statement final_indentation_check get_surrounding_indentation indent_children_recursively check_for_blank_lines_at_beginning put_blank_lines_back_in_at_beginning add_surrounding_indentation_to_begin_statement post_indentation_check/;
+ qw/indent wrap_up_statement determine_total_indentation indent_begin indent_body indent_end_statement final_indentation_check get_surrounding_indentation indent_children_recursively check_for_blank_lines_at_beginning put_blank_lines_back_in_at_beginning add_surrounding_indentation_to_begin_statement post_indentation_check replace_id_with_begin_body_end/;
use LatexIndent::Tokens qw/token_check %tokens/;
use LatexIndent::HiddenChildren
qw/find_surrounding_indentation_for_children update_family_tree get_family_tree check_for_hidden_children hidden_children_preparation_for_alignment unpack_children_into_body/;
diff --git a/support/latexindent/LatexIndent/Else.pm b/support/latexindent/LatexIndent/Else.pm
index da6005e7a6..62a14a677b 100644
--- a/support/latexindent/LatexIndent/Else.pm
+++ b/support/latexindent/LatexIndent/Else.pm
@@ -79,6 +79,7 @@ sub check_for_else_statement {
# to detail for double back slash poly-switches
# (see test-cases alignment command-align.tex, for example)
parent=>(${$self}{parent}?${$self}{parent}:"none"),
+ storage=>(defined $input{storage} ? $input{storage} : 1),
);
# log file output
@@ -108,6 +109,9 @@ sub remove_line_breaks_begin {
sub tasks_particular_to_each_object {
my $self = shift;
+ # some Else blocks shouldn't be stored (especially "\\" blocks), see test-cases/alignment/issue-426.tex
+ return if ${$self}{storage} == 0;
+
# search for headings (important to do this before looking for commands!)
$self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
diff --git a/support/latexindent/LatexIndent/Indent.pm b/support/latexindent/LatexIndent/Indent.pm
index 51f5906cb3..23968069b0 100644
--- a/support/latexindent/LatexIndent/Indent.pm
+++ b/support/latexindent/LatexIndent/Indent.pm
@@ -26,7 +26,7 @@ use Text::Tabs;
use Data::Dumper;
use Exporter qw/import/;
our @EXPORT_OK
- = qw/indent wrap_up_statement determine_total_indentation indent_begin indent_body indent_end_statement final_indentation_check push_family_tree_to_indent get_surrounding_indentation indent_children_recursively check_for_blank_lines_at_beginning put_blank_lines_back_in_at_beginning add_surrounding_indentation_to_begin_statement post_indentation_check/;
+ = qw/indent wrap_up_statement determine_total_indentation indent_begin indent_body indent_end_statement final_indentation_check push_family_tree_to_indent get_surrounding_indentation indent_children_recursively check_for_blank_lines_at_beginning put_blank_lines_back_in_at_beginning add_surrounding_indentation_to_begin_statement post_indentation_check replace_id_with_begin_body_end/;
our %familyTree;
sub indent {
@@ -311,158 +311,9 @@ sub indent_children_recursively {
# we work through the array *in order*
foreach my $child ( @{ ${$self}{children} } ) {
$logger->trace("Searching ${$self}{name} for ${$child}{id}...") if $is_t_switch_active;
- if ( ${$self}{body} =~ m/${$child}{idRegExp}/s ) {
-
- # we only care if id is first non-white space character
- # and if followed by line break
- # if m switch is active
- my $IDFirstNonWhiteSpaceCharacter = 0;
- my $IDFollowedImmediatelyByLineBreak = 0;
-
- # update the above two, if necessary
- if ($is_m_switch_active) {
- $IDFirstNonWhiteSpaceCharacter = (
- ${$self}{body} =~ m/^${$child}{idRegExp}/m
- or ${$self}{body} =~ m/^\h\h*${$child}{idRegExp}/m
- ) ? 1 : 0;
- $IDFollowedImmediatelyByLineBreak = ( ${$self}{body} =~ m/${$child}{idRegExp}\h*\R+/m ) ? 1 : 0;
- ${$child}{IDFollowedImmediatelyByLineBreak} = $IDFollowedImmediatelyByLineBreak;
- }
-
- # log file info
- $logger->trace("${$child}{id} found!") if ($is_t_switch_active);
- $logger->trace("*Indenting ${$child}{name} (id: ${$child}{id})") if $is_t_switch_active;
- $logger->trace("looking up indentation scheme for ${$child}{name}") if ($is_t_switch_active);
-
- # line break checks *after* <end statement>
- if ( defined ${$child}{EndFinishesWithLineBreak}
- and ${$child}{EndFinishesWithLineBreak} == -1
- and $IDFollowedImmediatelyByLineBreak )
- {
- # remove line break *after* <end statement>, if appropriate
- my $EndStringLogFile = ${$child}{aliases}{EndFinishesWithLineBreak} || "EndFinishesWithLineBreak";
- $logger->trace("Removing linebreak after ${$child}{end} (see $EndStringLogFile)")
- if $is_t_switch_active;
- ${$self}{body} =~ s/${$child}{idRegExp}(\h*)?(\R|\h)*/${$child}{id}$1/s;
- ${$child}{linebreaksAtEnd}{end} = 0;
- }
-
- # perform indentation
- $child->indent;
-
- # surrounding indentation is now up to date
- my $surroundingIndentation
- = ( ${$child}{surroundingIndentation} and ${$child}{hiddenChildYesNo} )
- ? (
- ref( ${$child}{surroundingIndentation} ) eq 'SCALAR'
- ? ${ ${$child}{surroundingIndentation} }
- : ${$child}{surroundingIndentation}
- )
- : q();
-
- # line break checks before <begin statement>
- if ( defined ${$child}{BeginStartsOnOwnLine} and ${$child}{BeginStartsOnOwnLine} != 0 ) {
- my $BeginStringLogFile = ${$child}{aliases}{BeginStartsOnOwnLine} || "BeginStartsOnOwnLine";
-
- #
- # Blank line poly-switch notes (==4)
- #
- # when BeginStartsOnOwnLine=4 we adopt the following approach:
- # temporarily change BeginStartsOnOwnLine to -1, make adjustments
- # temporarily change BeginStartsOnOwnLine to 3, make adjustments
- #
- # we use an array, @polySwitchValues to facilitate this
- my @polySwitchValues
- = ( ${$child}{BeginStartsOnOwnLine} == 4 ) ? ( -1, 3 ) : ( ${$child}{BeginStartsOnOwnLine} );
-
- foreach (@polySwitchValues) {
-
- # if BeginStartsOnOwnLine is 4, then we hack
- # $IDFirstNonWhiteSpaceCharacter
- # to be 0 on the second time through (poly-switch set to 3)
- $IDFirstNonWhiteSpaceCharacter = 0 if ( ${$child}{BeginStartsOnOwnLine} == 4 and $_ == 3 );
-
- # if the child ID is not the first character and BeginStartsOnOwnLine>=1
- # then we will need to add a line break (==1), a comment (==2) or another blank line (==3)
- if ( $_ >= 1 and !$IDFirstNonWhiteSpaceCharacter ) {
-
- # by default, assume that no trailing comment token is needed
- my $trailingCharacterToken = q();
- if ( $_ == 2 ) {
- $logger->trace(
- "Removing space immediately before ${$child}{id}, in preparation for adding % ($BeginStringLogFile == 2)"
- ) if $is_t_switch_active;
- ${$self}{body} =~ s/\h*${$child}{idRegExp}/${$child}{id}/s;
- $logger->trace(
- "Adding a % at the end of the line that ${$child}{begin} is on, then a linebreak ($BeginStringLogFile == 2)"
- ) if $is_t_switch_active;
- $trailingCharacterToken = "%" . $self->add_comment_symbol;
- }
- elsif ( $_ == 3 ) {
- $logger->trace(
- "Adding a blank line at the end of the line that ${$child}{begin} is on, then a linebreak ($BeginStringLogFile == 3)"
- ) if $is_t_switch_active;
- $trailingCharacterToken = "\n"
- . (
- ${ $mainSettings{modifyLineBreaks} }{preserveBlankLines}
- ? $tokens{blanklines}
- : q()
- );
- }
- else {
- $logger->trace(
- "Adding a linebreak at the beginning of ${$child}{begin} (see $BeginStringLogFile)")
- if $is_t_switch_active;
- }
-
- # the trailing comment/linebreak magic
- ${$child}{begin} = "$trailingCharacterToken\n" . ${$child}{begin};
- $child->add_surrounding_indentation_to_begin_statement;
-
- # remove surrounding indentation ahead of %
- ${$child}{begin} =~ s/^(\h*)%/%/ if ( $_ == 2 );
- }
- elsif ( $_ == -1 and $IDFirstNonWhiteSpaceCharacter ) {
-
- # finally, if BeginStartsOnOwnLine == -1 then we might need to *remove* a blank line(s)
- # important to check we don't move the begin statement next to a blank-line-token
- my $blankLineToken = $tokens{blanklines};
- if ( ${$self}{body} !~ m/$blankLineToken\R*\h*${$child}{idRegExp}/s ) {
- $logger->trace(
- "Removing linebreak before ${$child}{begin} (see $BeginStringLogFile in ${$child}{modifyLineBreaksYamlName} YAML)"
- ) if $is_t_switch_active;
- ${$self}{body} =~ s/(\h*)(?:\R*|\h*)+${$child}{idRegExp}/$1${$child}{id}/s;
- }
- else {
- $logger->trace(
- "Not removing linebreak ahead of ${$child}{begin}, as blank-line-token present (see preserveBlankLines)"
- ) if $is_t_switch_active;
- }
- }
- }
- }
- $logger->trace( Dumper( \%{$child} ) ) if ($is_tt_switch_active);
-
- # replace ids with body
- ${$self}{body} =~ s/${$child}{idRegExp}/${$child}{begin}${$child}{body}${$child}{end}/;
-
- # log file info
- $logger->trace("Body (${$self}{name}) now looks like:") if $is_tt_switch_active;
- $logger->trace( ${$self}{body} ) if ($is_tt_switch_active);
-
-# remove element from array: http://stackoverflow.com/questions/174292/what-is-the-best-way-to-delete-a-value-from-an-array-in-perl
- splice( @{ ${$self}{children} }, $index, 1 );
-
- # output to the log file
- $logger->trace("deleted child key ${$child}{name} (parent is: ${$self}{name})") if $is_t_switch_active;
-
- # restart the loop, as the size of the array has changed
- last;
- }
- else {
- $logger->trace("${$child}{id} not found") if ($is_t_switch_active);
- }
+ my $restartLoop = $self->replace_id_with_begin_body_end( $child, $index );
+ last if $restartLoop;
# increment the loop counter
$index++;
@@ -477,6 +328,166 @@ sub indent_children_recursively {
}
+sub replace_id_with_begin_body_end {
+
+ my $self = shift;
+ my ( $child, $index ) = (@_);
+
+ if ( ${$self}{body} =~ m/${$child}{idRegExp}/s ) {
+
+ # we only care if id is first non-white space character
+ # and if followed by line break
+ # if m switch is active
+ my $IDFirstNonWhiteSpaceCharacter = 0;
+ my $IDFollowedImmediatelyByLineBreak = 0;
+
+ # update the above two, if necessary
+ if ($is_m_switch_active) {
+ $IDFirstNonWhiteSpaceCharacter = (
+ ${$self}{body} =~ m/^${$child}{idRegExp}/m
+ or ${$self}{body} =~ m/^\h\h*${$child}{idRegExp}/m
+ ) ? 1 : 0;
+ $IDFollowedImmediatelyByLineBreak = ( ${$self}{body} =~ m/${$child}{idRegExp}\h*\R+/m ) ? 1 : 0;
+ ${$child}{IDFollowedImmediatelyByLineBreak} = $IDFollowedImmediatelyByLineBreak;
+ }
+
+ # log file info
+ $logger->trace("${$child}{id} found!") if ($is_t_switch_active);
+ $logger->trace("*Indenting ${$child}{name} (id: ${$child}{id})") if $is_t_switch_active;
+ $logger->trace("looking up indentation scheme for ${$child}{name}") if ($is_t_switch_active);
+
+ # line break checks *after* <end statement>
+ if ( defined ${$child}{EndFinishesWithLineBreak}
+ and ${$child}{EndFinishesWithLineBreak} == -1
+ and $IDFollowedImmediatelyByLineBreak )
+ {
+ # remove line break *after* <end statement>, if appropriate
+ my $EndStringLogFile = ${$child}{aliases}{EndFinishesWithLineBreak} || "EndFinishesWithLineBreak";
+ $logger->trace("Removing linebreak after ${$child}{end} (see $EndStringLogFile)")
+ if $is_t_switch_active;
+ ${$self}{body} =~ s/${$child}{idRegExp}(\h*)?(\R|\h)*/${$child}{id}$1/s;
+ ${$child}{linebreaksAtEnd}{end} = 0;
+ }
+
+ # perform indentation
+ $child->indent;
+
+ # surrounding indentation is now up to date
+ my $surroundingIndentation
+ = ( ${$child}{surroundingIndentation} and ${$child}{hiddenChildYesNo} )
+ ? (
+ ref( ${$child}{surroundingIndentation} ) eq 'SCALAR'
+ ? ${ ${$child}{surroundingIndentation} }
+ : ${$child}{surroundingIndentation}
+ )
+ : q();
+
+ # line break checks before <begin statement>
+ if ( defined ${$child}{BeginStartsOnOwnLine} and ${$child}{BeginStartsOnOwnLine} != 0 ) {
+ my $BeginStringLogFile = ${$child}{aliases}{BeginStartsOnOwnLine} || "BeginStartsOnOwnLine";
+
+ #
+ # Blank line poly-switch notes (==4)
+ #
+ # when BeginStartsOnOwnLine=4 we adopt the following approach:
+ # temporarily change BeginStartsOnOwnLine to -1, make adjustments
+ # temporarily change BeginStartsOnOwnLine to 3, make adjustments
+ #
+ # we use an array, @polySwitchValues to facilitate this
+ my @polySwitchValues
+ = ( ${$child}{BeginStartsOnOwnLine} == 4 ) ? ( -1, 3 ) : ( ${$child}{BeginStartsOnOwnLine} );
+
+ foreach (@polySwitchValues) {
+
+ # if BeginStartsOnOwnLine is 4, then we hack
+ # $IDFirstNonWhiteSpaceCharacter
+ # to be 0 on the second time through (poly-switch set to 3)
+ $IDFirstNonWhiteSpaceCharacter = 0 if ( ${$child}{BeginStartsOnOwnLine} == 4 and $_ == 3 );
+
+ # if the child ID is not the first character and BeginStartsOnOwnLine>=1
+ # then we will need to add a line break (==1), a comment (==2) or another blank line (==3)
+ if ( $_ >= 1 and !$IDFirstNonWhiteSpaceCharacter ) {
+
+ # by default, assume that no trailing comment token is needed
+ my $trailingCharacterToken = q();
+ if ( $_ == 2 ) {
+ $logger->trace(
+ "Removing space immediately before ${$child}{id}, in preparation for adding % ($BeginStringLogFile == 2)"
+ ) if $is_t_switch_active;
+ ${$self}{body} =~ s/\h*${$child}{idRegExp}/${$child}{id}/s;
+ $logger->trace(
+ "Adding a % at the end of the line that ${$child}{begin} is on, then a linebreak ($BeginStringLogFile == 2)"
+ ) if $is_t_switch_active;
+ $trailingCharacterToken = "%" . $self->add_comment_symbol;
+ }
+ elsif ( $_ == 3 ) {
+ $logger->trace(
+ "Adding a blank line at the end of the line that ${$child}{begin} is on, then a linebreak ($BeginStringLogFile == 3)"
+ ) if $is_t_switch_active;
+ $trailingCharacterToken = "\n"
+ . (
+ ${ $mainSettings{modifyLineBreaks} }{preserveBlankLines}
+ ? $tokens{blanklines}
+ : q()
+ );
+ }
+ else {
+ $logger->trace(
+ "Adding a linebreak at the beginning of ${$child}{begin} (see $BeginStringLogFile)")
+ if $is_t_switch_active;
+ }
+
+ # the trailing comment/linebreak magic
+ ${$child}{begin} = "$trailingCharacterToken\n" . ${$child}{begin};
+ $child->add_surrounding_indentation_to_begin_statement;
+
+ # remove surrounding indentation ahead of %
+ ${$child}{begin} =~ s/^(\h*)%/%/ if ( $_ == 2 );
+ }
+ elsif ( $_ == -1 and $IDFirstNonWhiteSpaceCharacter ) {
+
+ # finally, if BeginStartsOnOwnLine == -1 then we might need to *remove* a blank line(s)
+ # important to check we don't move the begin statement next to a blank-line-token
+ my $blankLineToken = $tokens{blanklines};
+ if ( ${$self}{body} !~ m/$blankLineToken\R*\h*${$child}{idRegExp}/s ) {
+ $logger->trace(
+ "Removing linebreak before ${$child}{begin} (see $BeginStringLogFile in ${$child}{modifyLineBreaksYamlName} YAML)"
+ ) if $is_t_switch_active;
+ ${$self}{body} =~ s/(\h*)(?:\R*|\h*)+${$child}{idRegExp}/$1${$child}{id}/s;
+ }
+ else {
+ $logger->trace(
+ "Not removing linebreak ahead of ${$child}{begin}, as blank-line-token present (see preserveBlankLines)"
+ ) if $is_t_switch_active;
+ }
+ }
+ }
+ }
+
+ $logger->trace( Dumper( \%{$child} ) ) if ($is_tt_switch_active);
+
+ # replace ids with body
+ ${$self}{body} =~ s/${$child}{idRegExp}/${$child}{begin}${$child}{body}${$child}{end}/;
+
+ # log file info
+ $logger->trace("Body (${$self}{name}) now looks like:") if $is_tt_switch_active;
+ $logger->trace( ${$self}{body} ) if ($is_tt_switch_active);
+
+# remove element from array: http://stackoverflow.com/questions/174292/what-is-the-best-way-to-delete-a-value-from-an-array-in-perl
+ splice( @{ ${$self}{children} }, $index, 1 );
+
+ # output to the log file
+ $logger->trace("deleted child key ${$child}{name} (parent is: ${$self}{name})") if $is_t_switch_active;
+
+ # restart the loop, as the size of the array has changed
+ return 1;
+ }
+ else {
+ $logger->trace("${$child}{id} not found") if ($is_t_switch_active);
+ return 0;
+ }
+}
+
sub add_surrounding_indentation_to_begin_statement {
# almost all of the objects add surrounding indentation to the 'begin' statements,
diff --git a/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm
index f068880de8..e05f59d6f9 100644
--- a/support/latexindent/LatexIndent/Version.pm
+++ b/support/latexindent/LatexIndent/Version.pm
@@ -20,6 +20,6 @@ use warnings;
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.20.3';
-our $versionDate = '2023-02-19';
+our $versionNumber = '3.20.4';
+our $versionDate = '2023-03-15';
1
diff --git a/support/latexindent/README b/support/latexindent/README
index a4db41d8d4..1a2f1058d3 100644
--- a/support/latexindent/README
+++ b/support/latexindent/README
@@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- latexindent.pl, version 3.20.3, 2023-02-19
+ latexindent.pl, version 3.20.4, 2023-03-15
PERL script to indent code within environments, and align delimited
environments in .tex files.
diff --git a/support/latexindent/bin/linux/latexindent b/support/latexindent/bin/linux/latexindent
index e9e5e29869..71fff30129 100644
--- a/support/latexindent/bin/linux/latexindent
+++ b/support/latexindent/bin/linux/latexindent
Binary files differ
diff --git a/support/latexindent/bin/macos/latexindent b/support/latexindent/bin/macos/latexindent
index 68c084fce5..8037f1b4b5 100644
--- a/support/latexindent/bin/macos/latexindent
+++ b/support/latexindent/bin/macos/latexindent
Binary files differ
diff --git a/support/latexindent/defaultSettings.yaml b/support/latexindent/defaultSettings.yaml
index a5f45fd080..2dc3f22667 100644
--- a/support/latexindent/defaultSettings.yaml
+++ b/support/latexindent/defaultSettings.yaml
@@ -1,5 +1,5 @@
#
-# latexindent.pl, version 3.20.3, 2023-02-19
+# latexindent.pl, version 3.20.4, 2023-03-15
#
# defaultSettings.yaml, the default settings for latexindent.pl
#
diff --git a/support/latexindent/documentation/latexindent-yaml-schema.json b/support/latexindent/documentation/latexindent-yaml-schema.json
index e9c855cf4e..3c21407f7a 100644
--- a/support/latexindent/documentation/latexindent-yaml-schema.json
+++ b/support/latexindent/documentation/latexindent-yaml-schema.json
@@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/schema",
"$id": "latexindent-yaml-schema.json",
"title": "latexindent.pl YAML schema",
- "description": "latexindent.pl YAML schema helper, V3.20.3 2023-02-19",
+ "description": "latexindent.pl YAML schema helper, V3.20.4 2023-03-15",
"type": "object",
"properties": {
"fileExtensionPreference": {
diff --git a/support/latexindent/documentation/latexindent.pdf b/support/latexindent/documentation/latexindent.pdf
index 034b04b519..7bf086b16d 100644
--- a/support/latexindent/documentation/latexindent.pdf
+++ b/support/latexindent/documentation/latexindent.pdf
Binary files differ
diff --git a/support/latexindent/latexindent.pl b/support/latexindent/latexindent.pl
index 32b94b3f4b..4553e6dd7b 100755
--- a/support/latexindent/latexindent.pl
+++ b/support/latexindent/latexindent.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# latexindent.pl, version 3.20.3, 2023-02-19
+# latexindent.pl, version 3.20.4, 2023-03-15
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by