summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexindent
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-06-08 22:10:31 +0000
committerKarl Berry <karl@freefriends.org>2018-06-08 22:10:31 +0000
commited97aa4d4d77a6cb020570b4502db91b233f4fb2 (patch)
tree6db5db41a0c71dbaed96a2e83095e551d3741984 /Master/texmf-dist/scripts/latexindent
parent9b33ad18278c204e27ce93e5f43d292a325df899 (diff)
latexindent (9jun18)
git-svn-id: svn://tug.org/texlive/trunk@47964 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Braces.pm3
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm32
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm9
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm18
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm12
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm5
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Heading.pm5
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm3
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm6
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm11
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm2
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm6
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm6
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm11
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm9
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm4
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/defaultSettings.yaml23
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl2
18 files changed, 97 insertions, 70 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Braces.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Braces.pm
index b1c8fc47555..4861dd1f6a6 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Braces.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Braces.pm
@@ -26,8 +26,9 @@ use LatexIndent::LogFile qw/$logger/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
-our @EXPORT_OK = qw/find_commands_or_key_equals_values_braces/;
+our @EXPORT_OK = qw/find_commands_or_key_equals_values_braces $braceBracketRegExpBasic/;
our $commandCounter;
+our $braceBracketRegExpBasic = qr/\{|\[/;
sub find_commands_or_key_equals_values_braces{
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
index 03817c8d7cf..48d93c622d5 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
@@ -38,21 +38,21 @@ use LatexIndent::DoubleBackSlash qw/dodge_double_backslash un_dodge_double_backs
# code blocks
use LatexIndent::Verbatim qw/put_verbatim_back_in find_verbatim_environments find_noindent_block find_verbatim_commands put_verbatim_commands_back_in/;
-use LatexIndent::Environment qw/find_environments/;
-use LatexIndent::IfElseFi qw/find_ifelsefi construct_ifelsefi_regexp/;
+use LatexIndent::Environment qw/find_environments $environmentBasicRegExp/;
+use LatexIndent::IfElseFi qw/find_ifelsefi construct_ifelsefi_regexp $ifElseFiBasicRegExp/;
use LatexIndent::Else qw/check_for_else_statement/;
use LatexIndent::Arguments qw/get_arguments_regexp find_opt_mand_arguments get_numbered_arg_regexp construct_arguments_regexp/;
use LatexIndent::OptionalArgument qw/find_optional_arguments/;
use LatexIndent::MandatoryArgument qw/find_mandatory_arguments get_mand_arg_reg_exp/;
use LatexIndent::RoundBrackets qw/find_round_brackets/;
use LatexIndent::Item qw/find_items construct_list_of_items/;
-use LatexIndent::Braces qw/find_commands_or_key_equals_values_braces/;
+use LatexIndent::Braces qw/find_commands_or_key_equals_values_braces $braceBracketRegExpBasic/;
use LatexIndent::Command qw/construct_command_regexp/;
use LatexIndent::KeyEqualsValuesBraces qw/construct_key_equals_values_regexp/;
use LatexIndent::NamedGroupingBracesBrackets qw/construct_grouping_braces_brackets_regexp/;
use LatexIndent::UnNamedGroupingBracesBrackets qw/construct_unnamed_grouping_braces_brackets_regexp/;
-use LatexIndent::Special qw/find_special construct_special_begin/;
-use LatexIndent::Heading qw/find_heading construct_headings_levels/;
+use LatexIndent::Special qw/find_special construct_special_begin $specialBeginAndBracesBracketsBasicRegExp $specialBeginBasicRegExp/;
+use LatexIndent::Heading qw/find_heading construct_headings_levels $allHeadingsRegexp/;
use LatexIndent::FileContents qw/find_file_contents_environments_and_preamble/;
use LatexIndent::Preamble;
@@ -181,18 +181,18 @@ sub find_objects{
# search for environments
$logger->trace('looking for ENVIRONMENTS') if $is_t_switch_active;
- $self->find_environments;
+ $self->find_environments if ${$self}{body} =~ m/$environmentBasicRegExp/s;
# search for ifElseFi blocks
$logger->trace('looking for IFELSEFI') if $is_t_switch_active;
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
# search for headings (part, chapter, section, setc)
$logger->trace('looking for HEADINGS (chapter, section, part, etc)') if $is_t_switch_active;
- $self->find_heading;
+ $self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# the ordering of finding commands and special code blocks can change
- $self->find_commands_or_key_equals_values_braces_and_special;
+ $self->find_commands_or_key_equals_values_braces_and_special if ${$self}{body} =~ m/$specialBeginAndBracesBracketsBasicRegExp/s;
# documents without preamble need a manual call to the paragraph_one_line routine
if ($is_m_switch_active and !${$self}{preamblePresent}){
@@ -222,19 +222,19 @@ sub find_commands_or_key_equals_values_braces_and_special{
if(${$masterSettings{specialBeginEnd}}{specialBeforeCommand}){
# search for special begin/end
$logger->trace('looking for SPECIAL begin/end *before* looking for commands (see specialBeforeCommand)') if $is_t_switch_active;
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
# search for commands with arguments
$logger->trace('looking for COMMANDS and key = {value}') if $is_t_switch_active;
- $self->find_commands_or_key_equals_values_braces;
+ $self->find_commands_or_key_equals_values_braces if ${$self}{body} =~ m/$braceBracketRegExpBasic/s;
} else {
# search for commands with arguments
$logger->trace('looking for COMMANDS and key = {value}') if $is_t_switch_active;
- $self->find_commands_or_key_equals_values_braces;
+ $self->find_commands_or_key_equals_values_braces if ${$self}{body} =~ m/$braceBracketRegExpBasic/s;
# search for special begin/end
$logger->trace('looking for SPECIAL begin/end') if $is_t_switch_active;
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
}
return;
}
@@ -311,13 +311,13 @@ sub tasks_common_to_each_object{
$self->adjust_replacement_text_line_breaks_at_end;
# modify line breaks on body and end statements
- $self->modify_line_breaks_body;
+ $self->modify_line_breaks_body if $is_m_switch_active;
# modify line breaks end statements
- $self->modify_line_breaks_end;
+ $self->modify_line_breaks_end if $is_m_switch_active;
# check the body for current children
- $self->check_for_hidden_children;
+ $self->check_for_hidden_children if ${$self}{body} =~ m/$tokens{beginOfToken}/;
return;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
index 0403de6adb2..698fc6c1b90 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
@@ -20,6 +20,9 @@ use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::Switches qw/$is_m_switch_active $is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::Braces qw/$braceBracketRegExpBasic/;
+use LatexIndent::Special qw/$specialBeginAndBracesBracketsBasicRegExp/;
+use LatexIndent::Heading qw/$allHeadingsRegexp/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
@@ -99,13 +102,13 @@ sub tasks_particular_to_each_object{
my $self = shift;
# search for headings (important to do this before looking for commands!)
- $self->find_heading;
+ $self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# search for commands and special code blocks
- $self->find_commands_or_key_equals_values_braces_and_special;
+ $self->find_commands_or_key_equals_values_braces_and_special if ${$self}{body} =~ m/$specialBeginAndBracesBracketsBasicRegExp/s;
# search for arguments
- $self->find_opt_mand_arguments;
+ $self->find_opt_mand_arguments if ${$self}{body} =~ m/$braceBracketRegExpBasic/s;
return;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
index b3b5b431855..2ecaf6d4e36 100755
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
@@ -18,13 +18,19 @@ use strict;
use warnings;
use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
+use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::Braces qw/$braceBracketRegExpBasic/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
+use LatexIndent::Heading qw/$allHeadingsRegexp/;
+use LatexIndent::Special qw/$specialBeginAndBracesBracketsBasicRegExp/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
-our @EXPORT_OK = qw/find_environments/;
+our @EXPORT_OK = qw/find_environments $environmentBasicRegExp/;
our $environmentCounter;
+our $environmentBasicRegExp = qr/\\begin\{/;
# store the regular expresssion for matching and replacing the \begin{}...\end{} statements
our $environmentRegExp = qr/
@@ -99,19 +105,19 @@ sub tasks_particular_to_each_object{
}
# search for items as the first order of business
- $self->find_items;
+ $self->find_items if ${$masterSettings{indentAfterItems}}{${$self}{name}};
# search for headings (important to do this before looking for commands!)
- $self->find_heading;
+ $self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# search for commands and special code blocks
- $self->find_commands_or_key_equals_values_braces_and_special;
+ $self->find_commands_or_key_equals_values_braces_and_special if ${$self}{body} =~ m/$specialBeginAndBracesBracketsBasicRegExp/s;
# search for arguments
- $self->find_opt_mand_arguments;
+ $self->find_opt_mand_arguments if ${$self}{body} =~ m/$braceBracketRegExpBasic/s;
# search for ifElseFi blocks
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm
index 5ef487f9866..f3fba5fab75 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileContents.pm
@@ -20,6 +20,10 @@ use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::Environment qw/$environmentBasicRegExp/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
+use LatexIndent::Special qw/$specialBeginAndBracesBracketsBasicRegExp/;
+use LatexIndent::Heading qw/$allHeadingsRegexp/;
use Data::Dumper;
use Exporter qw/import/;
our @EXPORT_OK = qw/find_file_contents_environments_and_preamble/;
@@ -216,16 +220,16 @@ sub tasks_particular_to_each_object{
my $self = shift;
# search for environments
- $self->find_environments;
+ $self->find_environments if ${$self}{body} =~ m/$environmentBasicRegExp/s;
# search for ifElseFi blocks
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
# search for headings (part, chapter, section, setc)
- $self->find_heading;
+ $self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# search for commands and special code blocks
- $self->find_commands_or_key_equals_values_braces_and_special;
+ $self->find_commands_or_key_equals_values_braces_and_special if ${$self}{body} =~ m/$specialBeginAndBracesBracketsBasicRegExp/s;
}
1;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
index 8fb07087c35..00af6ab2ae4 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
@@ -455,7 +455,7 @@ sub get_indentation_settings_for_this_object{
$self->alignment_at_ampersand_settings;
# check for line break settings
- $self->modify_line_breaks_settings;
+ $self->modify_line_breaks_settings if $is_m_switch_active;
# store the settings
%{${previouslyFoundSettings}{$storageName}} = (
@@ -535,9 +535,6 @@ sub alignment_at_ampersand_settings{
}
sub modify_line_breaks_settings{
- # return with undefined values unless the -m switch is active
- return unless $is_m_switch_active;
-
my $self = shift;
# grab the logging object
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Heading.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Heading.pm
index 3dca1b7eefb..82957e182f1 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Heading.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Heading.pm
@@ -21,10 +21,11 @@ use LatexIndent::Switches qw/$is_m_switch_active $is_t_switch_active $is_tt_swit
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::Special qw/$specialBeginBasicRegExp/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
-our @EXPORT_OK = qw/find_heading construct_headings_levels/;
+our @EXPORT_OK = qw/find_heading construct_headings_levels $allHeadingsRegexp/;
our $headingCounter;
our @headingsRegexpArray;
our $allHeadingsRegexp = q();
@@ -226,7 +227,7 @@ sub tasks_particular_to_each_object{
}
# search for special begin/end
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
return;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm
index 768ec1651f9..1ddfa1bb537 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/HiddenChildren.pm
@@ -156,9 +156,6 @@ sub check_for_hidden_children{
my $self = shift;
- # if there are no hidden children, then exit
- return if ${$self}{body} !~ m/$tokens{beginOfToken}/;
-
# grab the matches
my @matched = (${$self}{body} =~ /((?:$tokens{ifelsefiSpecial})?$tokens{beginOfToken}.[-a-z0-9]+?$tokens{endOfToken})/ig);
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm
index ecceb00fec6..29a0065bfe6 100755
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm
@@ -20,12 +20,14 @@ use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::Switches qw/$is_m_switch_active $is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::Heading qw/$allHeadingsRegexp/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
-our @EXPORT_OK = qw/find_ifelsefi construct_ifelsefi_regexp/;
+our @EXPORT_OK = qw/find_ifelsefi construct_ifelsefi_regexp $ifElseFiBasicRegExp/;
our $ifElseFiCounter;
our $ifElseFiRegExp;
+our $ifElseFiBasicRegExp = qr/\\if/;
# store the regular expresssion for matching and replacing the \if...\else...\fi statements
# note: we search for \else separately in an attempt to keep this regexp a little more managable
@@ -148,7 +150,7 @@ sub tasks_particular_to_each_object{
);
# search for headings (important to do this before looking for commands!)
- $self->find_heading;
+ $self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# search for commands and special code blocks
$self->find_commands_or_key_equals_values_braces_and_special;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
index 8a72257e70d..f9fbf8dd4b6 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
@@ -21,6 +21,9 @@ use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
+use LatexIndent::Special qw/$specialBeginAndBracesBracketsBasicRegExp/;
+use LatexIndent::Heading qw/$allHeadingsRegexp/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
@@ -66,8 +69,6 @@ sub find_items{
my $self = shift;
- return unless ${$masterSettings{indentAfterItems}}{${$self}{name}};
-
# otherwise loop through the item names
$logger->trace("Searching for items (see itemNames) in ${$self}{name} (see indentAfterItems)") if $is_t_switch_active;
$logger->trace(Dumper(\%{$masterSettings{itemNames}})) if $is_tt_switch_active;
@@ -123,13 +124,13 @@ sub tasks_particular_to_each_object{
${${$self}{linebreaksAtEnd}}{body}=1 if(${$self}{body} =~ m/\R+$/s );
# search for ifElseFi blocks
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
# search for headings (part, chapter, section, setc)
- $self->find_heading;
+ $self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# search for commands and special code blocks
- $self->find_commands_or_key_equals_values_braces_and_special;
+ $self->find_commands_or_key_equals_values_braces_and_special if ${$self}{body} =~ m/$specialBeginAndBracesBracketsBasicRegExp/s;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
index ff118352762..8f3dee24066 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
@@ -159,6 +159,8 @@ ENDQUOTE
$logger->info("Filename: ${$self}{fileName}");
} else {
$logger->info("Reading input from STDIN");
+ my $buttonText = ($FindBin::Script eq 'latexindent.exe') ? 'CTRL+Z followed by ENTER':'CTRL+D';
+ print "Please enter text to be indented: (press $buttonText when finished)\n";
}
# log the switches from the user
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
index 51fc9e64d39..ba6e220d09e 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
@@ -20,6 +20,8 @@ use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
+use LatexIndent::Special qw/$specialBeginBasicRegExp/;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
our @EXPORT_OK = qw/find_mandatory_arguments get_mand_arg_reg_exp/;
@@ -121,10 +123,10 @@ sub tasks_particular_to_each_object{
my $self = shift;
# search for ifElseFi blocks
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
# search for special begin/end
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
index 2b18f3c966b..f98acac4874 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
@@ -20,6 +20,8 @@ use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
+use LatexIndent::Special qw/$specialBeginBasicRegExp/;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
our @EXPORT_OK = qw/find_optional_arguments/;
@@ -106,10 +108,10 @@ sub tasks_particular_to_each_object{
my $self = shift;
# search for ifElseFi blocks
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
# search for special begin/end
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm
index fea38af0b64..306b423e5a9 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Preamble.pm
@@ -20,6 +20,9 @@ use LatexIndent::Tokens qw/%tokens/;
use LatexIndent::Switches qw/$is_t_switch_active/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::Environment qw/$environmentBasicRegExp/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
+use LatexIndent::Special qw/$specialBeginBasicRegExp/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
our $preambleCounter;
@@ -49,14 +52,14 @@ sub tasks_particular_to_each_object{
my $self = shift;
# search for environments
- $self->find_environments;
+ $self->find_environments if ${$self}{body} =~ m/$environmentBasicRegExp/;
# search for ifElseFi blocks
- $self->find_ifelsefi;
+ $self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
if(${$masterSettings{specialBeginEnd}}{specialBeforeCommand}){
# search for special begin/end
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
# search for commands with arguments
$self->find_commands_or_key_equals_values_braces if(!$masterSettings{preambleCommandsBeforeEnvironments});
@@ -65,7 +68,7 @@ sub tasks_particular_to_each_object{
$self->find_commands_or_key_equals_values_braces if(!$masterSettings{preambleCommandsBeforeEnvironments});
# search for special begin/end
- $self->find_special;
+ $self->find_special if ${$self}{body} =~ m/$specialBeginBasicRegExp/s;
}
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
index 45dd4c3ec16..aa17f24df13 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
@@ -21,14 +21,17 @@ use LatexIndent::TrailingComments qw/$trailingCommentRegExp/;
use LatexIndent::GetYamlSettings qw/%masterSettings/;
use LatexIndent::Switches qw/$is_t_switch_active $is_tt_switch_active/;
use LatexIndent::LogFile qw/$logger/;
+use LatexIndent::IfElseFi qw/$ifElseFiBasicRegExp/;
use Data::Dumper;
use Exporter qw/import/;
our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321
-our @EXPORT_OK = qw/find_special construct_special_begin/;
+our @EXPORT_OK = qw/find_special construct_special_begin $specialBeginAndBracesBracketsBasicRegExp $specialBeginBasicRegExp/;
our $specialCounter;
our $specialBegins = q();
our $specialAllMatchesRegExp = q();
our %individualSpecialRegExps;
+our $specialBeginAndBracesBracketsBasicRegExp;
+our $specialBeginBasicRegExp;
sub construct_special_begin{
my $self = shift;
@@ -102,6 +105,10 @@ sub construct_special_begin{
$logger->trace("*The overall special regexp is: (see specialBeginEnd)") if $is_tt_switch_active;
$logger->trace($specialAllMatchesRegExp) if $is_tt_switch_active;
+ # basic special begin regexp
+ $specialBeginBasicRegExp = qr/$specialBegins/;
+ $specialBeginAndBracesBracketsBasicRegExp = $specialBegins."|\\{|\\[";
+ $specialBeginAndBracesBracketsBasicRegExp = qr/$specialBeginAndBracesBracketsBasicRegExp/;
}
sub find_special{
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
index c048b649a66..bfec70b7942 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
@@ -19,6 +19,6 @@ use warnings;
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.4.2';
-our $versionDate = '2018-04-27';
+our $versionNumber = '3.4.3';
+our $versionDate = '2018-06-08';
1
diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
index 4fa5eed5cc1..785b805eed7 100755
--- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
+++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
@@ -1,4 +1,4 @@
-# defaultSettings.yaml for latexindent.pl, version 3.4.2, 2018-04-27
+# defaultSettings.yaml for latexindent.pl, version 3.4.3, 2018-06-08
# a script that aims to
# beautify .tex, .sty, .cls files
#
@@ -23,8 +23,8 @@
# You're welcome to change anything you like in here, but
# it would probably be better to have your own user settings
-# files somewhere else- remember that this file may be overwritten
-# anytime that you update your distribution. Please see the manual
+# files somewhere else - remember that this file may be overwritten
+# when you update your distribution. Please see the manual
# for details of how to setup your own settings files.
#
# Please read the manual first to understand what each switch does.
@@ -49,9 +49,9 @@ fileExtensionPreference:
# myfileBACKUP.bak
backupExtension: .bak
-# only one backup per file; if onlyOneBackUp is 0 then the
-# number on the extension increments by 1 each time
-# (this is in place as a safety measure) myfile.bak0, myfile.bak1, myfile.bak2
+# only one backup per file; if onlyOneBackUp is 0 then, as a safety measure,
+# the number on the extension increments by 1 each time:
+# myfile.bak0, myfile.bak1, myfile.bak2
#
# if you set onlyOnebackUp to 1, then the backup file will
# be overwritten each time (not recommended until you trust the script)
@@ -88,8 +88,8 @@ logFilePreferences:
trace: "%A%n"
ttrace: "%A%n"
-# verbatim environments- environments specified
-# in this hash table will not be changed at all!
+# verbatim environments specified
+# in this field will not be changed at all!
verbatimEnvironments:
verbatim: 1
lstlisting: 1
@@ -139,8 +139,7 @@ preambleCommandsBeforeEnvironments: 0
# Default value of indentation
defaultIndent: "\t"
-# environments that have tab delimiters, add more
-# as needed
+# name of code blocks that should have their body aligned at ampersand delimiters
lookForAlignDelims:
tabular:
delims: 1
@@ -187,7 +186,7 @@ indentAfterItems:
list: 1
# if you want to use other names for your items (such as, for example, part)
-# then populate them here- note that you can trick latexindent.pl
+# then populate them here; note that you can trick latexindent.pl
# into indenting all kinds of commands (within environments specified in
# indentAfterItems) using this technique.
itemNames:
@@ -250,7 +249,7 @@ maximumIndentation: -1
# if you don't want to have additional indentation
# in an environment put it in this hash table; note that
-# environments in this hash table will inherit
+# environments in this field will inherit
# the *current* level of indentation they just won't
# get any *additional*.
noAdditionalIndent:
diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl
index b49b2a009cc..c9835ccbe37 100755
--- a/Master/texmf-dist/scripts/latexindent/latexindent.pl
+++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# latexindent.pl, version 3.4.2, 2018-04-27
+# latexindent.pl, version 3.4.3, 2018-06-08
#
# 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