[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (node_line): Re
From: |
Gavin D. Smith |
Subject: |
branch master updated: * tp/Texinfo/Convert/Plaintext.pm (node_line): Rename to 'node_name' as node_line is a confusing name, the result not being a full line but usually only part of a line. |
Date: |
Sat, 02 Dec 2023 13:19:55 -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 e8906416b0 * tp/Texinfo/Convert/Plaintext.pm (node_line): Rename to
'node_name' as node_line is a confusing name, the result not being a full line
but usually only part of a line.
e8906416b0 is described below
commit e8906416b094dc197ad8cdaf1693e88ae52f2c35
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Dec 2 18:19:37 2023 +0000
* tp/Texinfo/Convert/Plaintext.pm (node_line): Rename to
'node_name' as node_line is a confusing name, the result not
being a full line but usually only part of a line.
---
ChangeLog | 6 ++++++
tp/Texinfo/Convert/Info.pm | 6 +++---
tp/Texinfo/Convert/Plaintext.pm | 26 +++++++++++++-------------
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 44aaa1bcee..8998410e0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-12-02 Gavin Smith <gavinsmith0123@gmail.com>
+
+ * tp/Texinfo/Convert/Plaintext.pm (node_line): Rename to
+ 'node_name' as node_line is a confusing name, the result not
+ being a full line but usually only part of a line.
+
2023-12-02 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (preformatted_classes_stack),
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index d139f566d1..c34c8ef4a6 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -268,7 +268,7 @@ sub output($$)
} else {
$prefix = 'Ref';
}
- my ($label_text, $byte_count) = $self->node_line($label->{'root'});
+ my ($label_text, $byte_count) = $self->node_name($label->{'root'});
if ($seen_anchors{$label_text}) {
$self->converter_line_error($self,
@@ -443,7 +443,7 @@ sub format_node($$)
return '' if (not $node->{'extra'}
or not $node->{'extra'}->{'is_target'});
- my ($node_text, $byte_count) = $self->node_line($node);
+ my ($node_text, $byte_count) = $self->node_name($node);
# check not needed most probably because of the test of 'normalized'.
#return '' if ($node_text eq '');
@@ -504,7 +504,7 @@ sub format_node($$)
if (defined($node_direction->{'extra'}->{'normalized'})) {
my $pre_quote = '';
my $post_quote = '';
- my ($node_text, $byte_count) = $self->node_line($node_direction);
+ my ($node_text, $byte_count) = $self->node_name($node_direction);
$self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
# Up may not strictly need protection, as it is the last direction,
# but we protect consistently
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 99fc67b362..3376f677bd 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1303,11 +1303,11 @@ sub _normalize_top_node($)
}
# convert and cache a node name. $NODE is a node element.
-sub node_line($$)
+sub node_name($$)
{
my ($self, $node) = @_;
- $self->{'node_lines_text'} = {} if (!$self->{'node_lines_text'});
- if (!$self->{'node_lines_text'}->{$node}) {
+ $self->{'node_names_text'} = {} if (!$self->{'node_names_text'});
+ if (!$self->{'node_names_text'}->{$node}) {
my $label_element;
if ($node->{'cmdname'}) {
$label_element = Texinfo::Common::get_label_element($node);
@@ -1318,17 +1318,17 @@ sub node_line($$)
my $node_text = {'type' => '_code',
'contents' => [$label_element]};
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
- $self->{'node_lines_text'}->{$node}
+ $self->{'node_names_text'}->{$node}
= {'text' => _normalize_top_node($self->convert_line($node_text,
{'suppress_styles' => 1,
'no_added_eol' => 1,}))};
update_count_context($self);
my $end_context = pop @{$self->{'count_context'}};
- $self->{'node_lines_text'}->{$node}->{'count'}
+ $self->{'node_names_text'}->{$node}->{'count'}
= $end_context->{'bytes'};
}
- return ($self->{'node_lines_text'}->{$node}->{'text'},
- $self->{'node_lines_text'}->{$node}->{'count'});
+ return ($self->{'node_names_text'}->{$node}->{'text'},
+ $self->{'node_names_text'}->{$node}->{'count'});
}
my $index_length_to_node = 41;
@@ -1535,31 +1535,31 @@ sub process_printindex($$;$)
$self->{'index_entries_no_node'}->{$entry} = 1;
}
} else {
- my ($node_line, $byte_count) = $self->node_line($node);
+ my ($node_name, $byte_count) = $self->node_name($node);
$self->{'count_context'}->[-1]->{'bytes'} += $byte_count;
# protect characters that need to be protected in menu node entry
# after menu entry name and also :, as the Info readers
# should consider text up to : to be part of the index entry.
- if ($node_line =~ /([,\t:]|\.\s)/) {
+ if ($node_name =~ /([,\t:]|\.\s)/) {
my $warned_char = $1;
if ($self->{'info_special_chars_warning'}) {
# Warn only once
- if (! $self->{'index_entry_node_colon'}->{$node_line}) {
+ if (! $self->{'index_entry_node_colon'}->{$node_name}) {
$self->converter_line_warn($self, sprintf(__(
"node name with index entries should not contain `%s'"),
$warned_char),
$node->{'source_info'});
}
- $self->{'index_entry_node_colon'}->{$node_line} = 1;
+ $self->{'index_entry_node_colon'}->{$node_name} = 1;
}
if ($self->{'info_special_chars_quote'}) {
my $pre_quote = "\x{7f}";
my $post_quote = $pre_quote;
$self->{'count_context'}->[-1]->{'bytes'} += 2;
- $node_line = $pre_quote . $node_line . $post_quote;
+ $node_name = $pre_quote . $node_name . $post_quote;
}
}
- $entry_line_addition .= $node_line;
+ $entry_line_addition .= $node_name;
}
$entry_line_addition .= '.';
add_text_to_count($self, '.');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/Plaintext.pm (node_line): Rename to 'node_name' as node_line is a confusing name, the result not being a full line but usually only part of a line.,
Gavin D. Smith <=