texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/ext/latex2html.pm (l2h_process), tp/ext/tex4


From: Patrice Dumas
Subject: branch master updated: * tp/ext/latex2html.pm (l2h_process), tp/ext/tex4ht.pm (tex4ht_prepare): create destination directory unless it is sure that it is the current directory.
Date: Sat, 05 Oct 2024 05:25:17 -0400

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new c7858cd29b * tp/ext/latex2html.pm (l2h_process), tp/ext/tex4ht.pm 
(tex4ht_prepare): create destination directory unless it is sure that it is the 
current directory.
c7858cd29b is described below

commit c7858cd29b02ab38a1b3e145cdb235edc69f521e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Aug 25 12:33:33 2024 +0200

    * tp/ext/latex2html.pm (l2h_process), tp/ext/tex4ht.pm
    (tex4ht_prepare): create destination directory unless it is sure that
    it is the current directory.
    
    * tp/Texinfo/Common.pm (encode_file_name): add an intermediary
    variable.
---
 ChangeLog            |  9 +++++++++
 tp/Texinfo/Common.pm |  4 ++--
 tp/ext/latex2html.pm | 16 +++++++++++++---
 tp/ext/tex4ht.pm     | 11 +++++++++--
 4 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cff2debcf1..e83fa05af0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-25  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/ext/latex2html.pm (l2h_process), tp/ext/tex4ht.pm
+       (tex4ht_prepare): create destination directory unless it is sure that
+       it is the current directory.
+
+       * tp/Texinfo/Common.pm (encode_file_name): add an intermediary
+       variable.
+
 2024-08-25  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/converter.c
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 8f3dd8a578..ec6ce7fd01 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -1125,8 +1125,8 @@ sub encode_file_name($$)
   } else {
     $encoding = $input_encoding;
   }
-  $file_name = Encode::encode($encoding, $file_name);
-  return ($file_name, $encoding);
+  my $encoded_file_name = Encode::encode($encoding, $file_name);
+  return ($encoded_file_name, $encoding);
 }
 
 sub locate_include_file($;$)
diff --git a/tp/ext/latex2html.pm b/tp/ext/latex2html.pm
index 44408211d6..719dd4a664 100644
--- a/tp/ext/latex2html.pm
+++ b/tp/ext/latex2html.pm
@@ -2,7 +2,7 @@
 #
 # latex2html.pm: interface to LaTeX2HTML
 #
-#    Copyright (C) 1999, 2000, 2003, 2005, 2006, 2009, 2011-2023
+#    Copyright (C) 1999, 2000, 2003, 2005, 2006, 2009, 2011-2024
 #                  Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -206,13 +206,23 @@ sub l2h_process($$)
   # as dir of enclosing html document --
   $destination_directory = $self->get_info('destination_directory');
   $destination_directory = '' if (!defined($destination_directory));
-  my $dir = $destination_directory;
-  $dir = File::Spec->curdir() if ($dir eq '');
+  my $dir;
+  if ($destination_directory eq '') {
+    $dir = File::Spec->curdir();
+  } else {
+    $dir = $destination_directory;
+  }
   my $dir_encoding;
   # $destination_directory_string is used in binary file path strings
   ($destination_directory_string, $dir_encoding)
     = $self->encoded_output_file_name($dir);
 
+  if ($destination_directory ne '') {
+    $self->create_destination_directory($destination_directory_string,
+                                        $dir);
+
+  }
+
   $l2h_name = "${docu_name}_l2h";
   my $l2h_latex_file_name = "${l2h_name}.tex";
   my $l2h_latex_path_name = File::Spec->catfile($destination_directory,
diff --git a/tp/ext/tex4ht.pm b/tp/ext/tex4ht.pm
index 37050e1237..7e5492e664 100644
--- a/tp/ext/tex4ht.pm
+++ b/tp/ext/tex4ht.pm
@@ -156,8 +156,15 @@ sub tex4ht_prepare($$)
 
   $tex4ht_initial_dir = Cwd::abs_path;
   $tex4ht_out_dir = $self->get_info('destination_directory');
-  $tex4ht_out_dir = File::Spec->curdir()
-    if (!defined($tex4ht_out_dir) or $tex4ht_out_dir =~ /^\s*$/);
+
+  if (!defined($tex4ht_out_dir) or $tex4ht_out_dir =~ /^\s*$/) {
+    $tex4ht_out_dir = File::Spec->curdir();
+  } else {
+    my ($encoded_tex4ht_out_dir, $tex4ht_out_dir_encoding)
+      = $self->encoded_output_file_name($tex4ht_out_dir);
+    $self->create_destination_directory($encoded_tex4ht_out_dir,
+                                        $tex4ht_out_dir);
+  }
 
   my $document_name = $self->get_info('document_name');
   my $tex4ht_basename = "${document_name}_tex4ht";



reply via email to

[Prev in Thread] Current Thread [Next in Thread]