texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Makefile.tres, tp/t/html_tests.t (contents_w


From: Patrice Dumas
Subject: branch master updated: * tp/Makefile.tres, tp/t/html_tests.t (contents_with_only_top_node) (top_node_top_contents): tests of html_text and file_html for @contents with @node only or @node and @top only.
Date: Tue, 23 Jan 2024 08:20:37 -0500

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 67934f0ab9 * tp/Makefile.tres, tp/t/html_tests.t 
(contents_with_only_top_node) (top_node_top_contents): tests of html_text and 
file_html for @contents with @node only or @node and @top only.
67934f0ab9 is described below

commit 67934f0ab9de36a661e112c557f6a7fc931448c1
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jan 23 14:20:26 2024 +0100

    * tp/Makefile.tres, tp/t/html_tests.t (contents_with_only_top_node)
    (top_node_top_contents): tests of html_text and file_html for
    @contents with @node only or @node and @top only.
    
    * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units): do
    contents/shortcontents directions only if there is more than one
    section.
---
 ChangeLog                                          |  10 ++
 tp/Makefile.tres                                   |   4 +
 tp/Texinfo/XS/convert/convert_html.c               |   2 +-
 tp/t/html_tests.t                                  |  19 +++
 .../html_tests/contents_with_only_top_node.pl      | 133 ++++++++++++++++
 .../res_html/index.html                            |  32 ++++
 tp/t/results/html_tests/top_node_top_contents.pl   | 170 +++++++++++++++++++++
 .../top_node_top_contents/res_html/index.html      |  34 +++++
 8 files changed, 403 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b487182d22..ac9d2d3af6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-01-22  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Makefile.tres, tp/t/html_tests.t (contents_with_only_top_node)
+       (top_node_top_contents): tests of html_text and file_html for
+       @contents with @node only or @node and @top only.
+
+       * tp/Texinfo/XS/convert/convert_html.c (prepare_special_units): do
+       contents/shortcontents directions only if there is more than one
+       section.
+
 2024-01-22  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Makefile.tres, tp/t/html_tests.t (end_of_line_in_uref): add test
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 95ef8ead37..8359e00211 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -582,6 +582,8 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/html_tests/contents_in_middle_section_inline/res_html \
   t/results/html_tests/contents_in_middle_section_separate_element.pl \
   t/results/html_tests/contents_in_middle_section_separate_element/res_html \
+  t/results/html_tests/contents_with_only_top_node.pl \
+  t/results/html_tests/contents_with_only_top_node/res_html \
   t/results/html_tests/css_in_node_redirection_page.pl \
   t/results/html_tests/css_in_node_redirection_page/res_html \
   t/results/html_tests/deftypefnnewline_for_copying_after.pl \
@@ -737,6 +739,8 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/html_tests/titles.pl \
   t/results/html_tests/top_file_name_and_node_name_collision.pl \
   t/results/html_tests/top_file_name_and_node_name_collision/res_html \
+  t/results/html_tests/top_node_top_contents.pl \
+  t/results/html_tests/top_node_top_contents/res_html \
   t/results/html_tests/top_node_up_explicit.pl \
   t/results/html_tests/top_node_up_explicit_no_nodes.pl \
   t/results/html_tests/top_node_up_implicit.pl \
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 30fbaf4cdc..b3f38573a2 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -1449,7 +1449,7 @@ prepare_special_units (CONVERTER *self, int 
output_units_descriptor,
      = associated_special_units_descriptor;
 
   if (self->document->sections_list
-      && self->document->sections_list->number > 0)
+      && self->document->sections_list->number > 1)
     {
       enum command_id contents_cmds[2] = {CM_shortcontents, CM_contents};
       int i;
diff --git a/tp/t/html_tests.t b/tp/t/html_tests.t
index 9a5608a516..27dc6d6cb3 100644
--- a/tp/t/html_tests.t
+++ b/tp/t/html_tests.t
@@ -841,6 +841,20 @@ my $file_name_case_insensitive_conflict_node = '@node Top
 ';
 
 my @test_cases_file_text = (
+# already tested in 30sectioning.t, but we want tests with all the possible
+# entry points
+['contents_with_only_top_node',
+'
+@node Top
+
+@contents
+',],
+['top_node_top_contents',
+'@contents
+
+@node Top
+@top Texinfo modules documentation
+',],
 ['test_accents_sc_default',
 undef, {'test_file' => 'punctuation_small_case_accents_utf8.texi'}],
 ['test_accents_sc_enable_encoding',
@@ -1372,6 +1386,11 @@ foreach my $test (@file_tests) {
   $test->[2]->{'full_document'} = 1 unless 
(exists($test->[2]->{'full_document'}));
 }
 foreach my $test (@test_cases_file_text) {
+  if (defined($test->[1])) {
+    $test->[2]->{'test_input_file_name'} = $test->[0] . '.texi';
+    $test->[2]->{'full_document'} = 1
+       unless (exists($test->[2]->{'full_document'}));
+  }
   push @{$test->[2]->{'test_formats'}}, ('html_text', 'file_html');
 }
 
diff --git a/tp/t/results/html_tests/contents_with_only_top_node.pl 
b/tp/t/results/html_tests/contents_with_only_top_node.pl
new file mode 100644
index 0000000000..c6da8d50e1
--- /dev/null
+++ b/tp/t/results/html_tests/contents_with_only_top_node.pl
@@ -0,0 +1,133 @@
+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{'contents_with_only_top_node'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [
+            {
+              'text' => '
+',
+              'type' => 'text_before_beginning'
+            }
+          ],
+          'type' => 'preamble_before_beginning'
+        },
+        {
+          'type' => 'preamble_before_content'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => '
+',
+              'type' => 'rawline_arg'
+            }
+          ],
+          'cmdname' => 'contents',
+          'extra' => {},
+          'source_info' => {
+            'line_nr' => 4
+          }
+        }
+      ],
+      'extra' => {
+        'is_target' => 1,
+        'normalized' => 'Top'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 2
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'contents_with_only_top_node'} = '
+@node Top
+
+@contents
+';
+
+
+$result_texts{'contents_with_only_top_node'} = '
+';
+
+$result_nodes{'contents_with_only_top_node'} = [
+  {
+    'cmdname' => 'node',
+    'extra' => {
+      'normalized' => 'Top'
+    }
+  }
+];
+
+$result_menus{'contents_with_only_top_node'} = [
+  {
+    'extra' => {
+      'normalized' => 'Top'
+    }
+  }
+];
+
+$result_errors{'contents_with_only_top_node'} = [];
+
+
+$result_floats{'contents_with_only_top_node'} = {};
+
+
+
+$result_converted{'html_text'}->{'contents_with_only_top_node'} = '<h1 
class="node" id="Top"><span>Top<a class="copiable-link" href="#Top"> 
&para;</a></span></h1>
+
+';
+
+$result_converted_errors{'file_html'}->{'contents_with_only_top_node'} = [
+  {
+    'error_line' => 'warning: must specify a title with a title command or @top
+',
+    'file_name' => 'contents_with_only_top_node.texi',
+    'text' => 'must specify a title with a title command or @top',
+    'type' => 'warning'
+  }
+];
+
+
+1;
diff --git 
a/tp/t/results/html_tests/contents_with_only_top_node/res_html/index.html 
b/tp/t/results/html_tests/contents_with_only_top_node/res_html/index.html
new file mode 100644
index 0000000000..135d3f914a
--- /dev/null
+++ b/tp/t/results/html_tests/contents_with_only_top_node/res_html/index.html
@@ -0,0 +1,32 @@
+<!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 (Untitled Document)</title>
+
+<meta name="description" content="Top (Untitled Document)">
+<meta name="keywords" content="Top (Untitled Document)">
+<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">
+<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">
+<h1 class="node" id="Top"><span>Top<a class="copiable-link" href="#Top"> 
&para;</a></span></h1>
+
+
+
+
+</body>
+</html>
diff --git a/tp/t/results/html_tests/top_node_top_contents.pl 
b/tp/t/results/html_tests/top_node_top_contents.pl
new file mode 100644
index 0000000000..b3376b367e
--- /dev/null
+++ b/tp/t/results/html_tests/top_node_top_contents.pl
@@ -0,0 +1,170 @@
+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{'top_node_top_contents'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'text' => '
+',
+                  'type' => 'rawline_arg'
+                }
+              ],
+              'cmdname' => 'contents',
+              'extra' => {},
+              'source_info' => {
+                'line_nr' => 1
+              }
+            },
+            {
+              'text' => '
+',
+              'type' => 'empty_line'
+            }
+          ],
+          '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' => 3
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Texinfo modules documentation'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 4
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'top_node_top_contents'} = '@contents
+
+@node Top
+@top Texinfo modules documentation
+';
+
+
+$result_texts{'top_node_top_contents'} = '
+Texinfo modules documentation
+*****************************
+';
+
+$result_sectioning{'top_node_top_contents'} = {
+  'extra' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'Top'
+            }
+          },
+          'section_level' => 0,
+          'sectioning_root' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'top_node_top_contents'}{'extra'}{'section_childs'}[0]{'extra'}{'sectioning_root'}
 = $result_sectioning{'top_node_top_contents'};
+
+$result_nodes{'top_node_top_contents'} = [
+  {
+    'cmdname' => 'node',
+    'extra' => {
+      'associated_section' => {
+        'cmdname' => 'top',
+        'extra' => {}
+      },
+      'normalized' => 'Top'
+    }
+  }
+];
+
+$result_menus{'top_node_top_contents'} = [
+  {
+    'extra' => {
+      'normalized' => 'Top'
+    }
+  }
+];
+
+$result_errors{'top_node_top_contents'} = [];
+
+
+$result_floats{'top_node_top_contents'} = {};
+
+
+
+$result_converted{'html_text'}->{'top_node_top_contents'} = '
+<div class="top-level-extent" id="Top">
+<h1 class="top" id="Texinfo-modules-documentation"><span>Texinfo modules 
documentation<a class="copiable-link" href="#Texinfo-modules-documentation"> 
&para;</a></span></h1>
+</div>
+';
+
+1;
diff --git a/tp/t/results/html_tests/top_node_top_contents/res_html/index.html 
b/tp/t/results/html_tests/top_node_top_contents/res_html/index.html
new file mode 100644
index 0000000000..62101e3511
--- /dev/null
+++ b/tp/t/results/html_tests/top_node_top_contents/res_html/index.html
@@ -0,0 +1,34 @@
+<!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 (Texinfo modules documentation)</title>
+
+<meta name="description" content="Top (Texinfo modules documentation)">
+<meta name="keywords" content="Top (Texinfo modules documentation)">
+<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">
+<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">
+<h1 class="top" id="Texinfo-modules-documentation"><span>Texinfo modules 
documentation<a class="copiable-link" href="#Texinfo-modules-documentation"> 
&para;</a></span></h1>
+</div>
+
+
+
+</body>
+</html>



reply via email to

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