[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6871] indent and noindent start paragraphs
From: |
Gavin D. Smith |
Subject: |
[6871] indent and noindent start paragraphs |
Date: |
Sat, 19 Dec 2015 14:46:01 +0000 |
Revision: 6871
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6871
Author: gavin
Date: 2015-12-19 14:45:59 +0000 (Sat, 19 Dec 2015)
Log Message:
-----------
indent and noindent start paragraphs
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Parser.pm
trunk/tp/t/results/macro/unknown_macro_on_line_command.pl
trunk/tp/t/results/xml_tests/comments_on_misc_command_line.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-12-17 20:31:26 UTC (rev 6870)
+++ trunk/ChangeLog 2015-12-19 14:45:59 UTC (rev 6871)
@@ -1,3 +1,19 @@
+2015-12-19 Gavin Smith <address@hidden>
+
+ * tp/Texinfo/Parser.pm (_parse_texi) <misc commands>: If command
+ @indent or @noindent is seen, start a new paragraph after the
+ spaces following the command.
+ (_merge_text): Don't merge text into an
+ empty_spaces_after_command element.
+ (Problem with starting a paragraph with an @image reported by
+ Per Bothner.)
+
+ Changes to results of tests:
+ * tp/t/macro.t (unknown_macro_in_line_command): Non-whitespace
+ text is not adjoined to empty spaces element.
+ * tp/t/xml_tests.t (comments_on_misc_command_line): Comment
+ after @indent is inside a paragraph.
+
2015-12-17 Gavin Smith <address@hidden>
Suppress chapter titles for single-page indices.
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2015-12-17 20:31:26 UTC (rev 6870)
+++ trunk/tp/Texinfo/Parser.pm 2015-12-19 14:45:59 UTC (rev 6871)
@@ -1896,6 +1896,7 @@
if ($current->{'contents'} and @{$current->{'contents'}}
and $current->{'contents'}->[-1]->{'type'}
and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line_after_command'
+ or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_after_command'
or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_before_argument'
or $current->{'contents'}->[-1]->{'type'} eq
'empty_spaces_after_close_brace')) {
$no_merge_with_following_text = 1;
@@ -4796,6 +4797,29 @@
unless ($def_commands{$command});
}
$line = _start_empty_line_after_command($line, $current, $misc);
+ if ($command eq 'indent'
+ or $command eq 'noindent') {
+ if ($line !~ /\n/) {
+ my ($new_line, $new_line_nr) =
+ _new_line($self, $line_nr, undef);
+ $line .= $new_line if (defined($new_line));
+ }
+ $line =~ s/^(\s*)//;
+ if ($1) {
+ $current = _merge_text($self, $current, $1);
+ }
+ if ($line ne ''
+ and $current->{'contents'}->[-1]->{'type'} eq
+ 'empty_line_after_command') {
+ $current->{'contents'}->[-1]->{'type'}
+ = 'empty_spaces_after_command';
+ }
+ my $paragraph = _begin_paragraph($self, $current, $line_nr);
+ $current = $paragraph if $paragraph;
+ if ($line eq '') {
+ last;
+ }
+ }
}
_mark_and_warn_invalid($self, $command, $invalid_parent,
$line_nr, $misc);
Modified: trunk/tp/t/results/macro/unknown_macro_on_line_command.pl
===================================================================
--- trunk/tp/t/results/macro/unknown_macro_on_line_command.pl 2015-12-17
20:31:26 UTC (rev 6870)
+++ trunk/tp/t/results/macro/unknown_macro_on_line_command.pl 2015-12-19
14:45:59 UTC (rev 6871)
@@ -16,8 +16,12 @@
'command' => {}
},
'parent' => {},
- 'text' => ' file',
+ 'text' => ' ',
'type' => 'empty_spaces_after_command'
+ },
+ {
+ 'parent' => {},
+ 'text' => 'file'
}
],
'parent' => {},
@@ -26,8 +30,8 @@
],
'cmdname' => 'setfilename',
'extra' => {
- 'missing_argument' => 1,
- 'spaces_after_command' => {}
+ 'spaces_after_command' => {},
+ 'text_arg' => 'file'
},
'line_nr' => {
'file_name' => '',
@@ -41,6 +45,7 @@
};
$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'extra'}{'command'}
= $result_trees{'unknown_macro_on_line_command'}{'contents'}[0];
$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
= $result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0];
+$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'contents'}[1]{'parent'}
= $result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0];
$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'parent'}
= $result_trees{'unknown_macro_on_line_command'}{'contents'}[0];
$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'extra'}{'spaces_after_command'}
=
$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'args'}[0]{'contents'}[0];
$result_trees{'unknown_macro_on_line_command'}{'contents'}[0]{'parent'} =
$result_trees{'unknown_macro_on_line_command'};
@@ -77,15 +82,6 @@
'macro' => '',
'text' => 'misplaced }',
'type' => 'error'
- },
- {
- 'error_line' => ':1: warning: @setfilename missing argument
-',
- 'file_name' => '',
- 'line_nr' => 1,
- 'macro' => '',
- 'text' => '@setfilename missing argument',
- 'type' => 'warning'
}
];
Modified: trunk/tp/t/results/xml_tests/comments_on_misc_command_line.pl
===================================================================
--- trunk/tp/t/results/xml_tests/comments_on_misc_command_line.pl
2015-12-17 20:31:26 UTC (rev 6870)
+++ trunk/tp/t/results/xml_tests/comments_on_misc_command_line.pl
2015-12-19 14:45:59 UTC (rev 6871)
@@ -332,25 +332,25 @@
},
{},
{
- 'args' => [
+ 'contents' => [
{
- 'parent' => {},
- 'text' => ' indent (skipspace)
+ 'args' => [
+ {
+ 'parent' => {},
+ 'text' => ' indent (skipspace)
',
- 'type' => 'misc_arg'
- }
- ],
- 'cmdname' => 'c',
- 'extra' => {
- 'misc_args' => [
- ' indent (skipspace)
+ 'type' => 'misc_arg'
+ }
+ ],
+ 'cmdname' => 'c',
+ 'extra' => {
+ 'misc_args' => [
+ ' indent (skipspace)
'
- ]
- },
- 'parent' => {}
- },
- {
- 'contents' => [
+ ]
+ },
+ 'parent' => {}
+ },
{
'parent' => {},
'text' => 'Para.
@@ -416,10 +416,10 @@
$result_trees{'comments_on_misc_command_line'}{'contents'}[10]{'extra'}{'spaces_after_command'}{'parent'}
= $result_trees{'comments_on_misc_command_line'};
$result_trees{'comments_on_misc_command_line'}{'contents'}[10]{'parent'} =
$result_trees{'comments_on_misc_command_line'};
$result_trees{'comments_on_misc_command_line'}{'contents'}[11] =
$result_trees{'comments_on_misc_command_line'}{'contents'}[10]{'extra'}{'spaces_after_command'};
-$result_trees{'comments_on_misc_command_line'}{'contents'}[12]{'args'}[0]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[12];
+$result_trees{'comments_on_misc_command_line'}{'contents'}[12]{'contents'}[0]{'args'}[0]{'parent'}
=
$result_trees{'comments_on_misc_command_line'}{'contents'}[12]{'contents'}[0];
+$result_trees{'comments_on_misc_command_line'}{'contents'}[12]{'contents'}[0]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[12];
+$result_trees{'comments_on_misc_command_line'}{'contents'}[12]{'contents'}[1]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[12];
$result_trees{'comments_on_misc_command_line'}{'contents'}[12]{'parent'} =
$result_trees{'comments_on_misc_command_line'};
-$result_trees{'comments_on_misc_command_line'}{'contents'}[13]{'contents'}[0]{'parent'}
= $result_trees{'comments_on_misc_command_line'}{'contents'}[13];
-$result_trees{'comments_on_misc_command_line'}{'contents'}[13]{'parent'} =
$result_trees{'comments_on_misc_command_line'};
$result_texis{'comments_on_misc_command_line'} = '@setfilename
comments_on_misc_command_line.info @c setfilename (text)
@definfoenclose phoo,;,: @c definfoenclose (number)
@@ -450,8 +450,8 @@
<pagesizes spaces=" ">200mm </pagesizes><!-- c pagesizes (line) -->
<everyheading> @thispage @| aaa @c everyheading (lineraw)</everyheading>
-<indent></indent> <!-- c indent (skipspace) -->
-<para>Para.
+<indent></indent> <para><!-- c indent (skipspace) -->
+Para.
</para>';
1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6871] indent and noindent start paragraphs,
Gavin D. Smith <=