[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Mon, 30 Sep 2024 12:29:38 -0400 (EDT) |
branch: master
commit 1cd9ec00406a39ef9fda3fa572198125a60dd5dc
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jul 20 22:44:55 2024 +0200
* tp/Texinfo/XS/convert/convert_html.c
(special_characters_formatting): fix right quote numerical entity.
* tp/Texinfo/Convert/HTML.pm (_initialize_output_state)
(conversion_initialization): move Perl code related to setting up
non_breaking_space, paragraph_symbol, resetting some configuration
based on special characters and line_break_element from
conversion_initialization to _initialize_output_state.
---
ChangeLog | 11 +++
tp/Texinfo/Convert/HTML.pm | 128 +++++++++++++++++------------------
tp/Texinfo/XS/convert/convert_html.c | 2 +-
3 files changed, 76 insertions(+), 65 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c479c27e0b..1222efa8bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,17 @@
* tp/Texinfo/XS/Makefile.am (ConvertXS_la_SOURCES): remove
convert_html.c to only use shared data in libtexinfo-convert.
+2024-07-20 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/convert/convert_html.c
+ (special_characters_formatting): fix right quote numerical entity.
+
+ * tp/Texinfo/Convert/HTML.pm (_initialize_output_state)
+ (conversion_initialization): move Perl code related to setting up
+ non_breaking_space, paragraph_symbol, resetting some configuration
+ based on special characters and line_break_element from
+ conversion_initialization to _initialize_output_state.
+
2024-07-20 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_initialize_output_state)
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index acfcd6961c..38fde9d1c7 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12234,6 +12234,70 @@ sub _initialize_output_state($$)
$self->{'css_rule_lines'} = [];
$self->{'css_import_lines'} = [];
+ my %special_characters_set;
+
+ my $output_encoding = $self->get_conf('OUTPUT_ENCODING_NAME');
+
+ foreach my $special_character (keys(%special_characters)) {
+ my ($default_entity, $unicode_point)
+ = @{$special_characters{$special_character}};
+ if ($self->get_conf('OUTPUT_CHARACTERS')
+ and Texinfo::Convert::Unicode::unicode_point_decoded_in_encoding(
+ $output_encoding, $unicode_point)) {
+ $special_characters_set{$special_character}
+ = charnames::vianame("U+$unicode_point");
+ } elsif ($self->get_conf('USE_NUMERIC_ENTITY')) {
+ $special_characters_set{$special_character}
+ = '&#'.hex($unicode_point).';';
+ } else {
+ $special_characters_set{$special_character} = $default_entity;
+ }
+ }
+
+ # used for direct access for speed
+ $self->{'non_breaking_space'} =
$special_characters_set{'non_breaking_space'};
+ $self->{'converter_info'}->{'non_breaking_space'}
+ = $special_characters_set{'non_breaking_space'};
+
+ $self->{'converter_info'}->{'paragraph_symbol'}
+ = $special_characters_set{'paragraph_symbol'};
+
+ if (not defined($self->get_conf('OPEN_QUOTE_SYMBOL'))) {
+ my $set = $self->set_conf('OPEN_QUOTE_SYMBOL',
+ $special_characters_set{'left_quote'});
+ # override undef set in init file/command line
+ $self->force_conf('OPEN_QUOTE_SYMBOL', '') if (!$set);
+ }
+ if (not defined($self->get_conf('CLOSE_QUOTE_SYMBOL'))) {
+ my $set = $self->set_conf('CLOSE_QUOTE_SYMBOL',
+ $special_characters_set{'right_quote'});
+ # override undef set in init file/command line
+ $self->force_conf('CLOSE_QUOTE_SYMBOL', '') if (!$set);
+ }
+ if (not defined($self->get_conf('MENU_SYMBOL'))) {
+ my $set = $self->set_conf('MENU_SYMBOL',
+ $special_characters_set{'bullet'});
+ # override undef set in init file/command line
+ $self->force_conf('MENU_SYMBOL', '') if (!$set);
+ }
+
+ if ($self->get_conf('USE_XML_SYNTAX')) {
+ foreach my $customization_variable ('BIG_RULE', 'DEFAULT_RULE') {
+ my $variable_value = $self->get_conf($customization_variable);
+ if (defined($variable_value)) {
+ my $closed_lone_element =
_xhtml_re_close_lone_element($variable_value);
+ if ($closed_lone_element ne $variable_value) {
+ $self->force_conf($customization_variable, $closed_lone_element);
+ }
+ }
+ }
+ $self->{'line_break_element'} = '<br/>';
+ } else {
+ $self->{'line_break_element'} = '<br>';
+ }
+ $self->{'converter_info'}->{'line_break_element'}
+ = $self->{'line_break_element'};
+
# duplicate such as not to modify the defaults
my $conf_default_no_arg_commands_formatting_normal
= Storable::dclone($default_no_arg_commands_formatting{'normal'});
@@ -12404,70 +12468,6 @@ sub conversion_initialization($;$)
$self->{'converter_info'}->{'document'} = $document;
}
- my %special_characters_set;
-
- my $output_encoding = $self->get_conf('OUTPUT_ENCODING_NAME');
-
- foreach my $special_character (keys(%special_characters)) {
- my ($default_entity, $unicode_point)
- = @{$special_characters{$special_character}};
- if ($self->get_conf('OUTPUT_CHARACTERS')
- and Texinfo::Convert::Unicode::unicode_point_decoded_in_encoding(
- $output_encoding, $unicode_point)) {
- $special_characters_set{$special_character}
- = charnames::vianame("U+$unicode_point");
- } elsif ($self->get_conf('USE_NUMERIC_ENTITY')) {
- $special_characters_set{$special_character}
- = '&#'.hex($unicode_point).';';
- } else {
- $special_characters_set{$special_character} = $default_entity;
- }
- }
-
- # used for direct access for speed
- $self->{'non_breaking_space'} =
$special_characters_set{'non_breaking_space'};
- $self->{'converter_info'}->{'non_breaking_space'}
- = $special_characters_set{'non_breaking_space'};
-
- $self->{'converter_info'}->{'paragraph_symbol'}
- = $special_characters_set{'paragraph_symbol'};
-
- if (not defined($self->get_conf('OPEN_QUOTE_SYMBOL'))) {
- my $set = $self->set_conf('OPEN_QUOTE_SYMBOL',
- $special_characters_set{'left_quote'});
- # override undef set in init file/command line
- $self->force_conf('OPEN_QUOTE_SYMBOL', '') if (!$set);
- }
- if (not defined($self->get_conf('CLOSE_QUOTE_SYMBOL'))) {
- my $set = $self->set_conf('CLOSE_QUOTE_SYMBOL',
- $special_characters_set{'right_quote'});
- # override undef set in init file/command line
- $self->force_conf('CLOSE_QUOTE_SYMBOL', '') if (!$set);
- }
- if (not defined($self->get_conf('MENU_SYMBOL'))) {
- my $set = $self->set_conf('MENU_SYMBOL',
- $special_characters_set{'bullet'});
- # override undef set in init file/command line
- $self->force_conf('MENU_SYMBOL', '') if (!$set);
- }
-
- if ($self->get_conf('USE_XML_SYNTAX')) {
- foreach my $customization_variable ('BIG_RULE', 'DEFAULT_RULE') {
- my $variable_value = $self->get_conf($customization_variable);
- if (defined($variable_value)) {
- my $closed_lone_element =
_xhtml_re_close_lone_element($variable_value);
- if ($closed_lone_element ne $variable_value) {
- $self->force_conf($customization_variable, $closed_lone_element);
- }
- }
- }
- $self->{'line_break_element'} = '<br/>';
- } else {
- $self->{'line_break_element'} = '<br>';
- }
- $self->{'converter_info'}->{'line_break_element'}
- = $self->{'line_break_element'};
-
$self->{'shared_conversion_state'} = {};
$self->{'multiple_pass'} = [];
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 55b8c07408..69748d78de 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -245,7 +245,7 @@ static HTML_COMMAND_STRUCT
html_commands_data[BUILTIN_CMD_NUMBER];
char *special_characters_formatting[SC_non_breaking_space+1][4] = {
{"¶", "\xC2\xB6", "00B6", "¶"},
{"‘", "\xE2\x80\x98", "2018", "‘"},
- {"’", "\xE2\x80\x99", "2019", "‘"},
+ {"’", "\xE2\x80\x99", "2019", "’"},
{"•", "\xE2\x80\xA2", "2022", "•"},
{" ", "\xC2\xA0", "00A0", " "},
};