summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/latexindent
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-12-15 21:32:28 +0000
committerKarl Berry <karl@freefriends.org>2021-12-15 21:32:28 +0000
commit92339a6135ff2c1d0e09d6d874ba6fabcf76ad3c (patch)
tree1499224afa81769368e05c68b6430f4875f1ba66 /Master/texmf-dist/scripts/latexindent
parent3490a6975c406c488e702647f2f5605b6053a262 (diff)
latexindent (15dec21)
git-svn-id: svn://tug.org/texlive/trunk@61316 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm6
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm8
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm1
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm8
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm8
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm8
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm8
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm4
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/defaultSettings.yaml5
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl2
10 files changed, 48 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
index c989b201521..5be50847293 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
@@ -247,15 +247,15 @@ sub find_objects{
}
# search for environments
- $logger->trace('looking for ENVIRONMENTS') if $is_t_switch_active;
+ $logger->trace('*looking for ENVIRONMENTS') if $is_t_switch_active;
$self->find_environments if ${$self}{body} =~ m/$environmentBasicRegExp/s;
# search for ifElseFi blocks
- $logger->trace('looking for IFELSEFI') if $is_t_switch_active;
+ $logger->trace('*looking for IFELSEFI') if $is_t_switch_active;
$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;
+ $logger->trace('*looking for HEADINGS (chapter, section, part, etc)') if $is_t_switch_active;
$self->find_heading if ${$self}{body} =~ m/$allHeadingsRegexp/s;
# the ordering of finding commands and special code blocks can change
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
index 12c8d6e1916..0f51dfec567 100755
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Environment.pm
@@ -109,6 +109,14 @@ sub tasks_particular_to_each_object{
${${$self}{linebreaksAtEnd}}{body} = 1;
}
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for items as the first order of business
$self->find_items if ${$mainSettings{indentAfterItems}}{${$self}{name}};
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
index 113106e88ee..bb88a5a8b16 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm
@@ -49,6 +49,7 @@ our @alignAtAmpersandInformation = ( {name=>"lookForAlignDelims",yamlname=>"de
{name=>"delimiterRegEx",default=>"(?<!\\\\)(&)"},
{name=>"delimiterJustification",default=>"left"},
{name=>"leadingBlankColumn",default=>-1},
+ {name=>"lookForChildCodeBlocks",default=>1},
);
sub yaml_read_settings{
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
index 4e10401ae1f..d9b191d62f5 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm
@@ -43,17 +43,19 @@ sub construct_list_of_items{
# detail items in the log
$logger->trace("*List of items: $listOfItems (see itemNames)") if $is_t_switch_active;
+ my $itemCanBeFollowedBy = qr/${${$mainSettings{fineTuning}}{items}}{canBeFollowedBy}/;
+
$itemRegExp = qr/
(
- \\((?:$listOfItems)(?:\[[^]]*?\])?(?!\S))
+ \\((?:$listOfItems)(?:$itemCanBeFollowedBy)?(?!\S))
\h*
(\R*)?
)
(
(?: # cluster-only (), don't capture
(?!
- (?:\\(?:(?:$listOfItems)(?:\[[^]]*?\])?(?!\S))) # cluster-only (), don't capture
- ). # any character, but not \\$item
+ (?:\\(?:(?:$listOfItems)(?:$itemCanBeFollowedBy)?(?!\S))) # cluster-only (), don't capture
+ ). # any character, but not \\$item
)*
)
(\R)?
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
index b5b3ac8de6f..a7b4e2088ae 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/MandatoryArgument.pm
@@ -122,6 +122,14 @@ sub yaml_get_object_attribute_for_indentation_settings{
sub tasks_particular_to_each_object{
my $self = shift;
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308-command.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for ifElseFi blocks
$self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
index fdaa549a7ae..31e7b8f51e1 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/OptionalArgument.pm
@@ -107,6 +107,14 @@ sub create_unique_id{
sub tasks_particular_to_each_object{
my $self = shift;
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308-command.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for ifElseFi blocks
$self->find_ifelsefi if ${$self}{body} =~ m/$ifElseFiBasicRegExp/s;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
index 4b585f42aef..8d7346324da 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Special.pm
@@ -238,6 +238,14 @@ sub tasks_particular_to_each_object{
return unless(${$mainSettings{specialBeginEnd}}{specialBeforeCommand});
+ # lookForAlignDelims: lookForChildCodeBlocks set to 0 means no child objects searched for
+ # see: test-cases/alignment/issue-308-special.tex
+ #
+ if( defined ${$self}{lookForChildCodeBlocks} and !${$self}{lookForChildCodeBlocks} ){
+ $logger->trace("lookForAlignDelims: lookForChildCodeBlocks set to 0, so child objects will *NOT* be searched for") if($is_t_switch_active);
+ return;
+ }
+
# search for commands with arguments
$self->find_commands_or_key_equals_values_braces;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
index 4d320379f92..8d774311c6e 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.13.2';
-our $versionDate = '2021-11-15';
+our $versionNumber = '3.13.3';
+our $versionDate = '2021-12-13';
1
diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
index e8d3858084c..da8cb898f2d 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.13.2, 2021-11-15
+# defaultSettings.yaml for latexindent.pl, version 3.13.3, 2021-12-13
# a script that aims to
# beautify .tex, .sty, .cls files
#
@@ -166,6 +166,7 @@ lookForAlignDelims:
dontMeasure: 0
delimiterRegEx: '(?<!\\)(&)'
delimiterJustification: left
+ lookForChildCodeBlocks: 1
tabularx:
delims: 1
longtable: 1
@@ -633,6 +634,8 @@ fineTuning:
name: '(?!@?if[a-zA-Z@]*?\{)@?if[a-zA-Z@]*?'
commands:
name: '[+a-zA-Z@\*0-9_\:]+?'
+ items:
+ canBeFollowedBy: '(?:\[[^]]*?\])|(?:<[^>]*?>)'
keyEqualsValuesBracesBrackets:
name: '[a-zA-Z@\*0-9_\/.:\#-]+[a-zA-Z@\*0-9_\/.\h\{\}:\#-]*?'
follow: '(?:(?<!\\)\{)|,|(?:(?<!\\)\[)'
diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl
index b02c2180ff2..a4987092cee 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.13.2, 2021-11-15
+# latexindent.pl, version 3.13.3, 2021-12-13
#
# 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