texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (_html_convert_outpu


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (_html_convert_output, _setup_output), tp/Texinfo/XS/convert/convert_html.c (html_setup_output) (html_convert_output): create directory at the very beginning of html_convert_output, not in setup_output, to delay modifications to the start of the conversion.
Date: Fri, 04 Oct 2024 11:10:44 -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 41e45ec43e * tp/Texinfo/Convert/HTML.pm (_html_convert_output, 
_setup_output), tp/Texinfo/XS/convert/convert_html.c (html_setup_output) 
(html_convert_output): create directory at the very beginning of 
html_convert_output, not in setup_output, to delay modifications to the start 
of the conversion.
41e45ec43e is described below

commit 41e45ec43e6c45a6c976e1cbcb0ec9f3f88893e8
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Aug 14 15:09:47 2024 +0200

    * tp/Texinfo/Convert/HTML.pm (_html_convert_output, _setup_output),
    tp/Texinfo/XS/convert/convert_html.c (html_setup_output)
    (html_convert_output): create directory at the very beginning of
    html_convert_output, not in setup_output, to delay modifications
    to the start of the conversion.
---
 ChangeLog                            |  8 +++++++
 tp/Texinfo/Convert/HTML.pm           | 17 +++++++-------
 tp/Texinfo/XS/convert/convert_html.c | 44 +++++++++++++++++-------------------
 3 files changed, 38 insertions(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d3266d45af..9b27f27f23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,14 @@
        * tp/Texinfo/XS/convert/convert_html.h: declare node_part_command
        open function.
 
+2024-08-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_html_convert_output, _setup_output),
+       tp/Texinfo/XS/convert/convert_html.c (html_setup_output)
+       (html_convert_output): create directory at the very beginning of
+       html_convert_output, not in setup_output, to delay modifications
+       to the start of the conversion.
+
 2024-08-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/html_converter_types.h
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c1450a2924..bebf3b7f52 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12650,6 +12650,15 @@ sub _html_convert_output($$$$$$$$)
   my ($self, $output_file, $destination_directory, $output_filename,
       $document_name, $document, $output_units, $special_units) = @_;
 
+  my ($encoded_destination_directory, $dir_encoding)
+    = $self->encoded_output_file_name($destination_directory);
+  my $succeeded
+    = $self->create_destination_directory($encoded_destination_directory,
+                                          $destination_directory);
+  if (!$succeeded) {
+    return undef;
+  }
+
   my $text_output = '';
   if ($output_file eq '') {
     $self->{'current_filename'} = $output_filename;
@@ -13095,14 +13104,6 @@ sub _setup_output($)
   # is mainly useful when split and 'document_name' that is generally useful.
   my ($output_file, $destination_directory, $output_filename, $document_name)
         = $self->determine_files_and_directory($self->{'output_format'});
-  my ($encoded_destination_directory, $dir_encoding)
-    = $self->encoded_output_file_name($destination_directory);
-  my $succeeded
-    = $self->create_destination_directory($encoded_destination_directory,
-                                          $destination_directory);
-  unless ($succeeded) {
-    return undef;
-  }
 
   # set for init files
   $self->{'converter_info'}->{'document_name'} = $document_name;
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 3cf09fce40..0855864145 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -15829,10 +15829,6 @@ html_setup_output (CONVERTER *self, char **paths)
   int setup_handler_status;
   int js_categories_list_nr = 0;
   const char *structure_preamble_document_language;
-  char *destination_directory;
-  char *encoded_destination_directory;
-  char *dir_encoding;
-  int succeeded;
 
   if (self->conf->OUTFILE.o.string)
     {
@@ -15984,26 +15980,8 @@ html_setup_output (CONVERTER *self, char **paths)
   /* ($output_file, $destination_directory, $output_filename, $document_name) 
*/
   determine_files_and_directory (self, self->output_format, paths);
 
-  destination_directory = paths[1];
-
-  encoded_destination_directory = encoded_output_file_name (self->conf,
-                                            &self->document->global_info,
-                                                   destination_directory,
-                                                       &dir_encoding, 0);
-
-  free (dir_encoding);
-
-  succeeded = create_destination_directory (self,
-                                     encoded_destination_directory,
-                                           destination_directory);
-
-  free (encoded_destination_directory);
-
-  if (!succeeded)
-    return 0;
-
   self->document_name = strdup (paths[3]);
-  self->destination_directory = strdup (destination_directory);
+  self->destination_directory = strdup (paths[1]);
 
   return 1;
 }
@@ -18016,6 +17994,26 @@ html_convert_output (CONVERTER *self, const ELEMENT 
*root,
     (self->document, self->output_units_descriptors[OUDT_units]);
   const OUTPUT_UNIT_LIST *special_units = retrieve_output_units
     (self->document, self->output_units_descriptors[OUDT_special_units]);
+  char *encoded_destination_directory;
+  char *dir_encoding;
+  int succeeded;
+
+  /* cast to remove const since the encoded_output_file_name argument cannot
+     be const even though the string is not modified */
+  encoded_destination_directory = encoded_output_file_name (self->conf,
+                                            &self->document->global_info,
+                                           (char *)destination_directory,
+                                                       &dir_encoding, 0);
+  free (dir_encoding);
+
+  succeeded = create_destination_directory (self,
+                                     encoded_destination_directory,
+                                           destination_directory);
+
+  free (encoded_destination_directory);
+
+  if (!succeeded)
+    return 0;
 
   text_init (&result);
   text_init (&text);



reply via email to

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