texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 25 Dec 2022 19:11:45 -0500 (EST)

branch: master
commit f0fc225d94391d7c1563afa197cbc0eb1bfdb7cd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Dec 26 00:14:00 2022 +0100

    * tp/Texinfo/Convert/Converter.pm (convert_accents, xml_accents),
    tp/Texinfo/Convert/HTML.pm (_convert_accent_command)
    (_css_string_convert_accent_command),
    tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): convert accents
    to encoded characters in convert_accents based on the third
    argument, instead of checking ENABLE_ENCODING.  Update callers.
---
 ChangeLog                           |  9 +++++++++
 tp/Texinfo/Convert/Converter.pm     | 16 ++++++++++------
 tp/Texinfo/Convert/HTML.pm          |  5 ++++-
 tp/Texinfo/Convert/TexinfoMarkup.pm |  2 +-
 4 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 008b13a8cf..95c5724dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,15 @@
        preloaded.  Begin with \relax rather than space token to terminate
        filename.
 
+2022-12-25  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Converter.pm (convert_accents, xml_accents),
+       tp/Texinfo/Convert/HTML.pm (_convert_accent_command)
+       (_css_string_convert_accent_command),
+       tp/Texinfo/Convert/TexinfoMarkup.pm (_convert): convert accents
+       to encoded characters in convert_accents based on the third
+       argument, instead of checking ENABLE_ENCODING.  Update callers.
+
 2022-12-25  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Structuring.pm (sort_indices): set variable collation
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 0c0ceece91..083cd02bed 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1364,11 +1364,12 @@ sub table_item_content_tree($$$)
   return $table_item_tree;
 }
 
-sub convert_accents($$$;$)
+sub convert_accents($$$;$$)
 {
   my $self = shift;
   my $accent = shift;
   my $format_accents = shift;
+  my $output_encoded_characters = shift;
   my $in_upper_case = shift;
 
   my ($contents, $stack)
@@ -1376,7 +1377,7 @@ sub convert_accents($$$;$)
   my $result = $self->convert_tree({'contents' => $contents});
 
   my $encoded;
-  if ($self->get_conf('ENABLE_ENCODING')) {
+  if ($output_encoded_characters) {
     $encoded = Texinfo::Convert::Unicode::encoded_accents($self, $result, 
$stack,
                                        $self->get_conf('OUTPUT_ENCODING_NAME'),
                                        $format_accents,
@@ -1735,7 +1736,9 @@ sub xml_accents($$;$)
     $format_accents = \&xml_accent;
   }
   
-  return $self->convert_accents($accent, $format_accents, $in_upper_case);
+  return $self->convert_accents($accent, $format_accents,
+                                $self->get_conf('ENABLE_ENCODING'),
+                                $in_upper_case);
 }
 
 1;
@@ -1975,13 +1978,14 @@ C<contents> in the I<$contents_element> element, or 
C<undef> if there is no
 such content.  I<$separator> is an optional separator argument used, if given,
 instead of the default: a comma followed by a space.
 
-=item $result = $converter->convert_accents($accent_command, \&format_accents, 
$in_upper_case)
+=item $result = $converter->convert_accents($accent_command, \&format_accents, 
$output_encoded_characters, $in_upper_case)
 X<C<convert_accents>>
 
 I<$accent_command> is an accent command, which may have other accent
 commands nested.  The function returns the accents formatted either
-as encoded letters, or formatted using I<\&format_accents>.
-If I<$in_upper_case> is set, the result should be uppercased.
+as encoded letters if I<$output_encoded_characters> is set, or formatted
+using I<\&format_accents>.  If I<$in_upper_case> is set, the result should be
+uppercased.
 
 =item $result = $converter->convert_document_sections($root, $file_handler)
 X<C<convert_document_sections>>
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c58e5b61fc..f80f1579a6 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -3309,6 +3309,7 @@ sub _convert_accent_command($$$$)
     $format_accents = \&_accent_entities_html_accent;
   }
   return $self->convert_accents($command, $format_accents,
+                                $self->get_conf('ENABLE_ENCODING'),
                                 $self->in_upper_case());
 }
 
@@ -3362,7 +3363,9 @@ sub _css_string_convert_accent_command($$$$)
   my $args = shift;
 
   my $format_accents = \&_css_string_accent;
-  return $self->convert_accents($command, $format_accents, 
$self->in_upper_case());
+  return $self->convert_accents($command, $format_accents,
+                                $self->get_conf('ENABLE_ENCODING'),
+                                $self->in_upper_case());
 }
 
 foreach my $command (keys(%accent_commands)) {
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm 
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index cb533dfded..192e65ff77 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -657,7 +657,7 @@ sub _convert($$;$)
       return $self->_format_command($element->{'cmdname'});
     } elsif ($accent_types{$element->{'cmdname'}}) {
       if ($self->get_conf('ENABLE_ENCODING')) {
-        return $self->convert_accents($element, \&_accent);
+        return $self->convert_accents($element, \&_accent, 1);
       } else {
         my $attributes = [];
         my $arg;



reply via email to

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