texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: Transform @* to spaces in node and menu lines in


From: Patrice Dumas
Subject: branch master updated: Transform @* to spaces in node and menu lines in Info
Date: Wed, 17 Aug 2022 14:20:24 -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 715844862d Transform @* to spaces in node and menu lines in Info
715844862d is described below

commit 715844862d715a3a16e9e542a298fde607a8d458
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Aug 17 20:20:13 2022 +0200

    Transform @* to spaces in node and menu lines in Info
    
    * tp/Texinfo/Convert/Plaintext.pm (new_formatter)
    (process_printindex, _convert): add 'no_added_eol' as
    formatter status to have @* transformed to space instead
    of new line in @node and menu lines.
---
 ChangeLog                                          |   9 +++
 tp/TODO                                            |   5 +-
 tp/Texinfo/Convert/Plaintext.pm                    |  27 +++++++--
 .../formats_encodings/at_commands_in_refs.pl       |  67 ++++++++++-----------
 .../res_info/at_commands_in_refs_latin1.info       | Bin 8004 -> 8005 bytes
 .../res_info/at_commands_in_refs_utf8.info         | Bin 8411 -> 8412 bytes
 6 files changed, 64 insertions(+), 44 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5638e567f..6021791394 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-08-17  Patrice Dumas  <pertusus@free.fr>
+
+       Transform @* to spaces in node and menu lines in Info
+
+       * tp/Texinfo/Convert/Plaintext.pm (new_formatter)
+       (process_printindex, _convert): add 'no_added_eol' as
+       formatter status to have @* transformed to space instead
+       of new line in @node and menu lines.
+
 2022-08-17  Gavin Smith  <gavinsmith0123@gmail.com>
 
        Recommendations on markup on @def* lines
diff --git a/tp/TODO b/tp/TODO
index b5156a4902..8fbe087330 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,8 +13,6 @@ Before next release
 Bugs
 ====
 
-In Info @* in node name should become a space
-
 HTML API
 ========
 
@@ -684,6 +682,8 @@ Misc notes
 export XML_CATALOG_FILES=~/src/texinfo/tp/maintain/catalog.xml
 xmllint --nonet --noout --valid commands.xml
 
+tidy -qe *.html
+
 Test with 8bit locale:
 export LANG=fr_FR; export LANGUAGE=fr_FR; export LC_ALL=fr_FR
 xterm &
@@ -693,3 +693,4 @@ xsltproc -o intermediate-fo-file.fo 
/usr/share/xml/docbook/stylesheet/docbook-xs
 fop -r -pdf texinfo-dbk.pdf -fo intermediate-fo-file.fo
 
 dblatex -o texinfo-dblatex.pdf texinfo.xml
+
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 610c340922..e4f717be59 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -684,7 +684,8 @@ sub new_formatter($$;$)
                    'font_type_stack' => [{}],
                    'w' => 0, 'type' => $type,
               'frenchspacing_stack' => [$self->get_conf('frenchspacing')],
-              'suppress_styles' => $conf->{'suppress_styles'}};
+              'suppress_styles' => $conf->{'suppress_styles'},
+              'no_added_eol' => $conf->{'no_added_eol'}};
 
   if ($type eq 'unfilled') {
     foreach my $context (reverse(@{$self->{'context'}})) {
@@ -1205,7 +1206,8 @@ sub node_line($$)
     push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
     $self->{'node_lines_text'}->{$node}->{'text'} 
        = _normalize_top_node($self->convert_line($node_text,
-                                                 {'suppress_styles' => 1}));
+                                                 {'suppress_styles' => 1,
+                                                  'no_added_eol' => 1,}));
     update_count_context($self);
     my $end_context = pop @{$self->{'count_context'}};
     $self->{'node_lines_text'}->{$node}->{'count'} 
@@ -1319,7 +1321,8 @@ sub process_printindex($$;$)
     my $entry_text = '';
 
     my $formatter = $self->new_formatter('line',
-                                   {'indent' => 0, 'suppress_styles' => 1});
+                                   {'indent' => 0, 'suppress_styles' => 1,
+                                    'no_added_eol' => 1});
     push @{$self->{'formatters'}}, $formatter;
     $entry_text = $self->_convert($entry_tree);
     $entry_text .= $self->_convert($subentries_tree)
@@ -1704,9 +1707,17 @@ sub _convert($$)
         return '';
       } elsif ($command eq '*') {
         $result = _count_added($self, $formatter->{'container'},
-                              add_pending_word($formatter->{'container'}));
-        $result .= _count_added($self, $formatter->{'container'},
-                              end_line($formatter->{'container'}));
+                               add_pending_word($formatter->{'container'}));
+        # added eol in some line oriented constructs, such as @node, menu
+        # entry and therefore index entry would lead to end of line on
+        # node pointers line, in tag table, or on menu, all being invalid.
+        if ($formatter->{'no_added_eol'}) {
+          $result .= _count_added($self, $formatter->{'container'},
+                                 add_text($formatter->{'container'}, ' '));
+        } else {
+          $result .= _count_added($self, $formatter->{'container'},
+                                 end_line($formatter->{'container'}));
+        }
       } elsif ($command eq '.' or $command eq '?' or $command eq '!') {
         $result .= _count_added($self, $formatter->{'container'},
             add_next($formatter->{'container'}, $command));
@@ -3044,6 +3055,7 @@ sub _convert($$)
         my ($pre_quote, $post_quote);
         if ($arg->{'type'} eq 'menu_entry_node') {
           $self->{'formatters'}->[-1]->{'suppress_styles'} = 1;
+          $self->{'formatters'}->[-1]->{'no_added_eol'} = 1;
 
           # Flush a leading space
           $result .= _count_added($self, $formatter->{'container'},
@@ -3055,6 +3067,7 @@ sub _convert($$)
           $node_text .= _count_added($self, $formatter->{'container'},
                            add_pending_word($formatter->{'container'}, 1));
           delete $self->{'formatters'}->[-1]->{'suppress_styles'};
+          delete $self->{'formatters'}->[-1]->{'no_added_eol'};
           $pre_quote = $post_quote = '';
           if ($entry_name_seen) {
             if ($node_text =~ /([,\t]|\.\s)/) {
@@ -3081,7 +3094,9 @@ sub _convert($$)
           }
           $result .= $pre_quote . $node_text . $post_quote;
         } elsif ($arg->{'type'} eq 'menu_entry_name') {
+          $self->{'formatters'}->[-1]->{'no_added_eol'} = 1;
           my $entry_name = _convert($self, $arg);
+          delete $self->{'formatters'}->[-1]->{'no_added_eol'};
           my $formatter = $self->{'formatters'}->[-1];
           $entry_name .= _count_added($self,
                            $formatter->{'container'},
diff --git a/tp/t/results/formats_encodings/at_commands_in_refs.pl 
b/tp/t/results/formats_encodings/at_commands_in_refs.pl
index 39ccb12a04..2537fdd5ea 100644
--- a/tp/t/results/formats_encodings/at_commands_in_refs.pl
+++ b/tp/t/results/formats_encodings/at_commands_in_refs.pl
@@ -23625,8 +23625,7 @@ Top
 * Menu:
 
 *  { }::
-*     !
- .  . ? @::
+*     !   .  . ? @::
 * @ { } \\ #::
 * LaTeX TeX • , © ... ...::
 * ≡ error→ € ¡ ↦ −::
@@ -23654,23 +23653,20 @@ Top
 * <http://somewhere_aaa> text (url) ls::
 
 
-File: ,  Node: { },  Next:     !
-. . ? @,  Prev: Top,  Up: Top
+File: ,  Node: { },  Next:     ! . . ? @,  Prev: Top,  Up: Top
 
 1 { }
 *****
 
 
-File: ,  Node:     !
-. . ? @,  Next: @ { } \\ #,  Prev: { },  Up: Top
+File: ,  Node:     ! . . ? @,  Next: @ { } \\ #,  Prev: { },  Up: Top
 
 2     !
 . . ? @
 ***************
 
 
-File: ,  Node: @ { } \\ #,  Next: LaTeX TeX • , © ... ...,  Prev:     !
-. . ? @,  Up: Top
+File: ,  Node: @ { } \\ #,  Next: LaTeX TeX • , © ... ...,  Prev:     ! . . 
? @,  Up: Top
 
 3 @ { } \\ #
 ***********
@@ -23879,34 +23875,33 @@ File: ,  Node: <http://somewhere_aaa> text (url) ls,  
Prev: _{g}H 3^{rd},  Up: T
 
 Tag Table:
 Node: Top27
-Node: { }874
-Node:     !
-. . ? @953
-Node: @ { } \\ #1058
-Node: LaTeX TeX • , © ... ...1180
-Node: ≡ error→ € ¡ ↦ −1347
-Node: ≥ ≤ →1510
-Node: ª º ★ £ ⊣ ¿ ®1640
-Node: ⇒ ° a b a sunny day å1787
-Node: Å æ œ Æ Œ ø Ø ß ł Ł Ð ð Þ þ1975
-Node: ä ẽ î â à é ç ē e̊ e̋ ę2198
-Node: ė ĕ e̲ ẹ ě ȷ e͡e2410
-Node: ı Ḕ Ḉ2573
-Node: “ ” ‘ ’ „ ‚2701
-Node: « » « » ‹ ›2843
-Node: `` \'\' --- -- ` \'2987
-Node: AAA (fff) AAA BBB3129
-Node: CCC (rrr) CCC DDD3269
-Node: the someone <someone@somewher> <no_explain@there>3442
-Node: [f--ile1] [image src="f--ile.png" alt="alt" text="Image 
description\\"\\"\\\\."]3742
-Node:  @ {} . 4092
-Node: cite asis in @w b in r SC *str* t VAR dfn i4295
-Node: env code option samp command file C-x <ESC>4547
-Node: 8.27in4837
-Node: sansserif slanted4971
-Node: indicateurl5095
-Node: _{g}H 3^{rd}5221
-Node: <http://somewhere_aaa> text (url) ls5360
+Node: { }875
+Node:     ! . . ? @954
+Node: @ { } \\ #1059
+Node: LaTeX TeX • , © ... ...1181
+Node: ≡ error→ € ¡ ↦ −1348
+Node: ≥ ≤ →1511
+Node: ª º ★ £ ⊣ ¿ ®1641
+Node: ⇒ ° a b a sunny day å1788
+Node: Å æ œ Æ Œ ø Ø ß ł Ł Ð ð Þ þ1976
+Node: ä ẽ î â à é ç ē e̊ e̋ ę2199
+Node: ė ĕ e̲ ẹ ě ȷ e͡e2411
+Node: ı Ḕ Ḉ2574
+Node: “ ” ‘ ’ „ ‚2702
+Node: « » « » ‹ ›2844
+Node: `` \'\' --- -- ` \'2988
+Node: AAA (fff) AAA BBB3130
+Node: CCC (rrr) CCC DDD3270
+Node: the someone <someone@somewher> <no_explain@there>3443
+Node: [f--ile1] [image src="f--ile.png" alt="alt" text="Image 
description\\"\\"\\\\."]3743
+Node:  @ {} . 4093
+Node: cite asis in @w b in r SC *str* t VAR dfn i4296
+Node: env code option samp command file C-x <ESC>4548
+Node: 8.27in4838
+Node: sansserif slanted4972
+Node: indicateurl5096
+Node: _{g}H 3^{rd}5222
+Node: <http://somewhere_aaa> text (url) ls5361
 
 End Tag Table
 
diff --git 
a/tp/t/results/formats_encodings/at_commands_in_refs_latin1/res_info/at_commands_in_refs_latin1.info
 
b/tp/t/results/formats_encodings/at_commands_in_refs_latin1/res_info/at_commands_in_refs_latin1.info
index 005812a450..b5377f9e9f 100644
Binary files 
a/tp/t/results/formats_encodings/at_commands_in_refs_latin1/res_info/at_commands_in_refs_latin1.info
 and 
b/tp/t/results/formats_encodings/at_commands_in_refs_latin1/res_info/at_commands_in_refs_latin1.info
 differ
diff --git 
a/tp/t/results/formats_encodings/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
 
b/tp/t/results/formats_encodings/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
index 2419253234..ae116a5b6d 100644
Binary files 
a/tp/t/results/formats_encodings/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
 and 
b/tp/t/results/formats_encodings/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
 differ



reply via email to

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