[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Sat, 24 Feb 2024 17:26:11 -0500 (EST) |
branch: master
commit c9a317338ef1968b1ffee096221afd1ef24889c9
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 24 22:57:13 2024 +0100
* tp/Makefile.am (test_files),
tp/t/init/set_unit_file_name_filepath.pm, tp/Makefile.tres,
tp/t/html_tests.t (set_unit_file_name_filepath): add test of
unit_file_name user-defined file setting filepath.
---
ChangeLog | 7 +
tp/Makefile.am | 1 +
tp/Makefile.tres | 2 +
tp/t/html_tests.t | 9 +
tp/t/init/set_unit_file_name_filepath.pm | 31 +++
.../html_tests/set_unit_file_name_filepath.pl | 266 +++++++++++++++++++++
.../set_unit_file_name_filepath/res_html/chap.html | 22 ++
.../res_html/fname.html | 40 ++++
.../res_html/index.html | 48 ++++
9 files changed, 426 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 7846dc2f5b..f96d445499 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-02-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Makefile.am (test_files),
+ tp/t/init/set_unit_file_name_filepath.pm, tp/Makefile.tres,
+ tp/t/html_tests.t (set_unit_file_name_filepath): add test of
+ unit_file_name user-defined file setting filepath.
+
2024-02-24 Patrice Dumas <pertusus@free.fr>
Add const.
diff --git a/tp/Makefile.am b/tp/Makefile.am
index 93568bd533..5d760400bd 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -187,6 +187,7 @@ test_files = \
t/init/redefine_need.init \
t/init/redirection_file_collision_with_special.init \
t/init/redirection_file_collision_with_user_def.init \
+ t/init/set_unit_file_name_filepath.pm \
t/init/special_element_customization.pm \
t/init/t2h_singular.init \
t/init/test_css_info_functions.pm \
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 61c523f6d6..ca3c72be6b 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -709,6 +709,8 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/html_tests/ref_in_preformatted.pl \
t/results/html_tests/sectioning_check_menu_structure.pl \
t/results/html_tests/sectioning_check_menu_structure/res_html \
+ t/results/html_tests/set_unit_file_name_filepath.pl \
+ t/results/html_tests/set_unit_file_name_filepath/res_html \
t/results/html_tests/shortcontents_no_top.pl \
t/results/html_tests/shorttitlepage.pl \
t/results/html_tests/simplest_test_date_in_header.pl \
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index fa7adcb7dc..bb7199d31e 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -1148,6 +1148,15 @@ Need 2 elements for separate footnotes.
@anchor{@sansserif{ll} @r{jj}}
',],
+['set_unit_file_name_filepath',
+'@node Top
+@top top
+
+@node chap
+@chapter Chap
+', {'init_files' => ['set_unit_file_name_filepath.pm']},
+ {'SPLIT' => 'node'},
+],
# NOTE the result is incorrect, the first footnote text is at the
# end of the file but the link is towards the separate file.
# The manual states that the footnotestyle should be in the preamble,
diff --git a/tp/t/init/set_unit_file_name_filepath.pm
b/tp/t/init/set_unit_file_name_filepath.pm
new file mode 100644
index 0000000000..d3d2e9e640
--- /dev/null
+++ b/tp/t/init/set_unit_file_name_filepath.pm
@@ -0,0 +1,31 @@
+use strict;
+
+texinfo_register_file_id_setting_function('unit_file_name',
+
\&test_set_unit_file_name_filepath_file_name);
+
+sub test_set_unit_file_name_filepath_file_name($$$$)
+{
+ my $converter = shift;
+ my $output_unit = shift;
+ my $filename = shift;
+ my $filepath = shift;
+
+ my $extension = $converter->get_conf('EXTENSION');
+ my $extension_string = '';
+ if (defined($extension)) {
+ $extension_string = ".$extension";
+ }
+ if ($filename eq 'chap'.$extension_string) {
+ my $filename = 'fname'.$extension_string;
+ my $subdir = $converter->get_conf('SUBDIR');
+ if (defined($subdir) and $subdir ne '') {
+ $filepath = $subdir.'/'.$filename;
+ } else {
+ $filepath = $filename;
+ }
+ return ($filename, $filepath);
+ }
+ return (undef, undef);
+}
+
+1;
diff --git a/tp/t/results/html_tests/set_unit_file_name_filepath.pl
b/tp/t/results/html_tests/set_unit_file_name_filepath.pl
new file mode 100644
index 0000000000..50e8b7dd54
--- /dev/null
+++ b/tp/t/results/html_tests/set_unit_file_name_filepath.pl
@@ -0,0 +1,266 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'set_unit_file_name_filepath'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'type' => 'preamble_before_content'
+ }
+ ],
+ 'type' => 'before_node_section'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'Top'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'is_target' => 1,
+ 'normalized' => 'Top'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'top'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'top',
+ 'contents' => [
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ }
+ ],
+ 'extra' => {},
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'chap'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'is_target' => 1,
+ 'normalized' => 'chap'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 4
+ }
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'Chap'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'section_number' => '1'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 5
+ }
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'set_unit_file_name_filepath'} = '@node Top
+@top top
+
+@node chap
+@chapter Chap
+';
+
+
+$result_texts{'set_unit_file_name_filepath'} = 'top
+***
+
+1 Chap
+******
+';
+
+$result_sectioning{'set_unit_file_name_filepath'} = {
+ 'extra' => {
+ 'section_childs' => [
+ {
+ 'cmdname' => 'top',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'Top'
+ }
+ },
+ 'section_childs' => [
+ {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'associated_node' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'normalized' => 'chap'
+ }
+ },
+ 'section_directions' => {
+ 'up' => {}
+ },
+ 'section_level' => 1,
+ 'section_number' => '1',
+ 'toplevel_directions' => {
+ 'prev' => {},
+ 'up' => {}
+ }
+ }
+ }
+ ],
+ 'section_level' => 0,
+ 'sectioning_root' => {},
+ 'toplevel_directions' => {}
+ }
+ }
+ ],
+ 'section_level' => -1
+ }
+};
+$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'section_directions'}{'up'}
=
$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'toplevel_directions'}{'prev'}
=
$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'toplevel_directions'}{'up'}
=
$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'set_unit_file_name_filepath'}{'extra'}{'section_childs'}[0]{'extra'}{'sectioning_root'}
= $result_sectioning{'set_unit_file_name_filepath'};
+
+$result_nodes{'set_unit_file_name_filepath'} = [
+ {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'top',
+ 'extra' => {}
+ },
+ 'node_directions' => {
+ 'next' => {
+ 'cmdname' => 'node',
+ 'extra' => {
+ 'associated_section' => {
+ 'cmdname' => 'chapter',
+ 'extra' => {
+ 'section_number' => '1'
+ }
+ },
+ 'node_directions' => {
+ 'prev' => {},
+ 'up' => {}
+ },
+ 'normalized' => 'chap'
+ }
+ }
+ },
+ 'normalized' => 'Top'
+ }
+ },
+ {}
+];
+$result_nodes{'set_unit_file_name_filepath'}[0]{'extra'}{'node_directions'}{'next'}{'extra'}{'node_directions'}{'prev'}
= $result_nodes{'set_unit_file_name_filepath'}[0];
+$result_nodes{'set_unit_file_name_filepath'}[0]{'extra'}{'node_directions'}{'next'}{'extra'}{'node_directions'}{'up'}
= $result_nodes{'set_unit_file_name_filepath'}[0];
+$result_nodes{'set_unit_file_name_filepath'}[1] =
$result_nodes{'set_unit_file_name_filepath'}[0]{'extra'}{'node_directions'}{'next'};
+
+$result_menus{'set_unit_file_name_filepath'} = [
+ {
+ 'extra' => {
+ 'normalized' => 'Top'
+ }
+ },
+ {
+ 'extra' => {
+ 'normalized' => 'chap'
+ }
+ }
+];
+
+$result_errors{'set_unit_file_name_filepath'} = undef;
+
+
+$result_floats{'set_unit_file_name_filepath'} = {};
+
+
+1;
diff --git
a/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/chap.html
b/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/chap.html
new file mode 100644
index 0000000000..c1a9532e9f
--- /dev/null
+++ b/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/chap.html
@@ -0,0 +1,22 @@
+<!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>chap (top)</title>
+
+<meta name="description" content="chap (top)">
+<meta name="keywords" content="chap (top)">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+
+<meta http-equiv="Refresh" content="0; url=fname.html">
+<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="fname.html">chap</a>.</p>
+</body>
diff --git
a/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/fname.html
b/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/fname.html
new file mode 100644
index 0000000000..7a98bad196
--- /dev/null
+++ b/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/fname.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>chap (top)</title>
+
+<meta name="description" content="chap (top)">
+<meta name="keywords" content="chap (top)">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="index.html" rel="start" title="Top">
+<link href="index.html" rel="up" title="Top">
+<link href="index.html" rel="prev" title="Top">
+<style type="text/css">
+<!--
+a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
+span:hover a.copiable-link {visibility: visible}
+-->
+</style>
+
+
+</head>
+
+<body lang="en">
+<div class="chapter-level-extent" id="chap">
+<div class="nav-panel">
+<p>
+Previous: <a href="index.html" accesskey="p" rel="prev">top</a>, Up: <a
href="index.html" accesskey="u" rel="up">top</a> </p>
+</div>
+<hr>
+<h2 class="chapter" id="Chap"><span>1 Chap<a class="copiable-link"
href="#Chap"> ¶</a></span></h2>
+</div>
+
+
+
+</body>
+</html>
diff --git
a/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/index.html
b/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/index.html
new file mode 100644
index 0000000000..5de0d15f60
--- /dev/null
+++ b/tp/t/results/html_tests/set_unit_file_name_filepath/res_html/index.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>Top (top)</title>
+
+<meta name="description" content="Top (top)">
+<meta name="keywords" content="Top (top)">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="#Top" rel="start" title="Top">
+<link href="fname.html" rel="next" title="chap">
+<style type="text/css">
+<!--
+a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
+span:hover a.copiable-link {visibility: visible}
+-->
+</style>
+
+
+</head>
+
+<body lang="en">
+<div class="top-level-extent" id="Top">
+<div class="nav-panel">
+<p>
+Next: <a href="fname.html" accesskey="n" rel="next">Chap</a> </p>
+</div>
+<hr>
+<h1 class="top" id="top"><span>top<a class="copiable-link" href="#top">
¶</a></span></h1>
+
+<ul class="mini-toc">
+<li><a href="fname.html" accesskey="1">Chap</a></li>
+</ul>
+</div>
+<hr>
+<div class="nav-panel">
+<p>
+Next: <a href="fname.html" accesskey="n" rel="next">Chap</a> </p>
+</div>
+
+
+
+</body>
+</html>