texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Mon, 15 Jan 2024 12:08:35 -0500 (EST)

branch: master
commit 3a89b3d473deceeb18fbc1c0b001367c7dd0c973
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jan 15 17:13:23 2024 +0100

    * tp/Texinfo/Convert/HTML.pm (_set_heading_commands_targets),
    tp/Texinfo/XS/convert/convert_html.c (heading_commands_list): sort in
    perl and setup heading_commands_list order such as to have the same
    order in perl and XS and obtain the same disambiguation of targets.
    
    * tp/Texinfo/Convert/Converter.pm (converter),
    tp/Texinfo/Convert/HTML.pm (_set_root_commands_targets_node_files):
    use 'labels_list' instead of 'identifiers_target' for efficiency and
    to be more like XS code.
---
 ChangeLog                            | 12 ++++++++++++
 tp/Texinfo/Convert/Converter.pm      |  1 +
 tp/Texinfo/Convert/HTML.pm           |  7 ++++---
 tp/Texinfo/XS/convert/convert_html.c |  5 +++--
 4 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 19b2c26308..20ba29210f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-01-15  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_set_heading_commands_targets),
+       tp/Texinfo/XS/convert/convert_html.c (heading_commands_list): sort in
+       perl and setup heading_commands_list order such as to have the same
+       order in perl and XS and obtain the same disambiguation of targets.
+
+       * tp/Texinfo/Convert/Converter.pm (converter),
+       tp/Texinfo/Convert/HTML.pm (_set_root_commands_targets_node_files):
+       use 'labels_list' instead of 'identifiers_target' for efficiency and
+       to be more like XS code.
+
 2024-01-15  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/convert/convert_html.c
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 36ee4260b1..ba9b0eb825 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -276,6 +276,7 @@ sub converter($;$)
       # From and for XS
       $converter->{'document_descriptor'}
         = $conf->{'document'}->document_descriptor();
+      $converter->{'document'} = $conf->{'document'};
       delete $conf->{'document'};
     }
     foreach my $key (keys(%$conf)) {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index ee9ef48074..6ee5526b47 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9490,8 +9490,9 @@ sub _set_root_commands_targets_node_files($)
                 if (defined($self->get_conf('EXTENSION'))
                     and $self->get_conf('EXTENSION') ne '');
 
-    foreach my $label (sort(keys(%{$self->{'identifiers_target'}}))) {
-      my $target_element = $self->{'identifiers_target'}->{$label};
+    foreach my $target_element (@{$self->{'document'}->{'labels_list'}}) {
+      next if (not $target_element->{'extra'}
+               or not $target_element->{'extra'}->{'is_target'});
       my $label_element = Texinfo::Common::get_label_element($target_element);
       my ($node_filename, $target)
         = 
$self->_normalized_label_id_file($target_element->{'extra'}->{'normalized'},
@@ -9539,7 +9540,7 @@ sub _set_heading_commands_targets($)
   my $self = shift;
 
   if ($self->{'global_commands'}) {
-    foreach my $cmdname (keys(%sectioning_heading_commands)) {
+    foreach my $cmdname (sort(keys(%sectioning_heading_commands))) {
       if (!$root_commands{$cmdname}
           and $self->{'global_commands'}->{$cmdname}) {
         foreach my $command (@{$self->{'global_commands'}->{$cmdname}}) {
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index ee4cd49d11..728a4c03e1 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -4903,9 +4903,10 @@ prepare_footnotes_targets (CONVERTER *self)
     }
 }
 
+/* keep the command names sorted alphabetically to match order in perl */
 static enum command_id heading_commands_list[] = {
-  CM_chapheading, CM_heading, CM_subheading, CM_subsubheading,
-  CM_majorheading, 0,
+  CM_chapheading, CM_heading, CM_majorheading, CM_subheading, CM_subsubheading,
+  0,
 };
 
 void



reply via email to

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