texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Tue, 30 Apr 2024 14:13:57 -0400 (EDT)

branch: master
commit 78551d9cd49422c4290cf689dbc57db3cff5bb25
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Apr 29 15:58:55 2024 +0200

    * tp/Texinfo/Convert/HTML.pm (_convert_footnote_command)
    (_default_format_element_footer, _prepare_special_units),
    tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
    (html_default_format_element_footer, convert_footnote_command),
    tp/Texinfo/Convert/Plaintext.pm (process_footnotes, _convert):
    compare footnotestyle customization value to 'separate' only and
    handle an undef value.
---
 ChangeLog                            | 10 ++++++++++
 tp/Texinfo/Convert/HTML.pm           | 24 +++++++++++++++---------
 tp/Texinfo/Convert/Plaintext.pm      |  6 ++++--
 tp/Texinfo/XS/convert/convert_html.c |  7 +++++--
 4 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6d9a119130..edf31d1b2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-04-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (_convert_footnote_command)
+       (_default_format_element_footer, _prepare_special_units),
+       tp/Texinfo/XS/convert/convert_html.c (prepare_special_units)
+       (html_default_format_element_footer, convert_footnote_command),
+       tp/Texinfo/Convert/Plaintext.pm (process_footnotes, _convert):
+       compare footnotestyle customization value to 'separate' only and
+       handle an undef value.
+
 2024-04-29  Patrice Dumas  <pertusus@free.fr>
 
        * tp/TODO: notes on possible optimization after looking at callgrind
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 7acd101632..e9d692792b 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -3740,7 +3740,8 @@ sub _convert_footnote_command($$$$)
     }
   }
   my $footnote_href;
-  if ($self->get_conf('footnotestyle') eq 'end'
+  my $footnotestyle = $self->get_conf('footnotestyle');
+  if ((!defined($footnotestyle) or $footnotestyle ne 'separate')
       and (defined($multi_expanded_region)
            or $multiple_expanded_footnote)) {
     # if the footnote appears multiple times, command_href() will select
@@ -8261,12 +8262,15 @@ sub _default_format_element_footer($$$$;$)
   # NOTE the following condition is almost a duplication of the
   # condition appearing in end_page except that the file counter
   # needs not to be 1
-  if ((!$unit->{'tree_unit_directions'}->{'next'}
-       or (defined($unit->{'unit_filename'})
-           and $unit->{'unit_filename'}
-               ne 
$unit->{'tree_unit_directions'}->{'next'}->{'unit_filename'}))
-      and $self->get_conf('footnotestyle') eq 'end') {
-    $result .= 
&{$self->formatting_function('format_footnotes_segment')}($self);
+  if (!$unit->{'tree_unit_directions'}->{'next'}
+      or (defined($unit->{'unit_filename'})
+          and $unit->{'unit_filename'}
+           ne $unit->{'tree_unit_directions'}->{'next'}->{'unit_filename'})) {
+    my $footnotestyle = $self->get_conf('footnotestyle');
+    if (!defined($footnotestyle) or $footnotestyle ne 'separate') {
+      $result
+        .= &{$self->formatting_function('format_footnotes_segment')}($self);
+    }
   }
 
   if ($buttons or !$end_page or $self->get_conf('PROGRAM_NAME_IN_FOOTER')) {
@@ -10217,9 +10221,11 @@ sub _prepare_special_units($$)
   }
 
   if ($global_commands and $global_commands->{'footnote'}
-      and $self->get_conf('footnotestyle') eq 'separate'
       and scalar(@$output_units) > 1) {
-    $do_special{'footnotes'} = 1;
+    my $footnotestyle = $self->get_conf('footnotestyle');
+    if (defined($footnotestyle) and $footnotestyle eq 'separate') {
+      $do_special{'footnotes'} = 1;
+    }
   }
 
   if ((!defined($self->get_conf('DO_ABOUT'))
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 8d38717404..c9ad367ca7 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1295,7 +1295,8 @@ sub process_footnotes($;$)
     }
 
     _add_newline_if_needed($self);
-    if ($self->get_conf('footnotestyle') eq 'end'
+    my $footnotestyle = $self->get_conf('footnotestyle');
+    if (!defined($footnotestyle) or $footnotestyle ne 'separate'
         # no node content happens only in very special cases, such as
         # a @footnote in @copying and @insertcopying (and USE_NODES=0?)
         or !$label_element) {
@@ -2873,7 +2874,8 @@ sub _convert($$)
              add_next($formatter->{'container'},
                       "($formatted_footnote_number)", 1),
              $formatter->{'container'});
-        if ($self->get_conf('footnotestyle') eq 'separate'
+        my $footnotestyle = $self->get_conf('footnotestyle');
+        if (defined($footnotestyle) and $footnotestyle eq 'separate'
             and $self->{'current_node'}) {
           _convert($self, {'contents' =>
            [{'text' => ' ('},
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 450ca937be..5a5a511205 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1547,6 +1547,7 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor)
     }
 
   if (self->document->global_commands->footnotes.number > 0
+      && self->conf->footnotestyle.string
       && !strcmp(self->conf->footnotestyle.string, "separate")
       && output_units->number > 1)
     add_string ("footnotes", do_special);
@@ -8159,7 +8160,8 @@ html_default_format_element_footer (CONVERTER *self,
        || (output_unit->unit_filename
            && strcmp (output_unit->unit_filename,
               output_unit->tree_unit_directions[D_next]->unit_filename)))
-      && !strcmp (self->conf->footnotestyle.string, "end"))
+      && (!self->conf->footnotestyle.string
+          || strcmp (self->conf->footnotestyle.string, "separate")))
     {
       format_footnotes_segment (self, result);
     }
@@ -8940,7 +8942,8 @@ convert_footnote_command (CONVERTER *self, const enum 
command_id cmd,
       footnote_id_number->number++;
     }
 
-  if (!strcmp (self->conf->footnotestyle.string, "end")
+  if ((!self->conf->footnotestyle.string
+       || strcmp (self->conf->footnotestyle.string, "separate"))
       && (multi_expanded_region || multiple_expanded_footnote))
     {
    /* if the footnote appears multiple times, command_href() will select



reply via email to

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