texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: More converters_tests.t tests for LaTeX


From: Patrice Dumas
Subject: branch master updated: More converters_tests.t tests for LaTeX
Date: Thu, 28 Jul 2022 03:57:22 -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 a3e7f5035b More converters_tests.t tests for LaTeX
a3e7f5035b is described below

commit a3e7f5035be223d1ad89803a5111bc3813de8026
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Jul 28 09:56:50 2022 +0200

    More converters_tests.t tests for LaTeX
---
 tp/Texinfo/Convert/LaTeX.pm                        |  2 +
 tp/t/converters_tests.t                            | 23 ++++++
 .../results/converters_tests/at_commands_in_raw.pl | 38 ++++++++++
 .../email_table_command_as_argument.pl             |  8 +++
 .../converters_tests/enumerate_above_ten.pl        |  6 ++
 .../results/converters_tests/footnote_no_number.pl | 10 +++
 .../footnote_no_number_separate.pl                 | 10 +++
 .../printindex_merged_indices_code_style.pl        |  9 ++-
 .../printindex_merged_indices_code_style.tex       | 83 ++++++++++++++++++++++
 .../converters_tests/spaces_in_empty_node_names.pl | 15 ++++
 .../converters_tests/spaces_in_node_names.pl       | 15 ++++
 .../converters_tests/things_before_setfilename.pl  | 16 +++++
 .../things_before_setfilename_no_element.pl        | 11 +++
 13 files changed, 245 insertions(+), 1 deletion(-)

diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index f6d902cee0..b099ff5a96 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3016,6 +3016,8 @@ sub _convert($$)
         push @{$self->{'formatting_context'}->[-1]->{'text_context'}}, 'raw';
       }
       if ($item_line_commands{$cmdname}) {
+        # may be undef, in particular if the command is not a style command,
+        # for example @email
         my $description_command_format
           = _xtable_description_command_format($self, $element);
         push @{$self->{'formatting_context'}->[-1]->{'table_command_format'}},
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index 58d09bd085..edfc955666 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -598,6 +598,8 @@ undef, {'test_file' => 'things_before_setfilename.texi'}
 ['things_before_setfilename_no_element',
 undef, {'test_file' => 'things_before_setfilename_no_element.texi'}
 ],
+# the result cannot be processed by LaTeX, because \verb cannot be in other
+# commands (here, \hyperref).
 ['spaces_in_node_names',
 '@node Top
 
@@ -866,10 +868,25 @@ my %latex_tests = (
   'image_with_spaces' => 1,
   'image_extension' => 1,
   'image_formatting' => 1,
+  'enumerate_above_ten' => 1,
+  'footnote_no_number' => 1,
+  'footnote_no_number_separate' => 1,
+  'things_before_setfilename' => 1,
+  'things_before_setfilename_no_element' => 1,
+  'spaces_in_node_names' => 1,
+  'spaces_in_empty_node_names' => 1,
+# need final implementation of @example
+#  'normal_font_in_monospace' => 1,
+  'email_table_command_as_argument' => 1,
+  'at_commands_in_raw' => 1,
   'test_sp' => 1,
   'non_empty_part' => 1,
 );
 
+my %file_latex_tests = (
+  'printindex_merged_indices_code_style' => 1,
+);
+
 foreach my $test (@test_cases) {
   push @{$test->[2]->{'test_formats'}}, 'plaintext';
   if ($html_tests{$test->[0]}) {
@@ -885,6 +902,12 @@ foreach my $test (@test_cases) {
   }
   push @{$test->[2]->{'test_formats'}}, 'latex'
     if ($latex_tests{$test->[0]});
+  if ($file_latex_tests{$test->[0]}) {
+    $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'}}, 'file_latex';
+  }
   push @{$test->[2]->{'test_formats'}}, 'info'
     if ($info_tests{$test->[0]});
 }
diff --git a/tp/t/results/converters_tests/at_commands_in_raw.pl 
b/tp/t/results/converters_tests/at_commands_in_raw.pl
index 57eab3c7e1..0478a3b25f 100644
--- a/tp/t/results/converters_tests/at_commands_in_raw.pl
+++ b/tp/t/results/converters_tests/at_commands_in_raw.pl
@@ -1574,4 +1574,42 @@ $result_converted{'docbook'}->{'at_commands_in_raw'} = 
'<chapter label="1" id="c
 </chapter>
 ';
 
+
+$result_converted{'latex'}->{'at_commands_in_raw'} = '\\label{anchor:Top}%
+\\chapter{Chapter}
+\\label{anchor:chap}%
+
+<b>in b\\footnote{in footnote}.</b>
+\\label{anchor:anchor-in-html}%
+{\\ttfamily\\textsl{in kbd before tex}}\\footnote{second footnote}.
+
+
+
+
+\\{No value for `flag\'\\}.
+
+{\\ttfamily\\textsl{in kbd after tex}}.
+
+See \\hyperref[anchor:anchor-in-html]{[anchor in html], 
page~\\pageref*{anchor:anchor-in-html}}.
+
+anchor in tex.
+\\index[fn]{fentry2@\\texttt{fentry2}}%
+
+ newidx entry
+
+\\printindex[fn]
+
+
+FF.
+
+tt.
+
+movie name
+
+Macro not unmacroed Other macro.
+
+Macros that should not be defined: . with arg.
+
+';
+
 1;
diff --git a/tp/t/results/converters_tests/email_table_command_as_argument.pl 
b/tp/t/results/converters_tests/email_table_command_as_argument.pl
index 2cae514977..77a9e6e4a7 100644
--- a/tp/t/results/converters_tests/email_table_command_as_argument.pl
+++ b/tp/t/results/converters_tests/email_table_command_as_argument.pl
@@ -212,4 +212,12 @@ 
$result_converted{'docbook'}->{'email_table_command_as_argument'} = '<variableli
 </term><listitem><para>discussion
 </para></listitem></varlistentry></variablelist>';
 
+
+$result_converted{'latex'}->{'email_table_command_as_argument'} = 
'\\begin{description}
+\\item[{\\parbox[b]{\\linewidth}{%
+www-discuss@gnu.org}}]
+discussion
+\\end{description}
+';
+
 1;
diff --git a/tp/t/results/converters_tests/enumerate_above_ten.pl 
b/tp/t/results/converters_tests/enumerate_above_ten.pl
index d48c2d42b0..26784d2b5b 100644
--- a/tp/t/results/converters_tests/enumerate_above_ten.pl
+++ b/tp/t/results/converters_tests/enumerate_above_ten.pl
@@ -151,4 +151,10 @@ $result_converted{'xml'}->{'enumerate_above_ten'} = 
'<enumerate first="14" space
 $result_converted{'docbook'}->{'enumerate_above_ten'} = '<orderedlist 
numeration="arabic"><listitem><para>a
 </para></listitem></orderedlist>';
 
+
+$result_converted{'latex'}->{'enumerate_above_ten'} = 
'\\begin{enumerate}[start=14]
+\\item a
+\\end{enumerate}
+';
+
 1;
diff --git a/tp/t/results/converters_tests/footnote_no_number.pl 
b/tp/t/results/converters_tests/footnote_no_number.pl
index c4e8b407a9..c7caee8833 100644
--- a/tp/t/results/converters_tests/footnote_no_number.pl
+++ b/tp/t/results/converters_tests/footnote_no_number.pl
@@ -494,6 +494,16 @@ $result_converted{'docbook'}->{'footnote_no_number'} = 
'<chapter label="1" id="c
 ';
 
 
+$result_converted{'latex'}->{'footnote_no_number'} = '\\label{anchor:Top}%
+\\chapter{Chapter}
+\\label{anchor:chap}%
+
+Para\\footnote{Footnote 1.}.
+
+Para2\\footnote{Footnote 2.}.
+';
+
+
 $result_converted{'info'}->{'footnote_no_number'} = 'This is , produced from .
 
 
diff --git a/tp/t/results/converters_tests/footnote_no_number_separate.pl 
b/tp/t/results/converters_tests/footnote_no_number_separate.pl
index 1c1f644df5..6a5e266122 100644
--- a/tp/t/results/converters_tests/footnote_no_number_separate.pl
+++ b/tp/t/results/converters_tests/footnote_no_number_separate.pl
@@ -494,6 +494,16 @@ 
$result_converted{'docbook'}->{'footnote_no_number_separate'} = '<chapter label=
 ';
 
 
+$result_converted{'latex'}->{'footnote_no_number_separate'} = 
'\\label{anchor:Top}%
+\\chapter{Chapter}
+\\label{anchor:chap}%
+
+Para\\footnote{Footnote 1.}.
+
+Para2\\footnote{Footnote 2.}.
+';
+
+
 $result_converted{'info'}->{'footnote_no_number_separate'} = 'This is , 
produced from .
 
 
diff --git 
a/tp/t/results/converters_tests/printindex_merged_indices_code_style.pl 
b/tp/t/results/converters_tests/printindex_merged_indices_code_style.pl
index db1383ffbc..f0d5945805 100644
--- a/tp/t/results/converters_tests/printindex_merged_indices_code_style.pl
+++ b/tp/t/results/converters_tests/printindex_merged_indices_code_style.pl
@@ -8,7 +8,13 @@ use utf8;
 $result_trees{'printindex_merged_indices_code_style'} = {
   'contents' => [
     {
-      'contents' => [],
+      'contents' => [
+        {
+          'contents' => [],
+          'parent' => {},
+          'type' => 'preamble_before_content'
+        }
+      ],
       'parent' => {},
       'type' => 'before_node_section'
     },
@@ -662,6 +668,7 @@ $result_trees{'printindex_merged_indices_code_style'} = {
   ],
   'type' => 'document_root'
 };
+$result_trees{'printindex_merged_indices_code_style'}{'contents'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'printindex_merged_indices_code_style'}{'contents'}[0];
 $result_trees{'printindex_merged_indices_code_style'}{'contents'}[0]{'parent'} 
= $result_trees{'printindex_merged_indices_code_style'};
 
$result_trees{'printindex_merged_indices_code_style'}{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'printindex_merged_indices_code_style'}{'contents'}[1]{'args'}[0];
 
$result_trees{'printindex_merged_indices_code_style'}{'contents'}[1]{'args'}[0]{'parent'}
 = $result_trees{'printindex_merged_indices_code_style'}{'contents'}[1];
diff --git 
a/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
 
b/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
new file mode 100644
index 0000000000..8d2eb7d751
--- /dev/null
+++ 
b/tp/t/results/converters_tests/printindex_merged_indices_code_style/res_latex/printindex_merged_indices_code_style.tex
@@ -0,0 +1,83 @@
+\documentclass{book}
+\usepackage{imakeidx}
+\usepackage{amsfonts}
+\usepackage{amsmath}
+\usepackage[gen]{eurosym}
+\usepackage[T1]{fontenc}
+\usepackage{textcomp}
+\usepackage{graphicx}
+\usepackage{etoolbox}
+\usepackage{titleps}
+\usepackage{float}
+% use hidelinks to remove boxes around links to be similar with Texinfo TeX
+\usepackage[hidelinks]{hyperref}
+\usepackage[utf8]{inputenc}
+
+\newcommand{\GNUTexinfosettitle}{No Title}%
+
+\makeindex[name=fn]%
+
+% redefine the \mainmatter command such that it does not clear page
+% as if in double page
+\makeatletter
+\renewcommand\mainmatter{\clearpage\@mainmattertrue\pagenumbering{arabic}}
+\makeatother
+% add command aliases to use the same command in book and report
+\newcommand\GNUTexinfomainmatter{\mainmatter}
+\newcommand\GNUTexinfofrontmatter{\frontmatter}
+% command that does nothing used to help with substitutions in commands
+\newcommand{\GNUTexinfoplaceholder}[1]{}
+
+% plain page style, for part and chapter, which call \thispagestyle{plain}
+\renewpagestyle{plain}{\sethead[\thepage{}][][]
+                             {}{}{\thepage{}}}
+
+% single header
+\newpagestyle{single}{\sethead[\chaptername{} \thechapter{} 
\chaptertitle{}][][\thepage]
+                              {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
+
+% called when setting single headers
+\newcommand{\GNUTexinfosetsingleheader}{\pagestyle{single}}
+
+% double header
+\newpagestyle{double}{\sethead[\thepage{}][][\GNUTexinfosettitle]
+                              {\chaptername{} \thechapter{} 
\chaptertitle{}}{}{\thepage}}
+
+% called when setting double headers
+\newcommand{\GNUTexinfosetdoubleheader}{\pagestyle{double}}
+
+
+% avoid pagebreak and headings setting for a sectionning command
+\newcommand{\GNUTexinfonopagebreakheading}[2]{\let\clearpage\relax 
\let\cleardoublepage\relax \let\thispagestyle\GNUTexinfoplaceholder #1{#2}}
+
+\renewcommand{\includegraphics}[1]{\fbox{FIG \detokenize{#1}}}
+
+% set default for @setchapternewpage
+\makeatletter
+\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{\GNUTexinfoplaceholder{setchapternewpage
 placeholder}\clearpage}{}{}
+\makeatother
+\GNUTexinfosetsingleheader{}%
+
+\begin{document}
+\label{anchor:Top}%
+\chapter{Chapter}
+\label{anchor:chap}%
+
+
+
+\index[fn]{c``b}%
+
+\index[fn]{v``j}%
+
+\index[fn]{f``g@\texttt{f``g}}%
+
+
+
+\index[fn]{cdi``h}%
+
+
+
+\index[fn]{ddi``g@\texttt{ddi``g}}%
+
+\printindex[fn]
+\end{document}
diff --git a/tp/t/results/converters_tests/spaces_in_empty_node_names.pl 
b/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
index e188378127..92187d4576 100644
--- a/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
+++ b/tp/t/results/converters_tests/spaces_in_empty_node_names.pl
@@ -1012,6 +1012,21 @@ 
$result_converted{'docbook'}->{'spaces_in_empty_node_names'} = '
 </para>';
 
 
+$result_converted{'latex'}->{'spaces_in_empty_node_names'} = 
'\\label{anchor:Top}%
+\\label{anchor:}%
+
+\\label{anchor:}%
+
+\\label{anchor:}%
+
+\\ {}\\ {}
+
+\\verb:  :
+
+\\hbox{  }
+';
+
+
 $result_converted{'info'}->{'spaces_in_empty_node_names'} = 'This is , 
produced from .
 
 
diff --git a/tp/t/results/converters_tests/spaces_in_node_names.pl 
b/tp/t/results/converters_tests/spaces_in_node_names.pl
index f9edc908ac..ab4049b4f4 100644
--- a/tp/t/results/converters_tests/spaces_in_node_names.pl
+++ b/tp/t/results/converters_tests/spaces_in_node_names.pl
@@ -1123,6 +1123,21 @@ $result_converted{'docbook'}->{'spaces_in_node_names'} = 
'<anchor id="a--"/>
 </para>';
 
 
+$result_converted{'latex'}->{'spaces_in_node_names'} = '\\label{anchor:Top}%
+\\label{anchor:a--}%
+
+\\label{anchor:b-}%
+
+\\label{anchor:c-}%
+
+\\hyperref[anchor:a--]{[a\\ {}\\ {}], page~\\pageref*{anchor:a--}}
+
+\\hyperref[anchor:b-]{[b\\verb:  :], page~\\pageref*{anchor:b-}}
+
+\\hyperref[anchor:c-]{[c\\hbox{  }], page~\\pageref*{anchor:c-}}
+';
+
+
 $result_converted{'info'}->{'spaces_in_node_names'} = 'This is , produced from 
.
 
 
diff --git a/tp/t/results/converters_tests/things_before_setfilename.pl 
b/tp/t/results/converters_tests/things_before_setfilename.pl
index 99088f16f1..2a49694dcd 100644
--- a/tp/t/results/converters_tests/things_before_setfilename.pl
+++ b/tp/t/results/converters_tests/things_before_setfilename.pl
@@ -1768,6 +1768,22 @@ 
$result_converted{'docbook'}->{'things_before_setfilename'} = '<chapter label="1
 ';
 
 
+$result_converted{'latex'}->{'things_before_setfilename'} = '
+\\begin{document}
+\\tableofcontents\\newpage
+\\label{anchor:Top}%
+\\chapter{Chapter}
+\\label{anchor:chap}%
+
+Ref to anchor
+\\hyperref[anchor:An-anchor]{[An anchor], page~\\pageref*{anchor:An-anchor}}
+
+Ref to footnote anchor
+\\hyperref[anchor:Anchor-in-footnote]{[Anchor in footnote], 
page~\\pageref*{anchor:Anchor-in-footnote}}
+
+';
+
+
 $result_converted{'info'}->{'things_before_setfilename'} = 'This is 
things_before_setfilename.info, produced from
 things_before_setfilename.texi.
 
diff --git 
a/tp/t/results/converters_tests/things_before_setfilename_no_element.pl 
b/tp/t/results/converters_tests/things_before_setfilename_no_element.pl
index 2035415dbc..b875cb4e56 100644
--- a/tp/t/results/converters_tests/things_before_setfilename_no_element.pl
+++ b/tp/t/results/converters_tests/things_before_setfilename_no_element.pl
@@ -1453,6 +1453,17 @@ 
$result_converted{'docbook'}->{'things_before_setfilename_no_element'} = '
 ';
 
 
+$result_converted{'latex'}->{'things_before_setfilename_no_element'} = '
+\\begin{document}
+Ref to anchor
+\\hyperref[anchor:An-anchor]{[An anchor], page~\\pageref*{anchor:An-anchor}}
+
+Ref to footnote anchor
+\\hyperref[anchor:Anchor-in-footnote]{[Anchor in footnote], 
page~\\pageref*{anchor:Anchor-in-footnote}}
+
+';
+
+
 $result_converted{'info'}->{'things_before_setfilename_no_element'} = 'This is 
things_before_setfilename_no_element.info, produced from
 things_before_setfilename_no_element.texi.
 



reply via email to

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