From d82d72343a5dfcbc4ba14569fba7f9e34debdf71 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 15 Apr 2022 03:00:41 +0000 Subject: CTAN sync 202204150300 --- .../LatexIndent/AlignmentAtAmpersand.pm | 1999 ++++++++++---------- support/latexindent/LatexIndent/Arguments.pm | 308 +-- .../latexindent/LatexIndent/BackUpFileProcedure.pm | 118 +- support/latexindent/LatexIndent/BlankLines.pm | 58 +- support/latexindent/LatexIndent/Braces.pm | 61 +- support/latexindent/LatexIndent/Check.pm | 117 +- support/latexindent/LatexIndent/Command.pm | 193 +- support/latexindent/LatexIndent/Document.pm | 362 ++-- support/latexindent/LatexIndent/DoubleBackSlash.pm | 7 +- support/latexindent/LatexIndent/Else.pm | 30 +- support/latexindent/LatexIndent/Environment.pm | 47 +- support/latexindent/LatexIndent/FileContents.pm | 252 +-- support/latexindent/LatexIndent/FileExtension.pm | 193 +- support/latexindent/LatexIndent/GetYamlSettings.pm | 1241 ++++++------ support/latexindent/LatexIndent/Heading.pm | 143 +- support/latexindent/LatexIndent/HiddenChildren.pm | 268 +-- .../LatexIndent/HorizontalWhiteSpace.pm | 43 +- support/latexindent/LatexIndent/IfElseFi.pm | 122 +- support/latexindent/LatexIndent/Indent.pm | 360 ++-- support/latexindent/LatexIndent/Item.pm | 46 +- .../LatexIndent/KeyEqualsValuesBraces.pm | 65 +- support/latexindent/LatexIndent/Lines.pm | 280 +-- support/latexindent/LatexIndent/LogFile.pm | 161 +- support/latexindent/LatexIndent/Logger.pm | 61 +- .../latexindent/LatexIndent/MandatoryArgument.pm | 34 +- .../latexindent/LatexIndent/ModifyLineBreaks.pm | 471 +++-- .../LatexIndent/NamedGroupingBracesBrackets.pm | 46 +- .../latexindent/LatexIndent/OptionalArgument.pm | 30 +- support/latexindent/LatexIndent/Preamble.pm | 24 +- support/latexindent/LatexIndent/Replacement.pm | 76 +- support/latexindent/LatexIndent/RoundBrackets.pm | 22 +- support/latexindent/LatexIndent/Sentence.pm | 352 ++-- support/latexindent/LatexIndent/Special.pm | 221 ++- support/latexindent/LatexIndent/Switches.pm | 38 +- support/latexindent/LatexIndent/Tokens.pm | 76 +- .../latexindent/LatexIndent/TrailingComments.pm | 113 +- .../LatexIndent/UnNamedGroupingBracesBrackets.pm | 62 +- support/latexindent/LatexIndent/Verbatim.pm | 582 +++--- support/latexindent/LatexIndent/Version.pm | 5 +- support/latexindent/LatexIndent/Wrap.pm | 406 ++-- support/latexindent/README | 2 +- support/latexindent/defaultSettings.yaml | 3 +- .../documentation/latexindent-yaml-schema.json | 2 +- support/latexindent/documentation/latexindent.pdf | Bin 1069437 -> 1088780 bytes support/latexindent/documentation/latexindent.tex | 46 +- .../latexindent/documentation/sec-appendices.tex | 30 +- .../latexindent/documentation/sec-introduction.tex | 153 +- .../documentation/subsec-one-sentence-per-line.tex | 2 +- support/latexindent/documentation/title.tex | 8 +- support/latexindent/latexindent.pl | 71 +- 50 files changed, 5252 insertions(+), 4158 deletions(-) (limited to 'support/latexindent') diff --git a/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm b/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm index 6607bf6c9d..746041893d 100644 --- a/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm +++ b/support/latexindent/LatexIndent/AlignmentAtAmpersand.pm @@ -1,4 +1,5 @@ package LatexIndent::AlignmentAtAmpersand; + # 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 # the Free Software Foundation, either version 3 of the License, or @@ -26,33 +27,34 @@ use LatexIndent::Tokens qw/%tokens/; use LatexIndent::LogFile qw/$logger/; use LatexIndent::HiddenChildren qw/%familyTree/; use LatexIndent::Verbatim qw/%verbatimStorage/; -our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321 -our @EXPORT_OK = qw/align_at_ampersand find_aligned_block double_back_slash_else main_formatting individual_padding multicolumn_padding multicolumn_pre_check multicolumn_post_check dont_measure hidden_child_cell_row_width hidden_child_row_width get_column_width/; +our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321 +our @EXPORT_OK + = qw/align_at_ampersand find_aligned_block double_back_slash_else main_formatting individual_padding multicolumn_padding multicolumn_pre_check multicolumn_post_check dont_measure hidden_child_cell_row_width hidden_child_row_width get_column_width/; our $alignmentBlockCounter; -our @cellStorage; # two-dimensional storage array containing the cell information -our @formattedBody; # array for the new body +our @cellStorage; # two-dimensional storage array containing the cell information +our @formattedBody; # array for the new body our @minMultiColSpan; our @maxColumnWidth; our @maxDelimiterWidth; -sub find_aligned_block{ +sub find_aligned_block { my $self = shift; - return unless (${$self}{body} =~ m/(?!<\\)%\*\h*\\begin\{/s); + return unless ( ${$self}{body} =~ m/(?!<\\)%\*\h*\\begin\{/s ); # aligned block - # %* \begin{tabular} - # 1 & 2 & 3 & 4 \\ - # 5 & & 6 & \\ - # %* \end{tabular} - $logger->trace('*Searching for ALIGNED blocks marked by comments')if($is_t_switch_active); - $logger->trace(Dumper(\%{$mainSettings{lookForAlignDelims}})) if($is_tt_switch_active); - while( my ($alignmentBlock,$yesno)= each %{$mainSettings{lookForAlignDelims}}){ - if(ref $yesno eq "HASH"){ - $yesno = (defined ${$yesno}{delims} ) ? ${$yesno}{delims} : 1; - } - if($yesno){ + # %* \begin{tabular} + # 1 & 2 & 3 & 4 \\ + # 5 & & 6 & \\ + # %* \end{tabular} + $logger->trace('*Searching for ALIGNED blocks marked by comments') if ($is_t_switch_active); + $logger->trace( Dumper( \%{ $mainSettings{lookForAlignDelims} } ) ) if ($is_tt_switch_active); + while ( my ( $alignmentBlock, $yesno ) = each %{ $mainSettings{lookForAlignDelims} } ) { + if ( ref $yesno eq "HASH" ) { + $yesno = ( defined ${$yesno}{delims} ) ? ${$yesno}{delims} : 1; + } + if ($yesno) { $logger->trace("looking for %*\\begin\{$alignmentBlock\} environments"); my $alignmentRegExp = qr/ @@ -78,9 +80,9 @@ sub find_aligned_block{ ) /sx; - while( ${$self}{body} =~ m/$alignmentRegExp/sx){ + while ( ${$self}{body} =~ m/$alignmentRegExp/sx ) { - ${$self}{body} =~ s/ + ${$self}{body} =~ s/ $alignmentRegExp / # create a new Environment object @@ -104,23 +106,24 @@ sub find_aligned_block{ ${@{${$self}{children}}[-1]}{replacementText}; /xseg; - } - } else { + } + } + else { $logger->trace("*not* looking for $alignmentBlock as $alignmentBlock:$yesno"); - } + } } return; } -sub yaml_modify_line_breaks_settings{ +sub yaml_modify_line_breaks_settings { return; } -sub tasks_particular_to_each_object{ +sub tasks_particular_to_each_object { return; } -sub create_unique_id{ +sub create_unique_id { my $self = shift; $alignmentBlockCounter++; @@ -128,55 +131,56 @@ sub create_unique_id{ return; } -sub align_at_ampersand{ +sub align_at_ampersand { my $self = shift; - return if(${$self}{bodyLineBreaks}==0); + return if ( ${$self}{bodyLineBreaks} == 0 ); # some blocks may contain verbatim to be measured - ${$self}{measureVerbatim} = (${$self}{body}=~m/$tokens{verbatim}/ ? 1 : 0); + ${$self}{measureVerbatim} = ( ${$self}{body} =~ m/$tokens{verbatim}/ ? 1 : 0 ); my $maximumNumberOfAmpersands = 0; # clear the global arrays - @formattedBody = (); - @cellStorage = (); - @minMultiColSpan = (); - @maxColumnWidth = (); + @formattedBody = (); + @cellStorage = (); + @minMultiColSpan = (); + @maxColumnWidth = (); @maxDelimiterWidth = (); # maximum column widths my @maximumColumnWidths; - my $rowCounter = -1; + my $rowCounter = -1; my $columnCounter = -1; - $logger->trace("*dontMeasure routine, row mode") if(${$self}{dontMeasure} and $is_t_switch_active); + $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})){ + foreach ( split( "\n", ${$self}{body} ) ) { $rowCounter++; # default is to measure this row, but it can be switched off by the dont_measure routine ${$self}{measureRow} = 1; # call the dont_measure routine - $self->dont_measure(mode=>"row",row=>$_) if ${$self}{dontMeasure}; + $self->dont_measure( mode => "row", row => $_ ) if ${$self}{dontMeasure}; # remove \\ and anything following it my $endPiece = q(); - if($_ =~ m/(\\\\.*)/){ - if(${$self}{alignFinalDoubleBackSlash} ){ + if ( $_ =~ m/(\\\\.*)/ ) { + if ( ${$self}{alignFinalDoubleBackSlash} ) { + # for example, if we want: # # Name & \shortstack{Hi \\ Lo} \\