[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_in_paragraph), tp/T
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_in_paragraph), tp/Texinfo/XS/parsetexi/handle_commands.c (in_paragraph): go to the container of the parent command when going through parent brace commands. |
Date: |
Sat, 24 Dec 2022 18:20:10 -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 8a47a9cd68 * tp/Texinfo/ParserNonXS.pm (_in_paragraph),
tp/Texinfo/XS/parsetexi/handle_commands.c (in_paragraph): go to the container
of the parent command when going through parent brace commands.
8a47a9cd68 is described below
commit 8a47a9cd68d5f2e9e963f42d805be4dc01b2047e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 25 00:19:59 2022 +0100
* tp/Texinfo/ParserNonXS.pm (_in_paragraph),
tp/Texinfo/XS/parsetexi/handle_commands.c (in_paragraph):
go to the container of the parent command when going through
parent brace commands.
* tp/t/08misc_commands.t: add indent_in_command_in_paragraph
test with @indent and @noindent in an @-command in a paragraph.
---
ChangeLog | 10 +
tp/Texinfo/ParserNonXS.pm | 2 +-
tp/Texinfo/XS/parsetexi/handle_commands.c | 2 +-
tp/t/08misc_commands.t | 3 +
.../indent_in_command_in_paragraph.pl | 204 +++++++++++++++++++++
5 files changed, 219 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 895f76eb89..8374ce2255 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-12-24 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_in_paragraph),
+ tp/Texinfo/XS/parsetexi/handle_commands.c (in_paragraph):
+ go to the container of the parent command when going through
+ parent brace commands.
+
+ * tp/t/08misc_commands.t: add indent_in_command_in_paragraph
+ test with @indent and @noindent in an @-command in a paragraph.
+
2022-12-24 Patrice Dumas <pertusus@free.fr>
Warn that @indent and @noindent are useless inside paragraphs
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 731b319ca6..b6f3339077 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1478,7 +1478,7 @@ sub _in_paragraph($$)
->{$current->{'parent'}->{'cmdname'}})
and $self->{'brace_commands'}
->{$current->{'parent'}->{'cmdname'}} ne 'context')
{
- $current = $current->{'parent'};
+ $current = $current->{'parent'}->{'parent'};
}
if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
return 1;
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index dd3130c4a4..bae1a83f5a 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -84,7 +84,7 @@ in_paragraph (ELEMENT *current)
&& (command_flags(current->parent) & CF_brace)
&& !(command_data(current->parent->cmd).data == BRACE_context))
{
- current = current->parent;
+ current = current->parent->parent;
}
if (current->type == ET_paragraph)
return 1;
diff --git a/tp/t/08misc_commands.t b/tp/t/08misc_commands.t
index bc869a3e9e..a3eb1e5443 100644
--- a/tp/t/08misc_commands.t
+++ b/tp/t/08misc_commands.t
@@ -300,6 +300,9 @@ after noindent2.
aaa
'],
+['indent_in_command_in_paragraph',
+'In para @code{@indent}. @asis{@b{in double command@noindent}}.
+'],
['empty_center',
'@center
'],
diff --git a/tp/t/results/misc_commands/indent_in_command_in_paragraph.pl
b/tp/t/results/misc_commands/indent_in_command_in_paragraph.pl
new file mode 100644
index 0000000000..128d37c954
--- /dev/null
+++ b/tp/t/results/misc_commands/indent_in_command_in_paragraph.pl
@@ -0,0 +1,204 @@
+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{'indent_in_command_in_paragraph'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'In para '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => 'indent',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => '. '
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'in double command'
+ },
+ {
+ 'cmdname' => 'noindent',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'b',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ }
+ ],
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'cmdname' => 'asis',
+ 'source_info' => {
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => ''
+ }
+ },
+ {
+ 'text' => '.
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'indent_in_command_in_paragraph'} = 'In para @code{@indent}.
@asis{@b{in double command@noindent}}.
+';
+
+
+$result_texts{'indent_in_command_in_paragraph'} = 'In para . in double
command.
+';
+
+$result_errors{'indent_in_command_in_paragraph'} = [
+ {
+ 'error_line' => 'warning: @indent should not appear in @code
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@indent should not appear in @code',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @indent is useless inside of a paragraph
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@indent is useless inside of a paragraph',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @noindent should not appear in @b
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@noindent should not appear in @b',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @noindent is useless inside of a paragraph
+',
+ 'file_name' => '',
+ 'line_nr' => 1,
+ 'macro' => '',
+ 'text' => '@noindent is useless inside of a paragraph',
+ 'type' => 'warning'
+ }
+];
+
+
+$result_floats{'indent_in_command_in_paragraph'} = {};
+
+
+
+$result_converted{'plaintext'}->{'indent_in_command_in_paragraph'} = 'In para
‘’. in double command.
+';
+
+
+$result_converted{'html_text'}->{'indent_in_command_in_paragraph'} = '<p>In
para <code class="code"></code>. <b class="b">in double command</b>.
+</p>';
+
+
+$result_converted{'latex'}->{'indent_in_command_in_paragraph'} =
'\\documentclass{book}
+\\usepackage{amsfonts}
+\\usepackage{amsmath}
+\\usepackage[gen]{eurosym}
+\\usepackage{textcomp}
+\\usepackage{graphicx}
+\\usepackage{etoolbox}
+\\usepackage{titleps}
+\\usepackage[utf8]{inputenc}
+\\usepackage[T1]{fontenc}
+\\usepackage{float}
+% use hidelinks to remove boxes around links to be similar to Texinfo TeX
+\\usepackage[hidelinks]{hyperref}
+
+\\makeatletter
+\\newcommand{\\Texinfosettitle}{No Title}%
+
+% redefine the \\mainmatter command such that it does not clear page
+% as if in double page
+\\renewcommand\\mainmatter{\\clearpage\\@mainmattertrue\\pagenumbering{arabic}}
+\\newenvironment{Texinfopreformatted}{%
+
\\par\\GNUTobeylines\\obeyspaces\\frenchspacing\\parskip=\\z@\\parindent=\\z@}{}
+{\\catcode`\\^^M=13 \\gdef\\GNUTobeylines{\\catcode`\\^^M=13
\\def^^M{\\null\\par}}}
+\\newenvironment{Texinfoindented}{\\begin{list}{}{}\\item\\relax}{\\end{list}}
+
+% used for substitutions in commands
+\\newcommand{\\Texinfoplaceholder}[1]{}
+
+\\newpagestyle{single}{\\sethead[\\chaptername{} \\thechapter{}
\\chaptertitle{}][][\\thepage]
+ {\\chaptername{} \\thechapter{}
\\chaptertitle{}}{}{\\thepage}}
+
+% allow line breaking at underscore
+\\let\\Texinfounderscore\\_
+\\renewcommand{\\_}{\\Texinfounderscore\\discretionary{}{}{}}
+\\renewcommand{\\includegraphics}[1]{\\fbox{FIG \\detokenize{#1}}}
+
+\\makeatother
+% set default for @setchapternewpage
+\\makeatletter
+\\patchcmd{\\chapter}{\\if@openright\\cleardoublepage\\else\\clearpage\\fi}{\\Texinfoplaceholder{setchapternewpage
placeholder}\\clearpage}{}{}
+\\makeatother
+\\pagestyle{single}%
+
+In para \\texttt{}. \\textbf{in double command\\noindent{}}.
+\\end{document}
+';
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_in_paragraph), tp/Texinfo/XS/parsetexi/handle_commands.c (in_paragraph): go to the container of the parent command when going through parent brace commands.,
Patrice Dumas <=