[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_node_redirections)
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_node_redirections): use labels_list instead of labels_information. |
Date: |
Sun, 10 Mar 2024 10:50:48 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 4fcaa1c93d * tp/Texinfo/Convert/HTML.pm (_node_redirections): use
labels_list instead of labels_information.
4fcaa1c93d is described below
commit 4fcaa1c93d0e02398b45dc454acb4b80279382f0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Mar 10 15:50:48 2024 +0100
* tp/Texinfo/Convert/HTML.pm (_node_redirections): use labels_list
instead of labels_information.
* tp/Texinfo/XS/convert/ConvertXS.xs
(html_prepare_units_directions_files),
tp/Texinfo/XS/convert/convert_html.c (html_reset_files_source_info)
(html_free_files_source_info, html_destroy_files_source_info)
(html_set_pages_files, html_reset_converter, html_free_converter),
tp/Texinfo/XS/main/converter_types.h (FILE_SOURCE_INFO)
(FILE_SOURCE_INFO_LIST, CONVERTER), tp/Texinfo/XS/main/utils.h:
add files_source_info to converter, move FILE_SOURCE_INFO and
FILE_SOURCE_INFO_LIST definition to converter_types.h. Use converter
files_source_info in html_set_pages_files, add functions to reset and
free FILE_SOURCE_INFO_LIST and use those functions in converter reset
and free, instead of destroying the files_source_info in
html_prepare_units_directions_files.
---
ChangeLog | 19 ++++++++
tp/Texinfo/Convert/HTML.pm | 20 +++++----
tp/Texinfo/XS/convert/ConvertXS.xs | 5 ---
tp/Texinfo/XS/convert/build_html_perl_state.h | 2 +-
tp/Texinfo/XS/convert/convert_html.c | 52 ++++++++++++++++++----
tp/Texinfo/XS/convert/convert_html.h | 2 -
tp/Texinfo/XS/main/converter_types.h | 15 +++++++
tp/Texinfo/XS/main/utils.h | 14 ------
.../res_html/ancher.html | 1 +
.../res_html/yyyy.html | 1 -
..._name_case_insensitive_conflict_redirections.pl | 12 ++---
.../res_html/Foo.html | 22 ---------
tp/t/results/html_tests/redirection_same_labels.pl | 24 +++++-----
.../redirection_same_labels/res_html/i.html | 10 ++---
.../html_tests/transliterated_names_conflicts.pl | 12 ++---
15 files changed, 120 insertions(+), 91 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3aea4182ea..ab0791abad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2024-03-10 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_node_redirections): use labels_list
+ instead of labels_information.
+
+ * tp/Texinfo/XS/convert/ConvertXS.xs
+ (html_prepare_units_directions_files),
+ tp/Texinfo/XS/convert/convert_html.c (html_reset_files_source_info)
+ (html_free_files_source_info, html_destroy_files_source_info)
+ (html_set_pages_files, html_reset_converter, html_free_converter),
+ tp/Texinfo/XS/main/converter_types.h (FILE_SOURCE_INFO)
+ (FILE_SOURCE_INFO_LIST, CONVERTER), tp/Texinfo/XS/main/utils.h:
+ add files_source_info to converter, move FILE_SOURCE_INFO and
+ FILE_SOURCE_INFO_LIST definition to converter_types.h. Use converter
+ files_source_info in html_set_pages_files, add functions to reset and
+ free FILE_SOURCE_INFO_LIST and use those functions in converter reset
+ and free, instead of destroying the files_source_info in
+ html_prepare_units_directions_files.
+
2024-03-10 Patrice Dumas <pertusus@free.fr>
* tp/t/automatic_nodes.t, tp/t/do_master_menu.t,
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index fda5474cbd..0f47adaaa4 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -12579,23 +12579,25 @@ sub _node_redirections($$$$)
my $destination_directory = shift;
my $files_source_info = shift;
- my $identifiers_target;
+ my $labels_list;
if ($self->{'document'}) {
- $identifiers_target = $self->{'document'}->labels_information();
+ $labels_list = $self->{'document'}->labels_list();
}
- my $extension = '';
- $extension = '.'.$self->get_conf('EXTENSION')
- if (defined($self->get_conf('EXTENSION'))
- and $self->get_conf('EXTENSION') ne '');
my $redirection_files_done = 0;
# do node redirection pages
$self->{'current_filename'} = undef;
if ($self->get_conf('NODE_FILES')
- and $identifiers_target and $output_file ne '') {
+ and $labels_list and $output_file ne '') {
+ my $extension = '';
+ $extension = '.'.$self->get_conf('EXTENSION')
+ if (defined($self->get_conf('EXTENSION'))
+ and $self->get_conf('EXTENSION') ne '');
+
my %redirection_filenames;
- foreach my $label (sort(keys (%{$identifiers_target}))) {
- my $target_element = $identifiers_target->{$label};
+ foreach my $target_element (@$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);
# filename may not be defined in case of an @anchor or similar in
# @titlepage, and @titlepage is not used.
diff --git a/tp/Texinfo/XS/convert/ConvertXS.xs
b/tp/Texinfo/XS/convert/ConvertXS.xs
index ce733c154a..8d50b360a6 100644
--- a/tp/Texinfo/XS/convert/ConvertXS.xs
+++ b/tp/Texinfo/XS/convert/ConvertXS.xs
@@ -1961,11 +1961,6 @@ html_prepare_units_directions_files (SV *converter_in,
SV *output_units_in, SV *
/* file names API */
pass_output_unit_files (converter_in, &self->output_unit_files);
- if (files_source_info)
- {
- html_destroy_files_source_info (files_source_info);
- }
-
RETVAL = files_source_info_sv;
OUTPUT:
RETVAL
diff --git a/tp/Texinfo/XS/convert/build_html_perl_state.h
b/tp/Texinfo/XS/convert/build_html_perl_state.h
index f7dbb971b9..d79f39f20c 100644
--- a/tp/Texinfo/XS/convert/build_html_perl_state.h
+++ b/tp/Texinfo/XS/convert/build_html_perl_state.h
@@ -7,7 +7,7 @@
#include "tree_types.h"
#include "converter_types.h"
-/* for FILE_SOURCE_INFO_LIST HTML_ARGS_FORMATTED */
+/* for HTML_ARGS_FORMATTED */
#include "utils.h"
/* for NAMED_STRING_ELEMENT_LIST */
#include "translations.h"
diff --git a/tp/Texinfo/XS/convert/convert_html.c
b/tp/Texinfo/XS/convert/convert_html.c
index 71ea4f7745..8e0b13a1c6 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -2070,7 +2070,7 @@ set_root_commands_targets_node_files (CONVERTER *self)
if (self->document->identifiers_target)
{
- char *extension = 0;
+ const char *extension = 0;
if (self->conf->EXTENSION.string)
extension = self->conf->EXTENSION.string;
@@ -3063,7 +3063,7 @@ external_node_href (CONVERTER *self, const ELEMENT
*external_node,
char *file = 0;
/* used if target_split */
char *directory = 0;
- char *extension = 0;
+ const char *extension = 0;
int target_split = 0;
char *normalized = lookup_extra_string (external_node, "normalized");
ELEMENT *node_contents = lookup_extra_element (external_node,
"node_content");
@@ -5232,7 +5232,7 @@ find_file_source_info (FILE_SOURCE_INFO_LIST
*files_source_info,
}
void
-html_destroy_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info)
+html_reset_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info)
{
int i;
for (i = 0; i < files_source_info->number; i++)
@@ -5240,7 +5240,22 @@ html_destroy_files_source_info (FILE_SOURCE_INFO_LIST
*files_source_info)
free (files_source_info->list[i].filename);
free (files_source_info->list[i].path);
}
+ files_source_info->number = 0;
+}
+
+void
+html_free_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info)
+{
+ html_reset_files_source_info (files_source_info);
free (files_source_info->list);
+ files_source_info->list = 0;
+ files_source_info->space = 0;
+}
+
+void
+html_destroy_files_source_info (FILE_SOURCE_INFO_LIST *files_source_info)
+{
+ html_free_files_source_info (files_source_info);
free (files_source_info);
}
@@ -5254,7 +5269,6 @@ add_to_unit_file_name_paths (char **unit_file_name_paths,
return unit_file_name_paths[output_unit->index];
}
-/* Return structure to be freed by the caller */
static FILE_SOURCE_INFO_LIST *
html_set_pages_files (CONVERTER *self, const OUTPUT_UNIT_LIST *output_units,
const OUTPUT_UNIT_LIST *special_units,
@@ -5263,15 +5277,13 @@ html_set_pages_files (CONVERTER *self, const
OUTPUT_UNIT_LIST *output_units,
const char *destination_directory, const char
*output_filename,
const char *document_name)
{
- FILE_SOURCE_INFO_LIST *files_source_info = 0;
+ FILE_SOURCE_INFO_LIST *files_source_info;
char **unit_file_name_paths;
int i;
initialize_output_units_files (self);
- files_source_info = (FILE_SOURCE_INFO_LIST *)
- malloc (sizeof (FILE_SOURCE_INFO_LIST));
- memset (files_source_info, 0, sizeof (FILE_SOURCE_INFO_LIST));
+ files_source_info = &self->files_source_info;
unit_file_name_paths = (char **)
malloc (output_units->number * sizeof (char *));
@@ -16900,6 +16912,8 @@ html_reset_converter (CONVERTER *self)
self->added_title_tree = 0;
}
+ html_reset_files_source_info (&self->files_source_info);
+
if (self->jslicenses.number)
{
int i;
@@ -17034,6 +17048,8 @@ html_free_converter (CONVERTER *self)
free_strings_list (&self->seen_ids);
+ html_free_files_source_info (&self->files_source_info);
+
free_strings_list (&self->check_htmlxref_already_warned);
for (i = 0; i < SUIT_type_heading+1; i++)
@@ -18764,3 +18780,23 @@ html_convert_output (CONVERTER *self, const ELEMENT
*root,
return 0;
}
}
+
+/*
+int
+html_node_redirections (CONVERTER *self,
+ const char *output_file, const char
*destination_directory)
+{
+ FILE_SOURCE_INFO_LIST *files_source_info = &self->files_source_info;
+ int redirection_files_done = 0;
+ if (self->document->identifiers_target && self->conf->NODE_FILES.integer > 0
+ && strlen(output_file) > 0)
+ {
+ const char *extension = 0;
+
+ if (self->conf->EXTENSION.string)
+ extension = self->conf->EXTENSION.string;
+ }
+
+ return redirection_files_done;
+}
+*/
diff --git a/tp/Texinfo/XS/convert/convert_html.h
b/tp/Texinfo/XS/convert/convert_html.h
index cb5ba0270a..1d4c572b35 100644
--- a/tp/Texinfo/XS/convert/convert_html.h
+++ b/tp/Texinfo/XS/convert/convert_html.h
@@ -5,8 +5,6 @@
#include "command_ids.h"
#include "element_types.h"
#include "converter_types.h"
-/* for FILE_SOURCE_INFO_LIST */
-#include "utils.h"
enum count_elements_in_filename_type {
CEFT_total,
diff --git a/tp/Texinfo/XS/main/converter_types.h
b/tp/Texinfo/XS/main/converter_types.h
index e2f79ae275..6cd10babf6 100644
--- a/tp/Texinfo/XS/main/converter_types.h
+++ b/tp/Texinfo/XS/main/converter_types.h
@@ -411,6 +411,20 @@ typedef struct OUTPUT_FILES_INFORMATION {
FILE_STREAM_LIST unclosed_files;
} OUTPUT_FILES_INFORMATION;
+typedef struct FILE_SOURCE_INFO {
+ char *filename;
+ const char *type;
+ const char *name;
+ const ELEMENT *element;
+ char *path;
+} FILE_SOURCE_INFO;
+
+typedef struct FILE_SOURCE_INFO_LIST {
+ size_t number;
+ size_t space;
+ FILE_SOURCE_INFO *list;
+} FILE_SOURCE_INFO_LIST;
+
typedef struct SPECIAL_UNIT_DIRECTION {
const OUTPUT_UNIT *output_unit;
const char *direction;
@@ -739,6 +753,7 @@ typedef struct CONVERTER {
HTML_TARGET_LIST html_targets[BUILTIN_CMD_NUMBER];
HTML_TARGET_LIST html_special_targets[ST_footnote_location+1];
COMMAND_STACK html_target_cmds; /* list of cmd with targets */
+ FILE_SOURCE_INFO_LIST files_source_info;
JSLICENSE_CATEGORY_LIST jslicenses;
/* associate cmd and index in special_unit_varieties STRING_LIST */
/* number in sync with command_special_unit_variety, +1 for trailing 0 */
diff --git a/tp/Texinfo/XS/main/utils.h b/tp/Texinfo/XS/main/utils.h
index 110ad28465..bd6525d84d 100644
--- a/tp/Texinfo/XS/main/utils.h
+++ b/tp/Texinfo/XS/main/utils.h
@@ -127,20 +127,6 @@ typedef struct TARGET_FILENAME {
char *filename;
} TARGET_FILENAME;
-typedef struct FILE_SOURCE_INFO {
- char *filename;
- const char *type;
- const char *name;
- const ELEMENT *element;
- char *path;
-} FILE_SOURCE_INFO;
-
-typedef struct FILE_SOURCE_INFO_LIST {
- size_t number;
- size_t space;
- FILE_SOURCE_INFO *list;
-} FILE_SOURCE_INFO_LIST;
-
extern const char *html_argument_formatting_type_names[];
typedef struct ACCENTS_STACK {
diff --git
a/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/ancher.html
b/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/ancher.html
index 93fa89d498..3f4b3cf1c5 100644
---
a/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/ancher.html
+++
b/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/ancher.html
@@ -13,6 +13,7 @@
<style type="text/css">
<!--
span.r {font-family: initial; font-weight: normal; font-style: normal}
+span.sansserif {font-family: sans-serif; font-weight: normal}
-->
</style>
diff --git
a/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/yyyy.html
b/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/yyyy.html
index 8e520d877d..fa0b468174 100644
---
a/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/yyyy.html
+++
b/tp/t/results/html_tests/command_in_node_redirection_multiple/res_html/yyyy.html
@@ -13,7 +13,6 @@
<style type="text/css">
<!--
span.r {font-family: initial; font-weight: normal; font-style: normal}
-span.sansserif {font-family: sans-serif; font-weight: normal}
-->
</style>
diff --git
a/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections.pl
b/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections.pl
index fc5146052e..7123d2ed62 100644
---
a/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections.pl
+++
b/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections.pl
@@ -590,18 +590,18 @@
$result_floats{'file_name_case_insensitive_conflict_redirections'} = {};
$result_converted_errors{'file_html'}->{'file_name_case_insensitive_conflict_redirections'}
= [
{
- 'error_line' => 'warning: @anchor `foo\' file Foo.html for redirection
exists
+ 'error_line' => 'warning: @anchor `Foo\' file foo.html for redirection
exists
',
- 'line_nr' => 9,
- 'text' => '@anchor `foo\' file Foo.html for redirection exists',
+ 'line_nr' => 13,
+ 'text' => '@anchor `Foo\' file foo.html for redirection exists',
'type' => 'warning'
},
{
'continuation' => 1,
- 'error_line' => 'warning: conflict with @anchor `Foo\' redirection file
+ 'error_line' => 'warning: conflict with @anchor `foo\' redirection file
',
- 'line_nr' => 13,
- 'text' => 'conflict with @anchor `Foo\' redirection file',
+ 'line_nr' => 9,
+ 'text' => 'conflict with @anchor `foo\' redirection file',
'type' => 'warning'
}
];
diff --git
a/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections/res_html/Foo.html
b/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections/res_html/Foo.html
deleted file mode 100644
index 8140645354..0000000000
---
a/tp/t/results/html_tests/file_name_case_insensitive_conflict_redirections/res_html/Foo.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
-<!-- This file redirects to the location of a node or anchor -->
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>Foo (top section)</title>
-
-<meta name="description" content="Foo (top section)">
-<meta name="keywords" content="Foo (top section)">
-<meta name="resource-type" content="document">
-<meta name="distribution" content="global">
-
-<meta http-equiv="Refresh" content="0; url=index.html#Foo">
-<meta name="viewport" content="width=device-width,initial-scale=1">
-
-</head>
-
-<body lang="en">
-
-<p>The node you are looking for is at <a href="index.html#Foo">Foo</a>.</p>
-</body>
diff --git a/tp/t/results/html_tests/redirection_same_labels.pl
b/tp/t/results/html_tests/redirection_same_labels.pl
index a5521619b0..78bad26bfa 100644
--- a/tp/t/results/html_tests/redirection_same_labels.pl
+++ b/tp/t/results/html_tests/redirection_same_labels.pl
@@ -1600,33 +1600,33 @@ output unit: @chapter circumflex
$result_converted_errors{'file_html'}->{'redirection_same_labels'} = [
{
- 'error_line' => 'warning: @node `@"i\' file i.html for redirection exists
+ 'error_line' => 'warning: @node `@~{@dotless{i}}\' file i.html for
redirection exists
',
- 'line_nr' => 20,
- 'text' => '@node `@"i\' file i.html for redirection exists',
+ 'line_nr' => 22,
+ 'text' => '@node `@~{@dotless{i}}\' file i.html for redirection exists',
'type' => 'warning'
},
{
'continuation' => 1,
- 'error_line' => 'warning: conflict with @node `@^i\' redirection file
+ 'error_line' => 'warning: conflict with @node `@"i\' redirection file
',
- 'line_nr' => 31,
- 'text' => 'conflict with @node `@^i\' redirection file',
+ 'line_nr' => 20,
+ 'text' => 'conflict with @node `@"i\' redirection file',
'type' => 'warning'
},
{
- 'error_line' => 'warning: @node `@~{@dotless{i}}\' file i.html for
redirection exists
+ 'error_line' => 'warning: @node `@^i\' file i.html for redirection exists
',
- 'line_nr' => 22,
- 'text' => '@node `@~{@dotless{i}}\' file i.html for redirection exists',
+ 'line_nr' => 31,
+ 'text' => '@node `@^i\' file i.html for redirection exists',
'type' => 'warning'
},
{
'continuation' => 1,
- 'error_line' => 'warning: conflict with @node `@^i\' redirection file
+ 'error_line' => 'warning: conflict with @node `@"i\' redirection file
',
- 'line_nr' => 31,
- 'text' => 'conflict with @node `@^i\' redirection file',
+ 'line_nr' => 20,
+ 'text' => 'conflict with @node `@"i\' redirection file',
'type' => 'warning'
}
];
diff --git a/tp/t/results/html_tests/redirection_same_labels/res_html/i.html
b/tp/t/results/html_tests/redirection_same_labels/res_html/i.html
index c4253e9c2b..27dfb8af01 100644
--- a/tp/t/results/html_tests/redirection_same_labels/res_html/i.html
+++ b/tp/t/results/html_tests/redirection_same_labels/res_html/i.html
@@ -4,19 +4,19 @@
<!-- This file redirects to the location of a node or anchor -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>î (the top)</title>
+<title>ï (the top)</title>
-<meta name="description" content="î (the top)">
-<meta name="keywords" content="î (the top)">
+<meta name="description" content="ï (the top)">
+<meta name="keywords" content="ï (the top)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
-<meta http-equiv="Refresh" content="0; url=circumflex.html#g_t_00ee">
+<meta http-equiv="Refresh" content="0; url=umlaut.html#g_t_00ef">
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body lang="en">
-<p>The node you are looking for is at <a
href="circumflex.html#g_t_00ee">î</a>.</p>
+<p>The node you are looking for is at <a
href="umlaut.html#g_t_00ef">ï</a>.</p>
</body>
diff --git a/tp/t/results/html_tests/transliterated_names_conflicts.pl
b/tp/t/results/html_tests/transliterated_names_conflicts.pl
index 585323a90c..23a3f36a55 100644
--- a/tp/t/results/html_tests/transliterated_names_conflicts.pl
+++ b/tp/t/results/html_tests/transliterated_names_conflicts.pl
@@ -1086,11 +1086,11 @@ output unit: @node Other node
$result_converted_errors{'file_html'}->{'transliterated_names_conflicts'} = [
{
- 'error_line' => "warning: \@float `Pr\x{e8}s' file Pres.html for
redirection exists
+ 'error_line' => "warning: \@anchor `Pr\x{ea}s' file Pres.html for
redirection exists
",
'file_name' => 'transliterated_names_conflicts.texi',
- 'line_nr' => 14,
- 'text' => "\@float `Pr\x{e8}s' file Pres.html for redirection exists",
+ 'line_nr' => 12,
+ 'text' => "\@anchor `Pr\x{ea}s' file Pres.html for redirection exists",
'type' => 'warning'
},
{
@@ -1103,11 +1103,11 @@
$result_converted_errors{'file_html'}->{'transliterated_names_conflicts'} = [
'type' => 'warning'
},
{
- 'error_line' => "warning: \@anchor `Pr\x{ea}s' file Pres.html for
redirection exists
+ 'error_line' => "warning: \@float `Pr\x{e8}s' file Pres.html for
redirection exists
",
'file_name' => 'transliterated_names_conflicts.texi',
- 'line_nr' => 12,
- 'text' => "\@anchor `Pr\x{ea}s' file Pres.html for redirection exists",
+ 'line_nr' => 14,
+ 'text' => "\@float `Pr\x{e8}s' file Pres.html for redirection exists",
'type' => 'warning'
},
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_node_redirections): use labels_list instead of labels_information.,
Patrice Dumas <=