summaryrefslogtreecommitdiff
path: root/support/latexindent/LatexIndent/LogFile.pm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-03-17 03:01:42 +0000
committerNorbert Preining <norbert@preining.info>2024-03-17 03:01:42 +0000
commit55140d5421e1ad0024c9acbfa72bd06402c2aa9f (patch)
treeb6c0d76888f025b58f1221d8dadbefb0264e9f6c /support/latexindent/LatexIndent/LogFile.pm
parent966f9ba332e49c29e961cb86e08f97d70eda51f6 (diff)
CTAN sync 202403170301
Diffstat (limited to 'support/latexindent/LatexIndent/LogFile.pm')
-rw-r--r--support/latexindent/LatexIndent/LogFile.pm18
1 files changed, 13 insertions, 5 deletions
diff --git a/support/latexindent/LatexIndent/LogFile.pm b/support/latexindent/LatexIndent/LogFile.pm
index b72655b686..7418f1024c 100644
--- a/support/latexindent/LatexIndent/LogFile.pm
+++ b/support/latexindent/LatexIndent/LogFile.pm
@@ -27,6 +27,12 @@ use Encode qw/decode/;
our @EXPORT_OK = qw/process_switches $logger/;
our $logger;
+use utf8;
+binmode( STDOUT, ":encoding(utf8)" );
+
+use LatexIndent::UTF8CmdLineArgsFileOperation
+ qw/copy_with_encode exist_with_encode open_with_encode zero_with_encode read_yaml_with_encode isdir_with_encode mkdir_with_encode/;
+
sub process_switches {
# -v switch is just to show the version number
@@ -133,10 +139,10 @@ ENDQUOTE
my $cruftDirectoryCreation = 0;
# if cruft directory does not exist, create it
- if ( !( -d ${$self}{cruftDirectory} ) ) {
- eval { make_path( ${$self}{cruftDirectory} ) };
+ if ( !( isdir_with_encode( ${$self}{cruftDirectory} ) ) ) {
+ eval { mkdir_with_encode( ${$self}{cruftDirectory} ) };
if ($@) {
- $logger->fatal( "*Could not create cruft directory " . decode( "utf-8", ${$self}{cruftDirectory} ) );
+ $logger->fatal( "*Could not create cruft directory " . ${$self}{cruftDirectory} );
$logger->fatal("Exiting, no indentation done.");
$self->output_logfile();
exit(6);
@@ -147,7 +153,7 @@ ENDQUOTE
my $logfileName = ( $switches{cruftDirectory} ? ${$self}{cruftDirectory} . "/" : '' )
. ( $switches{logFileName} || "indent.log" );
- $logfileName = decode( "utf-8", $logfileName );
+ $logfileName = $logfileName;
# details of the script to log file
$logger->info("*$FindBin::Script version $versionNumber, $versionDate, a script to indent .tex files");
@@ -204,6 +210,8 @@ ENDQUOTE
$logger->info("-c|--cruft: cruft directory") if ( $switches{cruftDirectory} );
$logger->info("-r|--replacement: replacement mode") if ( $switches{replacement} );
$logger->info("-rr|--onlyreplacement: *only* replacement mode, no indentation") if ( $switches{onlyreplacement} );
+ $logger->info("-rv|--replacementrespectverb replacement mode, respecting verbatim")
+ if ( $switches{replacementRespectVerb} );
$logger->info("-k|--check mode: will exit with 0 if document body unchanged, 1 if changed") if ( $switches{check} );
$logger->info("-kv|--check mode verbose: as in check mode, but outputs diff to screen")
if ( $switches{checkverbose} );
@@ -253,7 +261,7 @@ ENDQUOTE
}
$logger->info("*Directory for backup files and $logfileName:");
- $logger->info( $switches{cruftDirectory} ? decode( "utf-8", ${$self}{cruftDirectory} ) : ${$self}{cruftDirectory} );
+ $logger->info( $switches{cruftDirectory} ? ${$self}{cruftDirectory} : ${$self}{cruftDirectory} );
$logger->info("cruft directory creation: ${$self}{cruftDirectory}") if $cruftDirectoryCreation;
# output location of modules