[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6389] suppress most styles in indices and nodenames
From: |
Gavin D. Smith |
Subject: |
[6389] suppress most styles in indices and nodenames |
Date: |
Sun, 05 Jul 2015 19:37:54 +0000 |
Revision: 6389
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6389
Author: gavin
Date: 2015-07-05 19:37:52 +0000 (Sun, 05 Jul 2015)
Log Message:
-----------
suppress most styles in indices and nodenames
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/res_info/at_commands_in_refs_latin1.info
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
trunk/tp/t/results/converters_tests/ref_in_sectioning.pl
trunk/tp/t/results/coverage_braces/nested_args.pl
trunk/tp/t/results/def/all_commands_delimiters_printindex.pl
trunk/tp/t/results/sectioning/equivalent_labels.pl
trunk/tp/t/results/sectioning/equivalent_nodes.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-07-04 15:52:50 UTC (rev 6388)
+++ trunk/ChangeLog 2015-07-05 19:37:52 UTC (rev 6389)
@@ -1,3 +1,16 @@
+2015-07-05 Gavin Smith <address@hidden>
+
+ * tp/Texinfo/Convert/Plaintext.pm
+ (new_formatter): Set 'suppress_styles' on formatter object.
+ (_node_line, _printindex_formatted): Pass 'suppress_styles'
+ option to line formatter.
+ (%index_style_commands): New hash.
+ (_convert) <command has styles>: If styles are suppressed,
+ suppress styles unless the command is in %index_style_commands,
+ or it was defined with @definfoenclose.
+ <cross-reference command>: Suppress styles for converting node
+ name.
+
2015-07-04 Gavin Smith <address@hidden>
* tp/Texinfo/Convert/Plaintext.pm (_convert) <brace commands
Modified: trunk/tp/Texinfo/Convert/Plaintext.pm
===================================================================
--- trunk/tp/Texinfo/Convert/Plaintext.pm 2015-07-04 15:52:50 UTC (rev
6388)
+++ trunk/tp/Texinfo/Convert/Plaintext.pm 2015-07-05 19:37:52 UTC (rev
6389)
@@ -298,6 +298,13 @@
$style_map{'sub'} = ['_{', '}'];
$style_map{'sup'} = ['^{', '}'];
+# Commands producing styles that are output in node names and index entries.
+my %index_style_commands;
+for my $index_style_command ('strong', 'emph', 'sub', 'sup') {
+ $index_style_commands{$index_style_command} = 1;
+}
+
+
# in those commands, there is no addition of double space after a dot.
# math is special
my %no_punctation_munging_commands;
@@ -672,7 +679,8 @@
#'code' => 0, 'code_command'=> 0,
'font_type_stack' => [{}],
'w' => 0, 'type' => $type,
- 'frenchspacing_stack' => [$self->{'conf'}->{'frenchspacing'}]};
+ 'frenchspacing_stack' => [$self->{'conf'}->{'frenchspacing'}],
+ 'suppress_styles' => $conf->{'suppress_styles'}};
if ($type eq 'unfilled') {
foreach my $context (reverse(@{$self->{'context'}})) {
@@ -1199,7 +1207,7 @@
return Texinfo::Common::normalize_top_node_name($node);
}
-# cache formatted node line and returns it
+# convert and cache a node name. $NODE is a node element.
sub _node_line($$)
{
my $self = shift;
@@ -1209,7 +1217,8 @@
'contents' => $node->{'extra'}->{'node_content'}};
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
$self->{'node_lines_text'}->{$node}->{'text'}
- = _normalize_top_node($self->convert_line($node_text));
+ = _normalize_top_node($self->convert_line($node_text,
+ {'suppress_styles' => 1}));
_update_count_context($self);
my $end_context = pop @{$self->{'count_context'}};
$self->{'node_lines_text'}->{$node}->{'count'}
@@ -1321,7 +1330,8 @@
$entry_tree->{'type'} = 'frenchspacing';
}
my $entry_text = '';
- $entry_text .= $self->convert_line($entry_tree, {'indent' => 0});
+ $entry_text .= $self->convert_line($entry_tree, {'indent' => 0,
+ 'suppress_styles' => 1});
next if ($entry_text !~ /\S/);
# FIXME protect instead
if ($entry_text =~ /:/ and $self->get_conf('INDEX_SPECIAL_CHARS_WARNING'))
{
@@ -1891,15 +1901,17 @@
if ($root->{'type'} and $root->{'type'} eq 'definfoenclose_command') {
$text_before = $root->{'extra'}->{'begin'};
$text_after = $root->{'extra'}->{'end'};
+ } elsif ($non_quoted_commands_when_nested{$command}
+ and $formatter->{'font_type_stack'}->[-1]->{'code_command'}) {
+ $text_before = '';
+ $text_after = '';
+ } elsif ($formatter->{'suppress_styles'}
+ and !$index_style_commands{$command}) {
+ $text_before = '';
+ $text_after = '';
} else {
- if ($non_quoted_commands_when_nested{$command}
- and $formatter->{'font_type_stack'}->[-1]->{'code_command'}) {
- $text_before = '';
- $text_after = '';
- } else {
- $text_before = $self->{'style_map'}->{$command}->[0];
- $text_after = $self->{'style_map'}->{$command}->[1];
- }
+ $text_before = $self->{'style_map'}->{$command}->[0];
+ $text_after = $self->{'style_map'}->{$command}->[1];
}
# do this after determining $text_before/$text_after such that it
# doesn't impact the current command, but only commands nested within
@@ -2154,8 +2166,11 @@
$result .= $self->_convert({'contents' => $file});
}
# node name
+ $self->{'formatters'}->[-1]->{'suppress_styles'} = 1;
my $node_text = $self->_convert({'type' => '_code',
'contents' => $node_content});
+ delete $self->{'formatters'}->[-1]->{'suppress_styles'};
+
my $node_text_checked = $node_text
.$self->{'formatters'}->[-1]->{'container'}->get_pending();
if ($node_text_checked =~ /([,\t]|\.\s)/m
@@ -2169,8 +2184,11 @@
if ($file) {
$result .= $self->_convert({'contents' => $file});
}
+ $self->{'formatters'}->[-1]->{'suppress_styles'} = 1;
my $node_text = $self->_convert({'type' => '_code',
'contents' => $node_content});
+ delete $self->{'formatters'}->[-1]->{'suppress_styles'};
+
my $node_text_checked = $node_text
.$self->{'formatters'}->[-1]->{'container'}->get_pending();
if ($node_text_checked =~ /:/m
Modified: trunk/tp/t/results/converters_tests/at_commands_in_refs.pl
===================================================================
--- trunk/tp/t/results/converters_tests/at_commands_in_refs.pl 2015-07-04
15:52:50 UTC (rev 6388)
+++ trunk/tp/t/results/converters_tests/at_commands_in_refs.pl 2015-07-05
19:37:52 UTC (rev 6389)
@@ -22712,11 +22712,10 @@
e\'\' e;:: *note e. e( e_ .e e< j ee[:: *note i E=` C\',:: *note `` \'\' ` \'
,, ,:: *note << >> << >> < >:: *note `` \'\' --- -- ` \':: *note AAA (fff)
AAA BBB:: *note CCC (rrr) CCC DDD:: *note the someone <address@hidden>
-<address@hidden>:: *note [f--ile1] Image description""\\.:: *note @ {} . ::
*note \'cite asis\'
-in @w b in r SC *str* t VAR "dfn" i:: *note \'env\' \'code\' \'option\'
\'samp\'
-\'command\' \'file\' \'C-x <ESC>\':: *note 8.27in:: *note sansserif slanted::
-*note \'indicateurl\':: *note _{g}H 3^{rd}:: *note <http://somewhere_aaa>
-text (url) ls::
+<address@hidden>:: *note [f--ile1] Image description""\\.:: *note @ {} . ::
*note cite asis in @w b
+in r SC *str* t VAR dfn i:: *note env code option samp command file C-x
+ESC:: *note 8.27in:: *note sansserif slanted:: *note indicateurl:: *note
+_{g}H 3^{rd}:: *note <http://somewhere_aaa> text (url) ls::
';
@@ -23692,43 +23691,43 @@
*******************************************************************************
-File: , Node: @ {} . , Next: \'cite asis\' in @w b in r SC *str* t VAR
"dfn" i, Prev: [f--ile1] [image src="f--ile.png" alt="alt" text="Image
description\\"\\"\\\\."