summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-07 20:18:27 +0000
committerKarl Berry <karl@freefriends.org>2021-05-07 20:18:27 +0000
commit1e6af30cd22c38162c202393daeb98dc5b1aff04 (patch)
treeb479e162ad2754243f5dde25d61e1282f4bda4d3 /Master/texmf-dist/scripts
parent3bf962c22cbfb46427a4226a45c1030577287fb2 (diff)
latexindent (7may21)
git-svn-id: svn://tug.org/texlive/trunk@59121 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm32
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm10
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm14
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm4
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/defaultSettings.yaml2
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl2
6 files changed, 46 insertions, 18 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
index 0b3ea9b254a..863d4d7d009 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Document.pm
@@ -153,6 +153,19 @@ sub output_indented_text{
$logger->info("Not outputting to file; see -w and -o switches for more options.");
}
+ # output the log file information
+ $self->output_logfile();
+
+ # output to screen, unless silent mode
+ print ${$self}{body} unless $switches{silentMode};
+
+ return;
+}
+
+sub output_logfile{
+
+ my $self = shift;
+ #
# put the final line in the logfile
$logger->info("${$masterSettings{logFilePreferences}}{endLogFileWith}") if ${$masterSettings{logFilePreferences}}{endLogFileWith};
@@ -162,19 +175,18 @@ sub output_indented_text{
# open log file
my $logfileName = $switches{logFileName}||"indent.log";
my $logfile;
- open($logfile,">","${$self}{cruftDirectory}/$logfileName") or die "Can't open $logfileName";
+ my $logfilePossible = 1;
+ open($logfile,">","${$self}{cruftDirectory}/$logfileName") or $logfilePossible =0;
- foreach my $line (@{LatexIndent::Logger::logFileLines}){
- print $logfile $line,"\n";
- }
+ if($logfilePossible){
+ 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};
+ # close log file
+ close($logfile);
+ }
- return;
}
sub process_body_of_text{
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
index 499ca9f65a4..6902b0f48cd 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm
@@ -48,8 +48,8 @@ sub file_extension_check{
if ($fileName ne "-"){
if (!$ext) {
$logger->info("*File extension work:");
- $logger->info("latexindent called to act upon $fileName without a file extension;\nsearching for file with an extension in the following order (see fileExtensionPreference):");
- $logger->info(join("\n",@fileExtensions));
+ $logger->info("latexindent called to act upon $fileName without a file extension;\nsearching for files in the following order (see fileExtensionPreference):");
+ $logger->info($fileName.join("\n$fileName",@fileExtensions));
my $fileFound = 0;
# loop through the known file extensions (see @fileExtensions)
@@ -70,13 +70,15 @@ sub file_extension_check{
$logger->fatal("I searched for $fileName$_");
}
$logger->fatal("but couldn't find any of them.\nConsider updating fileExtensionPreference.\nExiting, no indendation done.");
- die "I couldn't find a match for $fileName in fileExtensionPreference.\nExiting, no indendation done.";
+ $self->output_logfile();
+ die "ERROR: I couldn't find any of the following files: ".$fileName.join(", $fileName",@fileExtensions)." (see fileExtensionPreference)\nExiting, no indendation done.";
}
} else {
# if the file has a recognised extension, check that the file exists
unless( -e $fileName ){
- my $message = "I couldn't find $fileName, are you sure it exists?.\nNo indentation done.\nExiting.";
+ my $message = "ERROR: I couldn't find $fileName, are you sure it exists?\nNo indentation done.\nExiting.";
$logger->fatal("*$message");
+ $self->output_logfile();
die $message;
}
}
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm
index 02bcd23dd77..35ff428eab6 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Logger.pm
@@ -49,6 +49,20 @@ sub warn{
print $logfileline,"\n" if $switches{screenlog};
}
+sub fatal{
+ my $self = shift;
+ my $logfileline = shift;
+ if ($logfileline =~ m/^\*/s){
+ $logfileline =~ s/^\*/FATAL /s;
+ $logfileline =~ s/^/ /mg;
+ $logfileline =~ s/^\h+FATAL/FATAL/s;
+ } else {
+ $logfileline =~ s/^/ /mg;
+ }
+ push(@logFileLines,$logfileline);
+ print $logfileline,"\n" if $switches{screenlog};
+}
+
sub trace{
my $self = shift;
my $logfileline = shift;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
index 3751a17adb5..20cbab26721 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.9.2';
-our $versionDate = '2021-04-06';
+our $versionNumber = '3.9.3';
+our $versionDate = '2021-05-07';
1
diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
index a1028961116..2a927de5354 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.9.2, 2021-04-06
+# defaultSettings.yaml for latexindent.pl, version 3.9.3, 2021-05-07
# a script that aims to
# beautify .tex, .sty, .cls files
#
diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl
index f339ec591b4..ef24db27b25 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.9.2, 2021-04-06
+# latexindent.pl, version 3.9.3, 2021-05-07
#
# 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