[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5351] * tp/Texinfo/Convert/Plaintext.pm: warn when cross-reference
From: |
Patrice Dumas |
Subject: |
[5351] * tp/Texinfo/Convert/Plaintext.pm: warn when cross-reference |
Date: |
Sat, 31 Aug 2013 13:05:57 +0000 |
Revision: 5351
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5351
Author: pertusus
Date: 2013-08-31 13:05:53 +0000 (Sat, 31 Aug 2013)
Log Message:
-----------
* tp/Texinfo/Convert/Plaintext.pm: warn when cross-reference
name contains a :, or node name contains a problematic character.
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Convert/Plaintext.pm
trunk/tp/t/results/converters_tests/at_commands_in_refs.pl
trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-08-27 21:45:56 UTC (rev 5350)
+++ trunk/ChangeLog 2013-08-31 13:05:53 UTC (rev 5351)
@@ -1,3 +1,8 @@
+2013-08-31 Patrice Dumas <address@hidden>
+
+ * tp/Texinfo/Convert/Plaintext.pm: warn when cross-reference
+ name contains a :, or node name contains a problematic character.
+
2013-08-27 Patrice Dumas <address@hidden>
* tp/Texinfo/Parser.pm: add \r to regexps to exclude it when
Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm 2013-08-27 21:45:56 UTC (rev
5350)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm 2013-08-31 13:05:53 UTC (rev
5351)
@@ -1982,11 +1982,10 @@
$args[3] = $args[2];
$args[2] = undef;
}
- my @contents;
if ($command eq 'xref') {
- $contents[0] = {'text' => '*Note '};
+ $result = $self->_convert({'contents' => [{'text' => '*Note '}]});
} else {
- $contents[0] = {'text' => '*note '};
+ $result = $self->_convert({'contents' => [{'text' => '*note '}]});
}
my $name;
if (defined($args[1])) {
@@ -2007,21 +2006,41 @@
}
if ($name) {
- push @contents, (@$name, {'text' => ': '});
+ my $name_text = $self->_convert({'contents' => $name});
+ if ($name_text =~ /:/) {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden cross-reference name should not contain `:'"),
$command),
+ $root->{'line_nr'});
+ }
+ $result .= $name_text;
+ $result .= $self->_convert({'contents' => [{'text' => ': '}]});
+
if ($file) {
- push @contents, @$file;
+ $result .= $self->_convert({'contents' => $file});
}
# node name
- push @contents, ({'type' => '_code',
- 'contents' => $node_content});
+ my $node_text = $self->_convert({'type' => '_code',
+ 'contents' => $node_content});
+ if ($node_text =~ /([,\t.])/) {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden node name should not contain `%s'"), $command,
$1),
+ $root->{'line_nr'});
+ }
+ $result .= $node_text;
} else {
if ($file) {
- push @contents, @$file;
+ $result .= $self->_convert({'contents' => $file});
}
- push @contents, ({'type' => '_code',
- 'contents' => address@hidden, {'text' => '::'}]});
+ my $node_text = $self->_convert({'type' => '_code',
+ 'contents' => $node_content});
+ if ($node_text =~ /:/) {
+ $self->line_warn(sprintf($self->__(
+ "address@hidden node name should not contain `:'"), $command),
+ $root->{'line_nr'});
+ }
+ $result .= $node_text;
+ $result .= $self->_convert({'contents' => [{'text' => '::'}]});
}
- $result = $self->_convert({'contents' => address@hidden);
# we could use $formatter, but in case it was changed in _convert
# we play it safe.
my $pending = $result
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs.pl 2013-08-27
21:45:56 UTC (rev 5350)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs.pl 2013-08-31
13:05:53 UTC (rev 5351)
@@ -22241,6 +22241,15 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 89
+ },
+ {
+ 'file_name' => '',
+ 'error_line' => ':149: warning: @ref node name should not contain `:\'
+',
+ 'text' => '@ref node name should not contain `:\'',
+ 'type' => 'warning',
+ 'macro' => '',
+ 'line_nr' => 149
}
];
@@ -23292,6 +23301,15 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 89
+ },
+ {
+ 'file_name' => '',
+ 'error_line' => ':149: warning: @ref node name should not contain `:\'
+',
+ 'text' => '@ref node name should not contain `:\'',
+ 'type' => 'warning',
+ 'macro' => '',
+ 'line_nr' => 149
}
];
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
2013-08-27 21:45:56 UTC (rev 5350)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs_latin1.pl
2013-08-31 13:05:53 UTC (rev 5351)
@@ -22301,6 +22301,15 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 92
+ },
+ {
+ 'file_name' => '',
+ 'error_line' => ':152: warning: @ref node name should not contain `:\'
+',
+ 'text' => '@ref node name should not contain `:\'',
+ 'type' => 'warning',
+ 'macro' => '',
+ 'line_nr' => 152
}
];
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
2013-08-27 21:45:56 UTC (rev 5350)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8.pl
2013-08-31 13:05:53 UTC (rev 5351)
@@ -22301,6 +22301,15 @@
'type' => 'warning',
'macro' => '',
'line_nr' => 92
+ },
+ {
+ 'file_name' => '',
+ 'error_line' => ':152: warning: @ref node name should not contain `:\'
+',
+ 'text' => '@ref node name should not contain `:\'',
+ 'type' => 'warning',
+ 'macro' => '',
+ 'line_nr' => 152
}
];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5351] * tp/Texinfo/Convert/Plaintext.pm: warn when cross-reference,
Patrice Dumas <=