summaryrefslogtreecommitdiff
path: root/support/latexindent/LatexIndent
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-04-08 03:01:13 +0000
committerNorbert Preining <norbert@preining.info>2023-04-08 03:01:13 +0000
commit24c6de40a2869f5b6c213c2cf69e597f885f2b19 (patch)
tree5225200910d14cb8b177fad2192b492f3b254e5c /support/latexindent/LatexIndent
parentbd96eb3748479a2feb0e8a0ef06203de92766953 (diff)
CTAN sync 202304080301
Diffstat (limited to 'support/latexindent/LatexIndent')
-rw-r--r--support/latexindent/LatexIndent/BackUpFileProcedure.pm9
-rw-r--r--support/latexindent/LatexIndent/Document.pm16
-rw-r--r--support/latexindent/LatexIndent/GetYamlSettings.pm3
-rw-r--r--support/latexindent/LatexIndent/Item.pm2
-rw-r--r--support/latexindent/LatexIndent/LogFile.pm4
-rw-r--r--support/latexindent/LatexIndent/Version.pm4
6 files changed, 30 insertions, 8 deletions
diff --git a/support/latexindent/LatexIndent/BackUpFileProcedure.pm b/support/latexindent/LatexIndent/BackUpFileProcedure.pm
index 82d1a81653..9f54207a57 100644
--- a/support/latexindent/LatexIndent/BackUpFileProcedure.pm
+++ b/support/latexindent/LatexIndent/BackUpFileProcedure.pm
@@ -23,6 +23,7 @@ use LatexIndent::LogFile qw/$logger/;
use File::Basename; # to get the filename and directory path
use File::Copy; # to copy the original file to backup (if overwrite option set)
use Exporter qw/import/;
+use Encode qw/decode/;
our @EXPORT_OK = qw/create_back_up_file check_if_different/;
# copy main file to a back up in the case of the overwrite switch being active
@@ -35,7 +36,7 @@ sub create_back_up_file {
# if we want to over write the current file create a backup first
$logger->info("*Backup procedure (-w flag active):");
- my $fileName = ${$self}{fileName};
+ my $fileName = decode( "utf-8", ${$self}{fileName} );
# grab the file extension preferences
my %fileExtensionPreference = %{ $mainSettings{fileExtensionPreference} };
@@ -48,7 +49,7 @@ sub create_back_up_file {
my $backupFile = basename( ${$self}{fileName}, @fileExtensions );
# add the user's backup directory to the backup path
- $backupFile = "${$self}{cruftDirectory}/$backupFile";
+ $backupFile = decode( "utf-8", "${$self}{cruftDirectory}/$backupFile" );
# local variables, determined from the YAML settings
my $onlyOneBackUp = $mainSettings{onlyOneBackUp};
@@ -103,9 +104,9 @@ sub create_back_up_file {
for ( my $i = 1; $i <= $maxNumberOfBackUps; $i++ ) {
# remove number from backUpFile
- my $oldBackupFile = $backupFile;
+ my $oldBackupFile = decode( "utf-8", $backupFile );
$oldBackupFile =~ s/$backupExtension.*/$backupExtension/;
- my $newBackupFile = $oldBackupFile;
+ my $newBackupFile = decode( "utf-8", $oldBackupFile );
# add numbers back on
$oldBackupFile .= $i;
diff --git a/support/latexindent/LatexIndent/Document.pm b/support/latexindent/LatexIndent/Document.pm
index d365388679..4a99721a34 100644
--- a/support/latexindent/LatexIndent/Document.pm
+++ b/support/latexindent/LatexIndent/Document.pm
@@ -20,6 +20,7 @@ use warnings;
use Data::Dumper;
use File::Basename; # to get the filename and directory path
use open ':std', ':encoding(UTF-8)';
+use Encode qw/decode/;
# gain access to subroutines in the following modules
use LatexIndent::Switches
@@ -97,7 +98,7 @@ sub latexindent {
# one-time operations
$self->store_switches;
- ${$self}{fileName} = $fileNames[0];
+ ${$self}{fileName} = decode( "utf-8", $fileNames[0] );
$self->process_switches( \@fileNames );
$self->yaml_read_settings;
@@ -228,13 +229,26 @@ sub output_indented_text {
# if -overwrite is active then output to original fileName
if ( ${$self}{overwrite} ) {
+
+ # diacritics in file names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439)
+ ${$self}{fileName} = decode( "utf-8", ${$self}{fileName} );
+
$logger->info("Overwriting file ${$self}{fileName}");
open( OUTPUTFILE, ">", ${$self}{fileName} );
print OUTPUTFILE ${$self}{body};
close(OUTPUTFILE);
}
elsif ( $switches{outputToFile} ) {
+
+ # diacritics in file names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439)
+ #
+ # note, related:
+ #
+ # git config --add core.quotePath false
+ ${$self}{outputToFile} = decode( "utf-8", ${$self}{outputToFile} );
+
$logger->info("Outputting to file ${$self}{outputToFile}");
+
open( OUTPUTFILE, ">", ${$self}{outputToFile} );
print OUTPUTFILE ${$self}{body};
close(OUTPUTFILE);
diff --git a/support/latexindent/LatexIndent/GetYamlSettings.pm b/support/latexindent/LatexIndent/GetYamlSettings.pm
index 85764353e8..440e2ef20b 100644
--- a/support/latexindent/LatexIndent/GetYamlSettings.pm
+++ b/support/latexindent/LatexIndent/GetYamlSettings.pm
@@ -341,6 +341,9 @@ sub yaml_read_settings {
}
}
+ # diacritics in YAML names (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439)
+ $_ = decode( "utf-8", $_ );
+
# check for existence and non-emptiness
if ( ( -e $_ ) and !( -z $_ ) ) {
$logger->info("Adding $_ to YAML read paths");
diff --git a/support/latexindent/LatexIndent/Item.pm b/support/latexindent/LatexIndent/Item.pm
index 0e7201a800..8fe5045852 100644
--- a/support/latexindent/LatexIndent/Item.pm
+++ b/support/latexindent/LatexIndent/Item.pm
@@ -146,7 +146,7 @@ sub remove_line_breaks_begin {
# there is no white space
my $self = shift;
my $BodyStringLogFile = ${$self}{aliases}{BodyStartsOnOwnLine} || "BodyStartsOnOwnLine";
- $logger->trace("Removing linebreak at the end of begin (see $BodyStringLogFile)");
+ $logger->trace("Removing linebreak at the end of begin (see $BodyStringLogFile)") if $is_t_switch_active;
${$self}{begin} =~ s/\R*$//sx;
${$self}{begin} .= " "
unless ( ${$self}{begin} =~ m/\h$/s or ${$self}{body} =~ m/^\h/s or ${$self}{body} =~ m/^\R/s );
diff --git a/support/latexindent/LatexIndent/LogFile.pm b/support/latexindent/LatexIndent/LogFile.pm
index 809aa71d2d..93b6ad0930 100644
--- a/support/latexindent/LatexIndent/LogFile.pm
+++ b/support/latexindent/LatexIndent/LogFile.pm
@@ -22,6 +22,7 @@ use File::Basename; # to get the filename and directory path
use Exporter qw/import/;
use LatexIndent::Switches qw/%switches/;
use LatexIndent::Version qw/$versionNumber $versionDate/;
+use Encode qw/decode/;
our @EXPORT_OK = qw/process_switches $logger/;
our $logger;
@@ -128,6 +129,9 @@ ENDQUOTE
# cruft directory
${$self}{cruftDirectory} = $switches{cruftDirectory} || ( dirname ${$self}{fileName} );
+ # diacritics in cruft directory (highlighted in https://github.com/cmhughes/latexindent.pl/pull/439)
+ ${$self}{cruftDirectory} = decode( "utf-8", ${$self}{cruftDirectory} );
+
# if cruft directory does not exist
if ( !( -d ${$self}{cruftDirectory} ) ) {
$logger->fatal("*Could not find directory ${$self}{cruftDirectory}");
diff --git a/support/latexindent/LatexIndent/Version.pm b/support/latexindent/LatexIndent/Version.pm
index e05f59d6f9..457e9c83bf 100644
--- a/support/latexindent/LatexIndent/Version.pm
+++ b/support/latexindent/LatexIndent/Version.pm
@@ -20,6 +20,6 @@ use warnings;
use Exporter qw/import/;
our @EXPORT_OK = qw/$versionNumber $versionDate/;
-our $versionNumber = '3.20.4';
-our $versionDate = '2023-03-15';
+our $versionNumber = '3.20.5';
+our $versionDate = '2023-04-07';
1