diff options
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent')
10 files changed, 171 insertions, 145 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm index 027597b9ef4..0b3ea9b254a 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm @@ -23,6 +23,7 @@ use open ':std', ':encoding(UTF-8)'; # gain access to subroutines in the following modules use LatexIndent::Switches qw/storeSwitches %switches $is_m_switch_active $is_t_switch_active $is_tt_switch_active $is_r_switch_active $is_rr_switch_active $is_rv_switch_active/; use LatexIndent::LogFile qw/processSwitches $logger/; +use LatexIndent::Logger qw/@logFileLines/; use LatexIndent::Replacement qw/make_replacements/; use LatexIndent::GetYamlSettings qw/yaml_read_settings yaml_modify_line_breaks_settings yaml_get_indentation_settings_for_this_object yaml_poly_switch_get_every_or_custom_value yaml_get_indentation_information yaml_get_object_attribute_for_indentation_settings yaml_alignment_at_ampersand_settings yaml_get_textwrap_removeparagraphline_breaks %masterSettings yaml_get_columns/; use LatexIndent::FileExtension qw/file_extension_check/; @@ -151,12 +152,24 @@ sub output_indented_text{ } else { $logger->info("Not outputting to file; see -w and -o switches for more options."); } - + # put the final line in the logfile $logger->info("${$masterSettings{logFilePreferences}}{endLogFileWith}") if ${$masterSettings{logFilePreferences}}{endLogFileWith}; # github info line $logger->info("*Please direct all communication/issues to:\nhttps://github.com/cmhughes/latexindent.pl") if ${$masterSettings{logFilePreferences}}{showGitHubInfoFooter}; + + # open log file + my $logfileName = $switches{logFileName}||"indent.log"; + my $logfile; + open($logfile,">","${$self}{cruftDirectory}/$logfileName") or die "Can't open $logfileName"; + + foreach my $line (@{LatexIndent::Logger::logFileLines}){ + print $logfile $line,"\n"; + } + + # close log file + close($logfile); # output to screen, unless silent mode print ${$self}{body} unless $switches{silentMode}; diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm index 716598de777..499ca9f65a4 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm @@ -21,17 +21,14 @@ use PerlIO::encoding; use open ':std', ':encoding(UTF-8)'; use File::Basename; # to get the filename and directory path use Exporter qw/import/; -use Log::Log4perl qw(get_logger :levels); use LatexIndent::GetYamlSettings qw/%masterSettings/; use LatexIndent::Switches qw/%switches/; +use LatexIndent::LogFile qw/$logger/; our @EXPORT_OK = qw/file_extension_check/; sub file_extension_check{ my $self = shift; - # grab the logger object - my $logger = get_logger("Document"); - # grab the filename my $fileName = ${$self}{fileName}; diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm index e46eccf3809..4be1d3a97bf 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/GetYamlSettings.pm @@ -21,8 +21,8 @@ use YAML::Tiny; # interpret defaultSettings.yaml and other potent use File::Basename; # to get the filename and directory path use File::HomeDir; use Cwd; -use Log::Log4perl qw(get_logger :levels); use Exporter qw/import/; +use LatexIndent::LogFile qw/$logger/; our @EXPORT_OK = qw/yaml_read_settings yaml_modify_line_breaks_settings yaml_get_indentation_settings_for_this_object yaml_poly_switch_get_every_or_custom_value yaml_get_indentation_information yaml_get_object_attribute_for_indentation_settings yaml_alignment_at_ampersand_settings yaml_get_textwrap_removeparagraphline_breaks %masterSettings yaml_get_columns/; # Read in defaultSettings.YAML file @@ -56,7 +56,6 @@ sub yaml_read_settings{ $defaultSettings = YAML::Tiny->read( "$FindBin::RealBin/defaultSettings.yaml" ) if ( -e "$FindBin::RealBin/defaultSettings.yaml" ); # grab the logger object - my $logger = get_logger("Document"); $logger->info("*YAML settings read: defaultSettings.yaml\nReading defaultSettings.yaml from $FindBin::RealBin/defaultSettings.yaml"); # if latexindent.exe is invoked from TeXLive, then defaultSettings.yaml won't be in @@ -87,7 +86,7 @@ sub yaml_read_settings{ # if indentconfig.yaml doesn't exist, check for the hidden file, .indentconfig.yaml $indentconfig = "$homeDir/.indentconfig.yaml" if(! -e $indentconfig); - + # messages for indentconfig.yaml and/or .indentconfig.yaml if ( -e $indentconfig and !$switches{onlyDefault}) { # read the absolute paths from indentconfig.yaml @@ -126,7 +125,17 @@ sub yaml_read_settings{ $logger->info("Home directory is $homeDir (didn't find either indentconfig.yaml or .indentconfig.yaml)\nTo specify user settings you would put indentconfig.yaml here: $homeDir/indentconfig.yaml\nAlternatively, you can use the hidden file .indentconfig.yaml as: $homeDir/.indentconfig.yaml"); } } - + + # default value of readLocalSettings + # + # latexindent -l myfile.tex + # + # means that we wish to use localSettings.yaml + if(defined($switches{readLocalSettings}) and ($switches{readLocalSettings} eq '')){ + $logger->info('*-l switch used without filename, will search for the following files in turn:'); + $logger->info('localSettings.yaml,latexindent.yaml,.localSettings.yaml,.latexindent.yaml'); + $switches{readLocalSettings} = 'localSettings.yaml,latexindent.yaml,.localSettings.yaml,.latexindent.yaml'; + } # local settings can be called with a + symbol, for example # -l=+myfile.yaml @@ -149,12 +158,14 @@ sub yaml_read_settings{ $switches{readLocalSettings} =~ s/\h*$//g; $switches{readLocalSettings} =~ s/\h*,\h*/,/g; if($switches{readLocalSettings} =~ m/\+/){ - $logger->info("+ found in call for -l switch: will add localSettings.yaml"); + $logger->info("+ found in call for -l switch: will add localSettings.yaml,latexindent.yaml,.localSettings.yaml,.latexindent.yaml"); # + can be either at the beginning or the end, which determines if where the comma should go my $commaAtBeginning = ($switches{readLocalSettings} =~ m/^\h*\+/ ? q() : ","); my $commaAtEnd = ($switches{readLocalSettings} =~ m/^\h*\+/ ? "," : q()); - $switches{readLocalSettings} =~ s/\h*\+\h*/$commaAtBeginning."localSettings.yaml".$commaAtEnd/e; + $switches{readLocalSettings} =~ s/\h*\+\h*/$commaAtBeginning + ."localSettings.yaml,latexindent.yaml,.localSettings.yaml,.latexindent.yaml" + .$commaAtEnd/ex; $logger->info("New value of -l switch: $switches{readLocalSettings}"); } @@ -197,7 +208,15 @@ sub yaml_read_settings{ $logger->info("Adding $_ to YAML read paths"); push(@absPaths,"$_"); } elsif ( !(-e $_) ) { - $logger->warn("*yaml file not found: $_ not found. Proceeding without it."); + if ( ($_ =~ m/localSettings|latexindent/s + and !(-e 'localSettings.yaml') + and !(-e '.localSettings.yaml') + and !(-e 'latexindent.yaml') + and !(-e '.latexindent.yaml')) + or $_ !~ m/localSettings|latexindent/s + ){ + $logger->warn("*yaml file not found: $_ not found. Proceeding without it."); + } } } @@ -328,6 +347,10 @@ sub yaml_read_settings{ push(@yamlSettings,$switches{yaml}); } + foreach (@yamlSettings){ + $logger->info("YAML setting: ".$_); + } + # it is possible to specify, for example, # # -y=indentAfterHeadings:paragraph:indentAfterThisHeading:1;level:1 @@ -348,8 +371,18 @@ sub yaml_read_settings{ # increment the counter $settingsCounter++; + # need to be careful in splitting at ';' + # + # motivation as detailed in https://github.com/cmhughes/latexindent.pl/issues/243 + # + # latexindent.pl -m -y='modifyLineBreaks:oneSentencePerLine:manipulateSentences: 1, + # modifyLineBreaks:oneSentencePerLine:sentencesBeginWith:a-z: 1, + # fineTuning:modifyLineBreaks:betterFullStop: "(?:\.|;|:(?![a-z]))|(?:(?<!(?:(?:e\.g)|(?:i\.e)|(?:etc))))\.(?!(?:[a-z]|[A-Z]|\-|~|\,|[0-9]))"' myfile.tex + # + # in particular, the fineTuning part needs care in treating the argument between the quotes + # check for a match of the ; - if($_ =~ m/(?<!\\);/){ + if($_ !~ m/(?<!(?:\\))"/ and $_ =~ m/(?<!\\);/){ my (@subfield) = split(/(?<!\\);/,$_); # the content up to the first ; is called the 'root' @@ -403,8 +436,43 @@ sub yaml_read_settings{ # loop through each of the settings specified in the -y switch foreach(@yamlSettings){ - # split each value at semi-colon - my (@keysValues) = split(/(?<!(?:\\|\[)):(?!\])/,$_); + + my @keysValues; + + # as above, need to be careful in splitting at ':' + # + # motivation as detailed in https://github.com/cmhughes/latexindent.pl/issues/243 + # + # latexindent.pl -m -y='modifyLineBreaks:oneSentencePerLine:manipulateSentences: 1, + # modifyLineBreaks:oneSentencePerLine:sentencesBeginWith:a-z: 1, + # fineTuning:modifyLineBreaks:betterFullStop: "(?:\.|;|:(?![a-z]))|(?:(?<!(?:(?:e\.g)|(?:i\.e)|(?:etc))))\.(?!(?:[a-z]|[A-Z]|\-|~|\,|[0-9]))"' myfile.tex + # + # in particular, the fineTuning part needs care in treating the argument between the quotes + + if ($_ =~ m/(?<!(?:\\))"/){ + my (@splitAtQuote) = split(/(?<!(?:\\))"/,$_); + $logger->info("quote found in -y switch"); + $logger->info("key: ".$splitAtQuote[0]); + + # definition check + $splitAtQuote[1] = '' if not defined $splitAtQuote[1]; + + # then log the value + $logger->info("value: ".$splitAtQuote[1]); + + # split at : + (@keysValues) = split(/(?<!(?:\\|\[)):(?!\])/,$splitAtQuote[0]); + + # tabs need special attention + if ($splitAtQuote[1] =~ m/\\t/){ + $splitAtQuote[1] = '"'.$splitAtQuote[1].'"'; + } + push(@keysValues,$splitAtQuote[1]); + } + else { + # split each value at semi-colon + (@keysValues) = split(/(?<!(?:\\|\[)):(?!\])/,$_); + } # $value will always be the last element my $value = $keysValues[-1]; @@ -471,9 +539,6 @@ sub yaml_get_indentation_settings_for_this_object{ # create a name for previously found settings my $storageName = ${$self}{name}.${$self}{modifyLineBreaksYamlName}.(defined ${$self}{storageNameAppend}?${$self}{storageNameAppend}:q()); - # grab the logging object - my $logger = get_logger("Document"); - # check for storage of repeated objects if ($previouslyFoundSettings{$storageName}){ $logger->trace("*Using stored settings for $storageName") if($is_t_switch_active); @@ -573,9 +638,6 @@ sub yaml_alignment_at_ampersand_settings{ sub yaml_modify_line_breaks_settings{ my $self = shift; - # grab the logging object - my $logger = get_logger("Document"); - # details to the log file $logger->trace("*-m modifylinebreaks switch active") if $is_t_switch_active; $logger->trace("looking for polyswitch, textWrapOptions, removeParagraphLineBreaks, oneSentencePerLine settings for ${$self}{name} ") if $is_t_switch_active; @@ -601,9 +663,6 @@ sub yaml_modify_line_breaks_settings{ sub yaml_get_textwrap_removeparagraphline_breaks{ my $self = shift; - # grab the logging object - my $logger = get_logger("Document"); - # textWrap and removeParagraphLineBreaks settings foreach ("textWrapOptions","removeParagraphLineBreaks"){ @@ -789,9 +848,6 @@ sub yaml_poly_switch_get_every_or_custom_value{ my $toBeAssignedTo = $input{toBeAssignedTo}; my $toBeAssignedToAlias = $input{toBeAssignedToAlias}; - # grab the logging object - my $logger = get_logger("Document"); - # alias if(${$self}{aliases}{$toBeAssignedTo}){ $logger->trace("aliased $toBeAssignedTo using ${$self}{aliases}{$toBeAssignedTo}") if($is_t_switch_active); @@ -871,9 +927,6 @@ sub yaml_get_indentation_information{ # if the YamlName is not optionalArguments, mandatoryArguments, heading (possibly others) then assume we're looking for 'body' my $YamlName = $self->yaml_get_object_attribute_for_indentation_settings; - # grab the logging object - my $logger = get_logger("Document"); - my $indentationInformation; foreach my $indentationAbout ("noAdditionalIndent","indentRules"){ # check that the 'thing' is defined @@ -912,8 +965,8 @@ sub yaml_get_indentation_information{ if(${$masterSettings{$globalInformation}}{$YamlName}=~m/^\h*$/){ $logger->trace("$globalInformation specified for $YamlName (see $globalInformation)") if $is_t_switch_active; return ${$masterSettings{$globalInformation}}{$YamlName}; - } else { - $logger->trace("$globalInformation specified (${$masterSettings{$globalInformation}}{$YamlName}) for $YamlName, but it needs to only contain horizontal space -- I'm ignoring this one") if $is_t_switch_active; + } elsif (${$masterSettings{$globalInformation}}{$YamlName} ne '0') { + $logger->warn("$globalInformation specified (${$masterSettings{$globalInformation}}{$YamlName}) for $YamlName, but it needs to only contain horizontal space -- I'm ignoring this one"); } } } diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm index 056b36d8c3e..e7e363b04c6 100755 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/IfElseFi.pm @@ -47,7 +47,7 @@ sub construct_ifelsefi_regexp{ ) # part of the tokens used for latexindent ( (?: - (?!\\if). + (?!\\$ifElseFiNameRegExp). )*? # body, which can't include another \if ) (\R*) # linebreaks after body diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm index f9fbf8dd4b6..16c6bd8b8da 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Item.pm @@ -45,14 +45,14 @@ sub construct_list_of_items{ $itemRegExp = qr/ ( - \\($listOfItems) + \\((?:$listOfItems)(?:\[[^]]*?\])?(?!\S)) \h* (\R*)? ) ( (?: # cluster-only (), don't capture (?! - (?:\\(?:$listOfItems)) # cluster-only (), don't capture + (?:\\(?:(?:$listOfItems)(?:\[[^]]*?\])?(?!\S))) # cluster-only (), don't capture ). # any character, but not \\$item )* ) diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm index 205d72031e3..8a35c3c2a27 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm @@ -19,20 +19,10 @@ use warnings; use FindBin; use File::Basename; # to get the filename and directory path use Exporter qw/import/; -use Log::Log4perl qw(get_logger :levels); -use Log::Log4perl::Appender::Screen; -use Log::Dispatch::File; -use LatexIndent::GetYamlSettings qw/%masterSettings/; use LatexIndent::Switches qw/%switches/; use LatexIndent::Version qw/$versionNumber $versionDate/; our @EXPORT_OK = qw/processSwitches $logger/; -our @logFileNotes; -our $logger = get_logger("Document"); - -# log file methods, using log4perl; references -# pattern layout: http://search.cpan.org/~mschilli/Log-Log4perl-1.32/lib/Log/Log4perl/Layout/PatternLayout.pm -# multiple appenders: https://stackoverflow.com/questions/8620347/perl-log4perl-printing-and-logging-at-the-same-time-in-a-line?rq=1 -# getting started: https://www.perl.com/pub/2002/09/11/log4perl.html +our $logger; sub processSwitches{ # -v switch is just to show the version number @@ -98,7 +88,7 @@ ENDQUOTE # if we've made it this far, the processing of switches and logging begins my $self = shift; - ($switches{trace}||$switches{ttrace}) ? $logger->level($TRACE): $logger->level($INFO); + $logger = LatexIndent::Logger->new(); # cruft directory ${$self}{cruftDirectory} = $switches{cruftDirectory}||(dirname ${$self}{fileName}); @@ -106,58 +96,6 @@ ENDQUOTE my $logfileName = ($switches{cruftDirectory} ? ${$self}{cruftDirectory}."/" : '').($switches{logFileName}||"indent.log"); - # layout of the logfile information, for example - # - # 2017/09/16 11:59:09 INFO: message - # 2017/09/16 12:23:53 INFO: LogFile.pm:156 LatexIndent::LogFile::processSwitches - message - # reference: https://stackoverflow.com/questions/46262844/log4perl-grouping-messages/46309392#46309392 - Log::Log4perl::Layout::PatternLayout::add_global_cspec( - 'A', sub { - if($_[1] =~ /^\*/){ - $_[1]=~s/^\*//; - if($_[1]=~m/\R/s){ - my $indentation = ' '.(' ' x length $_[3]); - $_[1] =~ s/\R/\n$indentation/gs; - } - return "$_[3]: ".$_[1]; - } else { - my $indentation = ' '.(' ' x length $_[3]); - $_[1] =~ s/\R/\n$indentation/gs if($_[1]=~m/\R/s); - return $indentation.$_[1]; - } - }); - - my $layout = Log::Log4perl::Layout::PatternLayout->new("%A%n"); - - # details for the Log4perl logging - my $appender = Log::Log4perl::Appender->new( - "Log::Dispatch::File", - filename => $logfileName, - mode => "write", - utf8 => 1, - ); - - # add the layout - $appender->layout($layout); - - # adjust the logger object - $logger->add_appender($appender); - - # appender object for output to screen - my $appender_screen = q(); - - # output to screen, if appropriate - if($switches{screenlog}){ - $appender_screen = Log::Log4perl::Appender->new( - "Log::Log4perl::Appender::Screen", - stderr => 1, - utf8 => 1, - ); - - $appender_screen->layout($layout); - $logger->add_appender($appender_screen); - } - # details of the script to log file $logger->info("*$FindBin::Script version $versionNumber, $versionDate, a script to indent .tex files"); $logger->info("$FindBin::Script lives here: $FindBin::RealBin/"); @@ -207,7 +145,7 @@ ENDQUOTE # output location of modules if($FindBin::Script eq 'latexindent.pl' or ($FindBin::Script eq 'latexindent.exe' and $switches{trace} )) { - my @listOfModules = ('FindBin', 'YAML::Tiny', 'File::Copy', 'File::Basename', 'Getopt::Long','File::HomeDir','Unicode::GCString','Log::Log4perl'); + my @listOfModules = ('FindBin', 'YAML::Tiny', 'File::Copy', 'File::Basename', 'Getopt::Long','File::HomeDir','Unicode::GCString'); $logger->info("*Perl modules are being loaded from the following directories:"); foreach my $moduleName (@listOfModules) { (my $file = $moduleName) =~ s|::|/|g; @@ -221,33 +159,6 @@ ENDQUOTE # read the YAML settings $self->yaml_read_settings; - # the user may have specified their own settings for the rest of the log file, - # for example: - # - # logFilePreferences: - # PatternLayout: - # default: "%p: %m{indent}%n" - # trace: "%p: %m{indent}%n" - # ttrace: "%d %p: %F{1}:%L %M - %m{indent}%n" - # - # e.g, default mode: - # 2017/09/16 11:59:09 INFO: message - # or trace mode: - # 2017/09/16 11:59:09 INFO: message - # or in trace mode: - # 2017/09/16 12:23:53 INFO: LogFile.pm:156 LatexIndent::LogFile::processSwitches - message - my $pattern = q(); - if($switches{ttrace}){ - $pattern = ${${$masterSettings{logFilePreferences}}{PatternLayout}}{ttrace}; - } elsif($switches{trace}){ - $pattern = ${${$masterSettings{logFilePreferences}}{PatternLayout}}{trace}; - } else { - $pattern = ${${$masterSettings{logFilePreferences}}{PatternLayout}}{default}; - } - $layout = Log::Log4perl::Layout::PatternLayout->new($pattern); - $appender->layout($layout); - - $appender_screen->layout($layout) if $switches{screenlog}; return; } diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm new file mode 100644 index 00000000000..02bcd23dd77 --- /dev/null +++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm @@ -0,0 +1,64 @@ +package LatexIndent::Logger; +# 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 +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See http://www.gnu.org/licenses/. +# +# Chris Hughes, 2017 +# +# For all communication, please visit: https://github.com/cmhughes/latexindent.pl + +use strict; +use warnings; +use Exporter; +use LatexIndent::Switches qw/%switches/; +our @ISA = "LatexIndent::Document"; # class inheritance, Programming Perl, pg 321 +our @EXPORT_OK = qw/@logFileLines/; +our @logFileLines; + +sub info{ + my $self = shift; + my $logfileline = shift; + if ($logfileline =~ m/^\*/s){ + $logfileline =~ s/^\*/INFO: /s; + $logfileline =~ s/^/ /mg; + $logfileline =~ s/^\h+INFO/INFO/s; + } else { + $logfileline =~ s/^/ /mg; + } + push(@logFileLines,$logfileline); + print $logfileline,"\n" if $switches{screenlog}; +} + +sub warn{ + my $self = shift; + my $logfileline = shift; + if ($logfileline =~ m/^\*/s){ + $logfileline =~ s/^\*/WARN: /s + } else { + $logfileline =~ s/^/ /mg; + } + push(@logFileLines,$logfileline); + print $logfileline,"\n" if $switches{screenlog}; +} + +sub trace{ + my $self = shift; + my $logfileline = shift; + if ($logfileline =~ m/^\*/s){ + $logfileline =~ s/^\*/TRACE: /s + } else { + $logfileline =~ s/^/ /mg; + } + push(@logFileLines,$logfileline); + print $logfileline,"\n" if $switches{screenlog}; +} + +1; diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm index a5dd88c0277..17c5ddd1fcf 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.8.3'; -our $versionDate = '2020-11-06'; +our $versionNumber = '3.9'; +our $versionDate = '2021-03-14'; 1 diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml index d4ed8f0c805..f12e0030a95 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.8.3, 2020-11-06 +# defaultSettings.yaml for latexindent.pl, version 3.9, 2021-03-14 # a script that aims to # beautify .tex, .sty, .cls files # @@ -89,10 +89,6 @@ logFilePreferences: showDecorationFinishCodeBlockTrace: 0 endLogFileWith: '--------------' showGitHubInfoFooter: 1 - PatternLayout: - default: "%A%n" - trace: "%A%n" - ttrace: "%A%n" # verbatim environments specified # in this field will not be changed at all! @@ -357,6 +353,7 @@ commandCodeBlocks: - 'decoration' - '\+\+' - '\-\-' + - '\#\#\d' commandNameSpecial: - amalgamate: 1 @@ -617,7 +614,7 @@ fineTuning: environments: name: '[a-zA-Z@\*0-9_\\]+' ifElseFi: - name: '@?if[a-zA-Z@]*?' + name: '(?!@?if[a-zA-Z@]*?\{)@?if[a-zA-Z@]*?' commands: name: '[+a-zA-Z@\*0-9_\:]+?' keyEqualsValuesBracesBrackets: diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl index f38d6c3fb53..77ae1fb829f 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.8.3, 2020-11-06 +# latexindent.pl, version 3.9, 2021-03-14 # # 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 @@ -64,15 +64,6 @@ if($switches{readLocalSettings} and scalar(@ARGV) < 1) { $switches{readLocalSettings} = ''; } -# default value of readLocalSettings -# -# latexindent -l myfile.tex -# -# means that we wish to use localSettings.yaml -if(defined($switches{readLocalSettings}) and ($switches{readLocalSettings} eq '')){ - $switches{readLocalSettings} = 'localSettings.yaml'; -} - # allow STDIN as input, if a filename is not present unshift( @ARGV, '-' ) unless @ARGV; |