summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-07-14 21:03:52 +0000
committerKarl Berry <karl@freefriends.org>2023-07-14 21:03:52 +0000
commitac0972ebf6b5b92c6cc75542aa4add3bc6f8b15c (patch)
tree729f58c2f08cc0f8e6f876c39db48b9aa37cce65 /Master/texmf-dist/scripts
parent9f11a1027fe8613be28f9c6f94bd25858e0f9279 (diff)
latexindent (14jul23)
git-svn-id: svn://tug.org/texlive/trunk@67628 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm4
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm18
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm4
-rw-r--r--Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm8
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/defaultSettings.yaml2
-rwxr-xr-xMaster/texmf-dist/scripts/latexindent/latexindent.pl2
6 files changed, 28 insertions, 10 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
index 62a14a677bf..e78aa6b8b54 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Else.pm
@@ -142,4 +142,8 @@ sub create_unique_id {
return;
}
+sub modify_line_breaks_end {
+ return;
+}
+
1;
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
index 5847ca42f42..4e9064c937a 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm
@@ -19,6 +19,7 @@ use strict;
use warnings;
use FindBin;
use File::Basename; # to get the filename and directory path
+use File::Path qw(make_path);
use Exporter qw/import/;
use LatexIndent::Switches qw/%switches/;
use LatexIndent::Version qw/$versionNumber $versionDate/;
@@ -129,12 +130,18 @@ ENDQUOTE
# cruft directory
${$self}{cruftDirectory} = $switches{cruftDirectory} || ( dirname ${$self}{fileName} );
- # if cruft directory does not exist
+ my $cruftDirectoryCreation = 0;
+
+ # if cruft directory does not exist, create it
if ( !( -d ${$self}{cruftDirectory} ) ) {
- $logger->fatal( "*Could not find directory " . decode( "utf-8", ${$self}{cruftDirectory} ) );
- $logger->fatal("Exiting, no indentation done.");
- $self->output_logfile();
- exit(6);
+ eval { make_path( ${$self}{cruftDirectory} ) };
+ if ($@) {
+ $logger->fatal( "*Could not create cruft directory " . decode( "utf-8", ${$self}{cruftDirectory} ) );
+ $logger->fatal("Exiting, no indentation done.");
+ $self->output_logfile();
+ exit(6);
+ }
+ $cruftDirectoryCreation = 1;
}
my $logfileName = ( $switches{cruftDirectory} ? ${$self}{cruftDirectory} . "/" : '' )
@@ -247,6 +254,7 @@ ENDQUOTE
$logger->info("*Directory for backup files and $logfileName:");
$logger->info( $switches{cruftDirectory} ? decode( "utf-8", ${$self}{cruftDirectory} ) : ${$self}{cruftDirectory} );
+ $logger->info("cruft directory creation: ${$self}{cruftDirectory}") if $cruftDirectoryCreation;
# output location of modules
if ( $FindBin::Script eq 'latexindent.pl' or ( $FindBin::Script eq 'latexindent.exe' and $switches{trace} ) ) {
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
index ae69bb7928d..eb1bfbe1431 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Version.pm
@@ -20,6 +20,6 @@ use warnings;
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.22.1';
-our $versionDate = '2023-07-02';
+our $versionNumber = '3.22.2';
+our $versionDate = '2023-07-14';
1
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
index c600d28e188..6b545c7e28d 100644
--- a/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
+++ b/Master/texmf-dist/scripts/latexindent/LatexIndent/Wrap.pm
@@ -41,6 +41,8 @@ sub text_wrap {
my $blocksFollow = q();
my $blocksFollowHash = \%{ ${ $mainSettings{modifyLineBreaks}{textWrapOptions} }{blocksFollow} };
+ my $headingsRegEx = q();
+
foreach my $blocksFollowEachPart ( sort keys %{$blocksFollowHash} ) {
last if ${$self}{modifyLineBreaksYamlName} eq 'sentence';
@@ -90,6 +92,9 @@ sub text_wrap {
#
$headingName = qr/\\$headingName\h*(?:\[[^]]*?\])?\h*\{[^}]*?\}\h*(?:\\label\{[^}]*?\})?/m;
+ # stored for possible use with 'after'
+ $headingsRegEx = $headingName . ( $headingsRegEx eq '' ? q() : "|$headingsRegEx" );
+
# put starred headings at the front of the regexp
if ( $headingName =~ m/\*/ ) {
$blocksFollowEachPart
@@ -332,8 +337,9 @@ sub text_wrap {
else {
my $thingToMeasure = ( split( /\R/, $textWrapBlockStorage[ $textWrapBlockCount - 1 ] ) )[-1];
$thingToMeasure =~ s/$tokens{blanklines}//;
- $thingToMeasure =~ s/$tokens{verbatim}//;
+ $thingToMeasure =~ s/$tokens{verbatim}\d+$tokens{endOfToken}//;
$thingToMeasure =~ s/$trailingCommentRegExp//;
+ $thingToMeasure =~ s/$headingsRegEx//;
$subsequentSpace = (
$textWrapBlockCount == 0
diff --git a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
index e626458b63f..de0c1335ca5 100755
--- a/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
+++ b/Master/texmf-dist/scripts/latexindent/defaultSettings.yaml
@@ -1,5 +1,5 @@
#
-# latexindent.pl, version 3.22.1, 2023-07-02
+# latexindent.pl, version 3.22.2, 2023-07-14
#
# defaultSettings.yaml, the default settings for latexindent.pl
#
diff --git a/Master/texmf-dist/scripts/latexindent/latexindent.pl b/Master/texmf-dist/scripts/latexindent/latexindent.pl
index a4cf71ab954..61ee1131b4d 100755
--- a/Master/texmf-dist/scripts/latexindent/latexindent.pl
+++ b/Master/texmf-dist/scripts/latexindent/latexindent.pl
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
#
-# latexindent.pl, version 3.22.1, 2023-07-02
+# latexindent.pl, version 3.22.2, 2023-07-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