texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_text_heading)


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (_text_heading): Return an unencoding string to be output with _stream_output rather than _stream_output_encoded. Callers updated. Call convert_line_new_context with encoding disabled. Call gdt_string rather than gdt_string_encoded and get display width of result with string_width.
Date: Tue, 23 Jan 2024 16:56:05 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 96a60cdd9f * tp/Texinfo/Convert/Plaintext.pm (_text_heading): Return 
an unencoding string to be output with _stream_output rather than 
_stream_output_encoded.  Callers updated.  Call convert_line_new_context with 
encoding disabled.  Call gdt_string rather than gdt_string_encoded and get 
display width of result with string_width.
96a60cdd9f is described below

commit 96a60cdd9f817b3a5c3f44516abc67bcc237f165
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Tue Jan 23 21:55:56 2024 +0000

    * tp/Texinfo/Convert/Plaintext.pm (_text_heading): Return
    an unencoding string to be output with _stream_output
    rather than _stream_output_encoded.  Callers updated.  Call
    convert_line_new_context with encoding disabled.  Call gdt_string
    rather than gdt_string_encoded and get display width of result
    with string_width.
---
 ChangeLog                                          |   9 ++++
 tp/Texinfo/Convert/Plaintext.pm                    |  19 +++-----
 .../formats_encodings/at_commands_in_refs.pl       |  54 ++++++++++-----------
 .../res_info/at_commands_in_refs_latin1.info       | Bin 7997 -> 7995 bytes
 .../res_info/at_commands_in_refs_utf8.info         | Bin 8394 -> 8392 bytes
 5 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cb68b463a4..b11bff2e10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-01-23  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/Convert/Plaintext.pm (_text_heading): Return
+       an unencoding string to be output with _stream_output
+       rather than _stream_output_encoded.  Callers updated.  Call
+       convert_line_new_context with encoding disabled.  Call gdt_string
+       rather than gdt_string_encoded and get display width of result
+       with string_width.
+
 2024-01-23  Gavin Smith <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/Plaintext.pm (_stream_output): Interchange
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 27718f5eec..c985483d68 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1883,29 +1883,24 @@ sub _text_heading($$$;$$)
 
   my ($heading, undef) = $self->convert_line_new_context (
                               {'type' => 'frenchspacing',
-                               'contents' => [$heading_element]});
-  my $heading_width = _string_width_encoded($self, $heading);
-  # TODO could use the returned width from convert_line_new_context instead
+                               'contents' => [$heading_element]}, undef, 1);
 
-  my ($text, $number_width, $gdt_width);
+  my $text;
   if (defined($number)) {
-    $number_width = length($number);
     if ($current->{'cmdname'} eq 'appendix'
         and $current->{'extra'}->{'section_level'} == 1) {
-      ($text, $gdt_width) = $self->gdt_string_encoded(
+      $text = $self->gdt_string(
                  'Appendix {number} {section_title}',
                  {'number' => $number, 'section_title' => $heading});
     } else {
-      ($text, $gdt_width) = $self->gdt_string_encoded(
+      $text = $self->gdt_string(
                  '{number} {section_title}',
                  {'number' => $number, 'section_title' => $heading});
     }
   } else {
     $text = $heading;
-    $number_width = 0;
-    $gdt_width = 0;
   }
-  my $columns = $heading_width + $number_width + $gdt_width;
+  my $columns = Texinfo::Convert::Unicode::string_width($text);
 
   return '' if ($text !~ /\S/);
   my $result = $text ."\n";
@@ -2846,7 +2841,7 @@ sub _convert($$)
                             $self->get_conf('NUMBER_SECTIONS'),
           ($self->{'format_context'}->[-1]->{'indent_level'}) *$indent_length);
         $result =~ s/\n$//; # final newline has its own tree element
-        _stream_output_encoded($self, $result);
+        _stream_output($self, $result);
         _add_lines_count($self, 1);
         return;
       } elsif ($command eq 'U') {
@@ -3095,7 +3090,7 @@ sub _convert($$)
                            ($self->{'format_context'}->[-1]->{'indent_level'})
                                            * $indent_length);
         _add_newline_if_needed($self);
-        _stream_output_encoded($self, $heading_underlined);
+        _stream_output($self, $heading_underlined);
         if ($heading_underlined ne '') {
           _add_lines_count($self, 2);
           _add_newline_if_needed($self);
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 0ac1d82e0a..8f6938c544 100644
--- a/tp/t/results/formats_encodings/at_commands_in_refs.pl
+++ b/tp/t/results/formats_encodings/at_commands_in_refs.pl
@@ -15603,7 +15603,7 @@ $result_converted{'plaintext'}->{'at_commands_in_refs'} 
= 'Top
 
 2     !
 . . ? @
-*********
+*******
 
 3 @ { } \\ #
 ***********
@@ -16759,7 +16759,7 @@ File: ,  Node:     ! . . ? @,  Next: @ { } \\ #,  Prev: 
{ },  Up: Top
 
 2     !
 . . ? @
-*********
+*******
 
 
 File: ,  Node: @ { } \\ #,  Next: LaTeX TeX • , © ... ...,  Prev:     ! . . 
? @,  Up: Top
@@ -16971,31 +16971,31 @@ Tag Table:
 Node: Top27
 Node: { }785
 Node:     ! . . ? @864
-Node: @ { } \\ #963
-Node: LaTeX TeX • , © ... ...1082
-Node: ≡ error→ € ¡ ↦ −1232
-Node: ≥ ≤ →1364
-Node: ª º ⋆ £ ⊣ ¿ ®1462
-Node: ⇒ ° a b a sunny day å1581
-Node: Å æ œ Æ Œ ø Ø ß ł Ł Ð ð Þ þ1738
-Node: ä ẽ î â à é ç ē e̊ e̋ ę1917
-Node: ė ĕ e̲ ẹ ě ȷ e͡e2083
-Node: ı Ḕ Ḉ2213
-Node: “ ” ‘ ’ „ ‚2311
-Node: « » « » ‹ ›2416
-Node: `` \'\' --- -- ` \'2532
-Node: AAA (fff) AAA BBB2656
-Node: CCC (rrr) CCC DDD2796
-Node: the someone <someone@somewher> <no_explain@there>2969
-Node: [f--ile1] [image src="f--ile.png" alt="alt" text="Image 
description\\"\\"\\\\."]3269
-Node:  @ {} . 3618
-Node: cite asis in @w b in r SC *str* t VAR dfn i3821
-Node: env code option samp command file C-x <ESC>4065
-Node: 8.27in4327
-Node: sansserif slanted4461
-Node: indicateurl4585
-Node: _{g}H 3^{rd}4707
-Node: <http://somewhere_aaa> text (url) ls4846
+Node: @ { } \\ #961
+Node: LaTeX TeX • , © ... ...1080
+Node: ≡ error→ € ¡ ↦ −1230
+Node: ≥ ≤ →1362
+Node: ª º ⋆ £ ⊣ ¿ ®1460
+Node: ⇒ ° a b a sunny day å1579
+Node: Å æ œ Æ Œ ø Ø ß ł Ł Ð ð Þ þ1736
+Node: ä ẽ î â à é ç ē e̊ e̋ ę1915
+Node: ė ĕ e̲ ẹ ě ȷ e͡e2081
+Node: ı Ḕ Ḉ2211
+Node: “ ” ‘ ’ „ ‚2309
+Node: « » « » ‹ ›2414
+Node: `` \'\' --- -- ` \'2530
+Node: AAA (fff) AAA BBB2654
+Node: CCC (rrr) CCC DDD2794
+Node: the someone <someone@somewher> <no_explain@there>2967
+Node: [f--ile1] [image src="f--ile.png" alt="alt" text="Image 
description\\"\\"\\\\."]3267
+Node:  @ {} . 3616
+Node: cite asis in @w b in r SC *str* t VAR dfn i3819
+Node: env code option samp command file C-x <ESC>4063
+Node: 8.27in4325
+Node: sansserif slanted4459
+Node: indicateurl4583
+Node: _{g}H 3^{rd}4705
+Node: <http://somewhere_aaa> text (url) ls4844
 
 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 a94f7300f2..7d90659b49 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 3af026a128..2bec874b46 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]