[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sat, 30 Dec 2023 04:08:34 -0500 (EST) |
branch: master
commit 01fb008e9a6383f1ba8c753004072b0d44be1ec4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Dec 30 09:52:01 2023 +0100
* tp/Texinfo/Convert/Converter.pm (convert_accents): reorganize code
for more clarity.
* tp/Texinfo/Convert/HTML.pm (_accent_entities_html_accent): do not
consider an end of line in an accent command argument to allow to use
the entity.
* tp/Texinfo/Convert/Unicode.pm (%unicode_accented_letters): fix a
codepoint.
---
ChangeLog | 12 ++++++++++++
tp/Texinfo/Convert/Converter.pm | 22 +++++++++++-----------
tp/Texinfo/Convert/HTML.pm | 4 +++-
tp/Texinfo/Convert/Unicode.pm | 6 +++---
.../results/coverage/lettered_accent_and_spaces.pl | 4 ++--
tp/t/results/coverage/unknown_accents.pl | 4 ++--
6 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ed72e4675b..aea265909d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2023-12-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/Converter.pm (convert_accents): reorganize code
+ for more clarity.
+
+ * tp/Texinfo/Convert/HTML.pm (_accent_entities_html_accent): do not
+ consider an end of line in an accent command argument to allow to use
+ the entity.
+
+ * tp/Texinfo/Convert/Unicode.pm (%unicode_accented_letters): fix a
+ codepoint.
+
2023-12-29 Patrice Dumas <pertusus@free.fr>
Add gnulib module for XS
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 1693d22a32..534aa0bbbd 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -1521,24 +1521,24 @@ sub convert_accents($$$;$$)
my ($contents_element, $stack)
= Texinfo::Convert::Utils::find_innermost_accent_contents($accent);
- my $result = $self->convert_tree($contents_element);
+ my $arg_text = $self->convert_tree($contents_element);
- my $encoded;
if ($output_encoded_characters) {
- $encoded = Texinfo::Convert::Unicode::encoded_accents($self, $result,
$stack,
+ my $encoded = Texinfo::Convert::Unicode::encoded_accents($self,
+ $arg_text, $stack,
$self->get_conf('OUTPUT_ENCODING_NAME'),
$format_accents,
$in_upper_case);
- }
- if (!defined($encoded)) {
- foreach my $accent_command (reverse(@$stack)) {
- $result = &$format_accents ($self, $result, $accent_command,
- $in_upper_case);
+ if (defined($encoded)) {
+ return $encoded;
}
- return $result;
- } else {
- return $encoded;
}
+ my $result = $arg_text;
+ foreach my $accent_command (reverse(@$stack)) {
+ $result = &$format_accents ($self, $result, $accent_command,
+ $in_upper_case);
+ }
+ return $result;
}
# index sub-entries specified with @subentry, separated by commas, or by
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index e4c89a03b6..e7cd3ad2f1 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -3835,7 +3835,9 @@ sub _accent_entities_html_accent($$$;$$$)
return "&${text}$accent_command_entity;"
if ($accent_command_entity
and defined($accent_command_text_with_entities)
- and ($text =~ /^[$accent_command_text_with_entities]$/));
+ # \z ensures that a \n at the end prevents matching, we do not
+ # want an end of line in the middle of the entity
+ and ($text =~ /^[$accent_command_text_with_entities]\z/));
my $formatted_accent
= Texinfo::Convert::Converter::xml_numeric_entity_accent($accent, $text);
if (defined($formatted_accent)) {
diff --git a/tp/Texinfo/Convert/Unicode.pm b/tp/Texinfo/Convert/Unicode.pm
index 4ada262e59..4ccf70440b 100644
--- a/tp/Texinfo/Convert/Unicode.pm
+++ b/tp/Texinfo/Convert/Unicode.pm
@@ -304,7 +304,7 @@ our %unicode_accented_letters = (
'Y' => '00DD',
'y' => '00FD',
'Z' => '0179',
- 'z' => '018A',
+ 'z' => '017A',
},
'~' => { # tilde
'A' => '00C3',
@@ -431,8 +431,8 @@ our %unicode_accented_letters = (
'o' => '01EB',
},
'dotless' => {
- 'i' => '0131',
- 'j' => '0237',
+ 'i' => '0131', # 305
+ 'j' => '0237', # 567
}
);
diff --git a/tp/t/results/coverage/lettered_accent_and_spaces.pl
b/tp/t/results/coverage/lettered_accent_and_spaces.pl
index 59b8fdad05..fc26a94c10 100644
--- a/tp/t/results/coverage/lettered_accent_and_spaces.pl
+++ b/tp/t/results/coverage/lettered_accent_and_spaces.pl
@@ -422,8 +422,8 @@
$result_converted{'html_text'}->{'lettered_accent_and_spaces'} = '<p>å
</p>
<p>â
</p>
-<p>&a
-circ;
+<p>a
+̂
</p>
';
diff --git a/tp/t/results/coverage/unknown_accents.pl
b/tp/t/results/coverage/unknown_accents.pl
index 4fa8ef0fa3..4f1ab6ae1e 100644
--- a/tp/t/results/coverage/unknown_accents.pl
+++ b/tp/t/results/coverage/unknown_accents.pl
@@ -608,7 +608,7 @@ $result_converted{'plaintext'}->{'unknown_accents'} = 'Ẍ ẍ
Q̈ Ÿ
$result_converted{'html_text'}->{'unknown_accents'} = '<p>Ẍ ẍ
Q̈ Ÿ
</p>
-<p>Ɗ q́ ŕ
+<p>ź q́ ŕ
Ź Q́ Ŕ
</p>
<p>Ḩ ḩ
@@ -656,7 +656,7 @@ $result_converted{'latex_text'}->{'unknown_accents'} =
'\\"{X} \\"{x} \\"{Q} \\"
$result_converted{'docbook'}->{'unknown_accents'} = '<para>Ẍ ẍ
Q̈ Ÿ
</para>
-<para>Ɗ q́ ŕ
+<para>ź q́ ŕ
Ź Q́ Ŕ
</para>
<para>Ḩ ḩ