[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (command_tree, _conv
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (command_tree, _convert_xref_commands) (_convert_menu_entry_type), tp/Texinfo/Convert/Info.pm (format_node), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): always use 'manual_content' and 'node_content' in an element with them as sole contents. |
Date: |
Thu, 23 Nov 2023 15:58:52 -0500 |
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 b1559fd572 * tp/Texinfo/Convert/HTML.pm (command_tree,
_convert_xref_commands) (_convert_menu_entry_type), tp/Texinfo/Convert/Info.pm
(format_node), tp/Texinfo/Convert/LaTeX.pm (_convert),
tp/Texinfo/Convert/Plaintext.pm (_convert): always use 'manual_content' and
'node_content' in an element with them as sole contents.
b1559fd572 is described below
commit b1559fd572bdbb965d413711bc5949cdf13936fb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Nov 23 21:54:28 2023 +0100
* tp/Texinfo/Convert/HTML.pm (command_tree, _convert_xref_commands)
(_convert_menu_entry_type), tp/Texinfo/Convert/Info.pm (format_node),
tp/Texinfo/Convert/LaTeX.pm (_convert),
tp/Texinfo/Convert/Plaintext.pm (_convert): always use
'manual_content' and 'node_content' in an element with them as sole
contents.
* tp/Texinfo/Convert/LaTeX.pm (_convert),
tp/Texinfo/Convert/Plaintext.pm (process_footnotes, node_line)
(image_formatted_text, format_image, _convert): avoid
using contents separately from the element they are content of.
---
ChangeLog | 14 ++++
tp/TODO | 3 +
tp/Texinfo/Convert/HTML.pm | 20 ++++--
tp/Texinfo/Convert/Info.pm | 2 +-
tp/Texinfo/Convert/LaTeX.pm | 38 +++++-----
tp/Texinfo/Convert/Plaintext.pm | 154 +++++++++++++++++++---------------------
6 files changed, 121 insertions(+), 110 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f3abb608e4..e878db77aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2023-11-23 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (command_tree, _convert_xref_commands)
+ (_convert_menu_entry_type), tp/Texinfo/Convert/Info.pm (format_node),
+ tp/Texinfo/Convert/LaTeX.pm (_convert),
+ tp/Texinfo/Convert/Plaintext.pm (_convert): always use
+ 'manual_content' and 'node_content' in an element with them as sole
+ contents.
+
+ * tp/Texinfo/Convert/LaTeX.pm (_convert),
+ tp/Texinfo/Convert/Plaintext.pm (process_footnotes, node_line)
+ (image_formatted_text, format_image, _convert): avoid
+ using contents separately from the element they are content of.
+
2023-11-23 Gavin Smith <gavinsmith0123@gmail.com>
* info/window.c (window_make_modeline): Include any numbered
diff --git a/tp/TODO b/tp/TODO
index 78c88a8884..c8a96dceb3 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -724,6 +724,9 @@ perl 5.38.0
PERL_BASE=$HOME/localperl
export PATH="$PERL_BASE/bin${PATH:+:$PATH}"
export PERL5LIB="$PERL_BASE/lib/perl5"
+export PERL_MB_OPT='--install_base "/home/dumas/localperl"'
+export PERL_MM_OPT=INSTALL_BASE=/home/dumas/localperl
+
To generate valgrind .supp rules: --gen-suppressions=all
--log-file=gen_supp_rules.log
mkdir -p val_res
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 2c064d9c7b..9df21b7542 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1100,11 +1100,12 @@ sub command_tree($$;$)
my $tree;
if ($command->{'extra'}->{'manual_content'}) {
$tree = {'type' => '_code',
- 'contents' => [{'text' => '('},
@{$command->{'extra'}->{'manual_content'}},
- {'text' => ')'}, @$node_content]};
+ 'contents' => [{'text' => '('},
+ {'contents' => $command->{'extra'}->{'manual_content'}},
+ {'text' => ')'}, {'contents' => $node_content}]};
} else {
$tree = {'type' => '_code',
- 'contents' => $node_content};
+ 'contents' => [{'contents' => $node_content}]};
}
return $tree;
}
@@ -1125,7 +1126,7 @@ sub command_tree($$;$)
or $command->{'cmdname'} eq 'anchor')) {
# FIXME is it possible not to have contents (nor args)?
$tree = {'type' => '_code',
- 'contents' => $command->{'args'}->[0]->{'contents'}};
+ 'contents' => [$command->{'args'}->[0]]};
} elsif ($command->{'cmdname'} and ($command->{'cmdname'} eq 'float')) {
$tree = $self->float_type_number($command);
} elsif (!$command->{'args'}->[0]
@@ -5592,7 +5593,7 @@ sub _convert_xref_commands($$$$)
$label_element->{'extra'}->{'manual_content'}
= $node_arg->{'extra'}->{'manual_content'};
my $file_with_node_tree = {'type' => '_code',
- 'contents' =>
[@{$label_element->{'extra'}->{'manual_content'}}]};
+ 'contents' => [{'contents' =>
$label_element->{'extra'}->{'manual_content'}}]};
$file = $self->convert_tree($file_with_node_tree, 'node file in ref');
}
my $href = $self->command_href($label_element, undef, $root);
@@ -5605,7 +5606,7 @@ sub _convert_xref_commands($$$$)
} elsif (!defined($name) and $label_element->{'extra'}
and $label_element->{'extra'}->{'node_content'}) {
my $node_no_file_tree = {'type' => '_code',
- 'contents' =>
[@{$label_element->{'extra'}->{'node_content'}}]};
+ 'contents' => [{'contents' =>
$label_element->{'extra'}->{'node_content'}}]};
my $node_name = $self->convert_tree($node_no_file_tree, 'node in ref');
if (defined($node_name) and $node_name ne 'Top') {
$name = $node_name;
@@ -6958,7 +6959,7 @@ sub _convert_menu_entry_type($$$)
$name = $self->command_text($menu_entry_node);
} elsif ($menu_entry_node->{'extra'}) {
$name = $self->convert_tree({'type' => '_code',
- 'contents' => $menu_entry_node->{'extra'}->{'node_content'}},
+ 'contents' => [{'contents' =>
$menu_entry_node->{'extra'}->{'node_content'}}]},
'menu_arg name');
} else {
$name = '';
@@ -10189,6 +10190,11 @@ sub _mini_toc
$result .= $self->html_attribute_class('ul', ['mini-toc']).">\n";
foreach my $section (@{$command->{'extra'}->{'section_childs'}}) {
+ # using command_text leads to the same HTML formatting, but does not give
+ # the same result for the other files, as the formatting is done in a
+ # global context, while taking the tree first and calling convert_tree
+ # converts in the current page context.
+ #my $text = $self->command_text($section, 'text_nonumber');
my $tree = $self->command_tree($section, 1);
my $text = $self->convert_tree($tree, "mini_toc
\@$section->{'cmdname'}");
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 0bb65f3624..bee150b901 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -498,7 +498,7 @@ sub format_node($$)
if ($node_direction->{'extra'}->{'manual_content'}) {
$result .= $self->convert_line({'type' => '_code',
'contents' => [{'text' => '('},
- @{$node_direction->{'extra'}->{'manual_content'}},
+ {'contents' =>
$node_direction->{'extra'}->{'manual_content'}},
{'text' => ')'}]});
}
if (defined($node_direction->{'extra'}->{'normalized'})) {
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 972a33cce3..a5476ee800 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3145,7 +3145,7 @@ sub _convert($$)
my @args;
for my $arg (@{$element->{'args'}}) {
if (defined $arg->{'contents'} and @{$arg->{'contents'}}) {
- push @args, $arg->{'contents'};
+ push @args, $arg;
} else {
push @args, undef;
}
@@ -3158,25 +3158,25 @@ sub _convert($$)
}
my $book = '';
if (defined($args[4])) {
- $book = _convert($self, {'contents' => $args[4]});
+ $book = _convert($self, $args[4]);
}
- my $file_contents;
+ my $file_element;
# FIXME not sure if Texinfo TeX uses the external node manual
# specified as part of the node name with manual name prepended
# in parentheses
if (defined($args[3])) {
- $file_contents = $args[3];
+ $file_element = $args[3];
} elsif ($node_arg and $node_arg->{'extra'}
and defined($node_arg->{'extra'}->{'normalized'})
and $node_arg->{'extra'}->{'manual_content'}) {
- $file_contents
- = $node_arg->{'extra'}->{'manual_content'};
+ $file_element
+ = {'contents' => $node_arg->{'extra'}->{'manual_content'}};
}
my $filename = '';
- if ($file_contents) {
+ if ($file_element) {
push @{$self->{'formatting_context'}->[-1]->{'code'}}, 1;
- $filename = _convert($self, {'contents' => $file_contents});
+ $filename = _convert($self, $file_element);
pop @{$self->{'formatting_context'}->[-1]->{'code'}};
}
if ($cmdname ne 'inforef' and $book eq '' and $filename eq ''
@@ -3290,16 +3290,16 @@ sub _convert($$)
if (defined($self->get_conf('xrefautomaticsectiontitle'))
and $self->get_conf('xrefautomaticsectiontitle') eq 'on'
and $section_command) {
- $name = $section_command->{'args'}->[0]->{'contents'};
+ $name = $section_command->{'args'}->[0];
} else {
- $name = $reference_node_content;
+ $name = {'contents' => $reference_node_content};
}
}
my $reference_label = _tree_anchor_label($reference_node_content);
my $name_text;
if (defined($name)) {
- $name_text = _convert($self, {'contents' => $name});
+ $name_text = _convert($self, $name);
$text_representation .= $name_text if
(defined($text_representation));
}
@@ -3379,7 +3379,7 @@ sub _convert($$)
}
my $name_text;
if (defined($name)) {
- $name_text = _convert($self, {'contents' => $name});
+ $name_text = _convert($self, $name);
}
if ($book ne '') {
@@ -3410,7 +3410,7 @@ sub _convert($$)
my $name_text;
if (defined($name)) {
- $name_text = _convert($self, {'contents' => $name});
+ $name_text = _convert($self, $name);
$result .= $name_text;
}
}
@@ -3426,10 +3426,10 @@ sub _convert($$)
my $argument;
if ($cmdname eq 'abbr') {
$argument = {'type' => '_dot_not_end_sentence',
- 'contents' => $element->{'args'}->[0]->{'contents'}};
+ 'contents' => [$element->{'args'}->[0]]};
} else {
# TODO in TeX, acronym is in a smaller font (1pt less).
- $argument = { 'contents' => $element->{'args'}->[0]->{'contents'}};
+ $argument = $element->{'args'}->[0];
}
if (scalar (@{$element->{'args'}}) == 2
and defined($element->{'args'}->[-1])
@@ -3522,8 +3522,7 @@ sub _convert($$)
my $caption_text = '';
if ($element->{'args'}->[0]->{'contents'}) {
_push_new_context($self, 'latex_caption');
- $caption_text = _convert($self,
- {'contents' => $element->{'args'}->[0]->{'contents'}});
+ $caption_text = _convert($self, $element->{'args'}->[0]);
_pop_context($self);
}
@@ -3546,8 +3545,7 @@ sub _convert($$)
if (defined($shortcaption)
and $shortcaption->{'args'}->[0]->{'contents'}) {
_push_new_context($self, 'latex_shortcaption');
- my $shortcaption_text = _convert($self,
- {'contents' => $shortcaption->{'args'}->[0]->{'contents'}});
+ my $shortcaption_text = _convert($self, $shortcaption->{'args'}->[0]);
_pop_context($self);
$result .= '['.$shortcaption_text.']';
}
@@ -3671,7 +3669,7 @@ sub _convert($$)
if ($content->{'contents'}) {
$prototype_text
= Texinfo::Convert::Text::convert_to_text(
- {'contents' => $content->{'contents'}},
+ $content,
$self->{'convert_text_options'});
}
my $length
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 724046a440..d09b5e4ce1 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -986,12 +986,12 @@ sub process_footnotes($;$)
$element = undef if ($element and
not defined($element->{'unit_command'}));
my $node_element;
- my $node_contents;
+ my $label_element;
if ($element) {
$node_element = $element->{'unit_command'};
if ($node_element->{'extra'}
and defined($node_element->{'extra'}->{'normalized'})) {
- $node_contents = $node_element->{'args'}->[0]->{'contents'};
+ $label_element = $node_element->{'args'}->[0];
}
}
@@ -999,18 +999,18 @@ sub process_footnotes($;$)
if ($self->get_conf('footnotestyle') eq 'end'
# no node content happens only in very special cases, such as
# a @footnote in @copying and @insertcopying (and USE_NODES=0?)
- or !$node_contents) {
+ or !$label_element) {
my $footnotes_header = " ---------- Footnotes ----------\n\n";
$result .= $footnotes_header;
add_text_to_count($self, $footnotes_header);
_add_lines_count($self, 2);
$self->{'empty_lines_count'} = 1;
} else {
- my $footnotes_node_contents
- = [@$node_contents, {'text' => '-Footnotes'}];
+ my $footnotes_node_arg
+ = {'contents' => [$label_element, {'text' => '-Footnotes'}]};
my $footnotes_node = {
'cmdname' => 'node',
- 'args' => [{'contents' => $footnotes_node_contents}],
+ 'args' => [$footnotes_node_arg],
'extra' => {'is_target' => 1,
'normalized'
=> $node_element->{'extra'}->{'normalized'}.'-Footnotes',
@@ -1028,13 +1028,13 @@ sub process_footnotes($;$)
# element, while the pxref will point to the name with the
# footnote node taken into account. Not really problematic as
# nested footnotes are not right.
- if ($node_contents) {
+ if ($label_element) {
my $footnote_anchor_postfix = "-Footnote-$footnote->{'number'}";
- my $footnote_anchor_contents
- = [@$node_contents,
- {'text' => $footnote_anchor_postfix}];
+ my $footnote_anchor_arg
+ = {'contents' => [$label_element,
+ {'text' => $footnote_anchor_postfix}]};
$self->add_location({'cmdname' => 'anchor',
- 'args' => [{'contents' => $footnote_anchor_contents}],
+ 'args' => [$footnote_anchor_arg],
'extra' => {'is_target' => 1,
'normalized'
=> $node_element->{'extra'}->{'normalized'}.$footnote_anchor_postfix},
@@ -1343,16 +1343,15 @@ sub node_line($$)
my ($self, $node) = @_;
$self->{'node_lines_text'} = {} if (!$self->{'node_lines_text'});
if (!$self->{'node_lines_text'}->{$node}) {
- my $node_contents;
+ my $label_element;
if ($node->{'cmdname'}) {
- my $label_element = Texinfo::Common::get_label_element($node);
- $node_contents = $label_element->{'contents'};
+ $label_element = Texinfo::Common::get_label_element($node);
} else {
# node direction to an external node
- $node_contents = $node->{'extra'}->{'node_content'};
+ $label_element = {'contents' => $node->{'extra'}->{'node_content'}};
}
my $node_text = {'type' => '_code',
- 'contents' => $node_contents};
+ 'contents' => [$label_element]};
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
$self->{'node_lines_text'}->{$node}
= {'text' => _normalize_top_node($self->convert_line($node_text,
@@ -1690,8 +1689,7 @@ sub image_formatted_text($$$$)
and $element->{'args'}->[3]->{'contents'}
and @{$element->{'args'}->[3]->{'contents'}}) {
$result = '[' .Texinfo::Convert::Text::convert_to_text(
- {'contents' => $element->{'args'}->[3]->{'contents'}},
- $self->{'convert_text_options'}) .']';
+ $element->{'args'}->[3], $self->{'convert_text_options'}) .']';
} else {
$self->converter_line_warn($self, sprintf(__(
"could not find \@image file `%s.txt' nor alternate text"),
@@ -1709,7 +1707,7 @@ sub format_image($$)
and $element->{'args'}->[0]->{'contents'}
and @{$element->{'args'}->[0]->{'contents'}}) {
my $basefile = Texinfo::Convert::Text::convert_to_text(
- {'contents' => $element->{'args'}->[0]->{'contents'}},
+ $element->{'args'}->[0],
{'code' => 1, %{$self->{'convert_text_options'}}});
my ($text, $width) = $self->txt_image_text($element, $basefile);
# remove last end of line
@@ -2091,21 +2089,21 @@ sub _convert($$)
} elsif ($ref_commands{$command}) {
if (scalar(@{$element->{'args'}})) {
my @args;
- for my $a (@{$element->{'args'}}) {
- if (defined $a->{'contents'} and @{$a->{'contents'}}) {
- push @args, $a->{'contents'};
+ for my $arg (@{$element->{'args'}}) {
+ if (defined $arg->{'contents'} and @{$arg->{'contents'}}) {
+ push @args, $arg;
} else {
push @args, undef;
}
}
- $args[0] = [{'text' => ''}] if (!defined($args[0]));
+ $args[0] = {'text' => ''} if (!defined($args[0]));
my $node_arg = $element->{'args'}->[0];
# normalize node name, to get a ref with the right formatting
# NOTE as a consequence, the line numbers appearing in case of errors
# correspond to the node lines numbers, and not the @ref.
- my $node_content;
+ my $label_element;
my $target_element;
if ($node_arg and $node_arg->{'extra'}
and !$node_arg->{'extra'}->{'manual_content'}
@@ -2116,14 +2114,14 @@ sub _convert($$)
$target_element
= $self->{'identifiers_target'}->{
$node_arg->{'extra'}->{'normalized'}};
- my $label_element
+ $label_element
= Texinfo::Common::get_label_element($target_element);
- if (defined($label_element) and $label_element->{'contents'}) {
- $node_content = $label_element->{'contents'};
+ if (defined($label_element) and !$label_element->{'contents'}) {
+ $label_element = undef;
}
}
- if (!defined($node_content)) {
- $node_content = $args[0];
+ if (!defined($label_element)) {
+ $label_element = $args[0];
}
# if it a reference to a float with a label, $arg[1] is
@@ -2132,7 +2130,7 @@ sub _convert($$)
and $target_element and $target_element->{'cmdname'}
and $target_element->{'cmdname'} eq 'float') {
my $name = $self->float_type_number($target_element);
- $args[1] = $name->{'contents'};
+ $args[1] = $name;
}
if ($command eq 'inforef' and scalar(@args) == 3) {
$args[3] = $args[2];
@@ -2171,19 +2169,20 @@ sub _convert($$)
}
my $file;
if (defined($args[3])) {
- $file = [{'text' => '('},
- {'type' => '_stop_upper_case',
- 'contents' => [{'type' => '_code',
- 'contents' => $args[3]}],},
- {'text' => ')'},];
+ $file = {'contents' => [
+ {'text' => '('},
+ {'type' => '_stop_upper_case',
+ 'contents' => [{'type' => '_code',
+ 'contents' => [$args[3]]}],},
+ {'text' => ')'},]};
} elsif (defined($args[4])) {
# add a () such that the node is considered to be external,
# even though the manual name is not known.
- $file = [{'text' => '()'}];
+ $file = {'text' => '()'};
}
if ($name) {
- my $name_text = _convert($self, {'contents' => $name});
+ my $name_text = _convert($self, $name);
# needed, as last word is added only when : is added below
my $name_text_checked = $name_text
.get_pending($self->{'formatters'}->[-1]->{'container'});
@@ -2201,7 +2200,7 @@ sub _convert($$)
my $pre_quote = $quoting_required ? "\x{7f}" : '';
my $post_quote = $pre_quote;
$name_text .= _convert($self, {'contents' => [
- {'text' => "$post_quote: "}]});
+ {'text' => "$post_quote: "}]});
$name_text =~ s/^(\s*)/$1$pre_quote/ if $pre_quote;
$result .= $name_text;
_count_added($self, $self->{'formatters'}[-1]{'container'},
@@ -2210,7 +2209,7 @@ sub _convert($$)
}
if ($file) {
- $result .= _convert($self, {'contents' => $file});
+ $result .= _convert($self, $file);
}
my $node_line_name;
@@ -2223,16 +2222,17 @@ sub _convert($$)
# However, it is slow to do this for every node. So in the most
# frequent case when the node name is a simple text element, use
# that text instead.
- if (scalar(@{$node_content}) == 1
- and defined($node_content->[0]->{'text'})) {
- $node_line_name = $node_content->[0]->{'text'};
+ if ($label_element and $label_element->{'contents'}
+ and scalar(@{$label_element->{'contents'}}) == 1
+ and defined($label_element->{'contents'}->[0]->{'text'})) {
+ $node_line_name = $label_element->{'contents'}->[0]->{'text'};
} else {
$self->{'silent'} = 0 if (!defined($self->{'silent'}));
$self->{'silent'}++;
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
$node_line_name = $self->convert_line({'type' => '_code',
- 'contents' => $node_content},
+ 'contents' => [$label_element]},
{'suppress_styles' => 1,
'no_added_eol' => 1});
pop @{$self->{'count_context'}};
@@ -2272,7 +2272,7 @@ sub _convert($$)
$node_text .= _convert($self, {'type' => '_stop_upper_case',
'contents' => [
{'type' => '_code',
- 'contents' => $node_content}]});
+ 'contents' => [$label_element]}]});
delete $self->{'formatters'}->[-1]->{'suppress_styles'};
$node_text .= _count_added($self,
@@ -2448,14 +2448,14 @@ sub _convert($$)
and $element->{'args'}->[2]->{'contents'}
and @{$element->{'args'}->[2]->{'contents'}}) {
$inserted = {'type' => '_stop_upper_case',
- 'contents' => $element->{'args'}->[2]->{'contents'}};
+ 'contents' => [$element->{'args'}->[2]]};
} elsif ($element->{'args'}->[0]->{'contents'}
and @{$element->{'args'}->[0]->{'contents'}}) {
# no mangling of --- and similar in url.
my $url = {'type' => '_stop_upper_case',
'contents' => [
{'type' => '_code',
- 'contents' => $element->{'args'}->[0]->{'contents'}}]};
+ 'contents' => [$element->{'args'}->[0]]}]};
if (scalar(@{$element->{'args'}}) == 2
and defined($element->{'args'}->[1])
and $element->{'args'}->[1]->{'contents'}
@@ -2470,7 +2470,7 @@ sub _convert($$)
and defined($element->{'args'}->[1])
and $element->{'args'}->[1]->{'contents'}
and @{$element->{'args'}->[1]->{'contents'}}) {
- $inserted = {'contents' => $element->{'args'}->[1]->{'contents'}};
+ $inserted = $element->{'args'}->[1];
}
}
if ($inserted) {
@@ -2502,7 +2502,7 @@ sub _convert($$)
'args' => [
{'type' => 'brace_command_arg',
'contents' => [
- @{$self->{'current_node'}->{'args'}->[0]->{'contents'}},
+ $self->{'current_node'}->{'args'}->[0],
{'text' => "-Footnote-$self->{'footnote_index'}"}
]
}
@@ -2526,9 +2526,9 @@ sub _convert($$)
my $argument;
if ($command eq 'abbr') {
$argument = {'type' => 'frenchspacing',
- 'contents' => $element->{'args'}->[0]->{'contents'}};
+ 'contents' => [$element->{'args'}->[0]]};
} else {
- $argument = { 'contents' => $element->{'args'}->[0]->{'contents'}};
+ $argument = { 'contents' => [$element->{'args'}->[0]]};
}
if (scalar (@{$element->{'args'}}) == 2
and defined($element->{'args'}->[-1])
@@ -2560,16 +2560,15 @@ sub _convert($$)
if (scalar(@{$element->{'args'}}) > $arg_index
and defined($element->{'args'}->[$arg_index])
and $element->{'args'}->[$arg_index]->{'contents'}
- and @{$element->{'args'}->[$arg_index]->{'contents'}}) {
- my $contents = $element->{'args'}->[$arg_index]->{'contents'};
+ and scalar(@{$element->{'args'}->[$arg_index]->{'contents'}})) {
+ my $arg = $element->{'args'}->[$arg_index];
my $argument;
if ($command eq 'inlineraw') {
$argument = {'type' => '_stop_upper_case',
'contents' => [{'type' => '_code',
- 'contents' => $contents}]};
+ 'contents' => [$arg]}]};
} else {
- $argument
- = {'contents' => $contents};
+ $argument = $arg;
}
$result .= _convert($self, $argument);
}
@@ -2588,7 +2587,7 @@ sub _convert($$)
} elsif ($command eq 'titlefont') {
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
$result = $self->convert_line ({'type' => 'frenchspacing',
- 'contents' => [$element->{'args'}->[0]]});
+ 'contents' =>
[$element->{'args'}->[0]]});
pop @{$self->{'count_context'}};
$result = Texinfo::Convert::Text::text_heading(
{'extra' => {'section_level' => 0},
@@ -2637,15 +2636,15 @@ sub _convert($$)
} elsif ($command eq 'value') {
my $expansion = $self->gdt('@{No value for `{value}\'@}',
{'value' => $element->{'args'}->[0]});
+ my $piece;
if ($formatter->{'_top_formatter'}) {
- $expansion = {'type' => 'paragraph',
+ $piece = {'type' => 'paragraph',
'contents' => [$expansion]};
+ } else {
+ $piece = $expansion;
}
- $result .= _convert($self, $expansion);
+ $result .= _convert($self, $piece);
return $result;
- } elsif ($element->{'args'} and $element->{'args'}->[0]
- and $element->{'args'}->[0]->{'type'}
- and $element->{'args'}->[0]->{'type'} eq 'brace_command_arg') {
}
} elsif (defined($nobrace_symbol_text{$command})) {
if ($command eq ':') {
@@ -2766,8 +2765,7 @@ sub _convert($$)
my $column_size = 0;
if ($content->{'contents'}) {
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
- my ($formatted_prototype) = $self->convert_line(
- {'contents' => $content->{'contents'}},
+ my ($formatted_prototype) = $self->convert_line($content,
{'indent_length' => 0});
pop @{$self->{'count_context'}};
$column_size
@@ -2812,11 +2810,11 @@ sub _convert($$)
} elsif ($sectioning_heading_commands{$command}) {
# use settitle for empty @top
# ignore @part
- my $contents;
+ my $heading_element;
if ($element->{'args'}->[0]->{'contents'}
and @{$element->{'args'}->[0]->{'contents'}}
and $command ne 'part') {
- $contents = $element->{'args'}->[0]->{'contents'};
+ $heading_element = $element->{'args'}->[0];
} elsif ($command eq 'top'
and $self->{'global_commands'}->{'settitle'}
and $self->{'global_commands'}->{'settitle'}->{'args'}
@@ -2825,14 +2823,14 @@ sub _convert($$)
->{'args'}->[0]->{'contents'}
and scalar(@{$self->{'global_commands'}->{'settitle'}
->{'args'}->[0]->{'contents'}}))
{
- $contents =
-
$self->{'global_commands'}->{'settitle'}->{'args'}->[0]->{'contents'};
+ $heading_element =
+ $self->{'global_commands'}->{'settitle'}->{'args'}->[0];
}
- if ($contents) {
+ if ($heading_element) {
push @{$self->{'count_context'}}, {'lines' => 0, 'bytes' => 0};
my $heading = $self->convert_line({'type' => 'frenchspacing',
- 'contents' => $contents});
+ 'contents' => [$heading_element]});
pop @{$self->{'count_context'}};
# @* leads to an end of line, underlying appears on the line below
# over one line
@@ -2929,7 +2927,7 @@ sub _convert($$)
and $element->{'args'}->[0]->{'contents'}) {
$result = $self->convert_line (
{'type' => 'frenchspacing',
- 'contents' => $element->{'args'}->[0]->{'contents'}},
+ 'contents' => [$element->{'args'}->[0]]},
{'indent_length' => 0});
}
if ($result ne '') {
@@ -2949,13 +2947,11 @@ sub _convert($$)
if ($element->{'args'}->[0]
and $element->{'args'}->[0]->{'contents'}) {
if
($self->{'preformatted_context_commands'}->{$self->{'context'}->[-1]}) {
- $result = $self->_convert_unfilled(
- {'contents' => $element->{'args'}->[0]->{'contents'}},
+ $result = $self->_convert_unfilled($element->{'args'}->[0],
{'indent_level'
=> $self->{'format_context'}->[-1]->{'indent_level'} -1});
} else {
- $result = $self->convert_line(
- {'contents' => $element->{'args'}->[0]->{'contents'}},
+ $result = $self->convert_line($element->{'args'}->[0],
{'indent_level'
=> $self->{'format_context'}->[-1]->{'indent_level'} -1});
}
@@ -2999,7 +2995,7 @@ sub _convert($$)
or !$float->{'args'}->[1]->{'contents'}
or !@{$float->{'args'}->[1]->{'contents'}};
my $float_label_text = $self->convert_line({'type' => '_code',
- 'contents' => $float->{'args'}->[1]->{'contents'}});
+ 'contents' => [$float->{'args'}->[1]]});
my $float_entry = $self->float_type_number($float);
my $float_entry_text = ':';
if (defined($float_entry)) {
@@ -3027,13 +3023,7 @@ sub _convert($$)
and $caption->{'args'}->[0]->{'contents'}) {
$self->{'multiple_pass'} = 1;
push @{$self->{'context'}}, 'listoffloats';
- my $tree = {'contents' => $caption->{'args'}->[0]->{'contents'}};
- # the following does nothing since there are paragraphs within
- # the shortcaption.
- #if ($caption->{'cmdname'} eq 'shortcaption') {
- # $tree->{'type'} = 'frenchspacing';
- #}
- my $caption_text = _convert($self, $tree);
+ my $caption_text = _convert($self, $caption->{'args'}->[0]);
my $old_context = pop @{$self->{'context'}};
delete $self->{'multiple_pass'};
die if ($old_context ne 'listoffloats');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (command_tree, _convert_xref_commands) (_convert_menu_entry_type), tp/Texinfo/Convert/Info.pm (format_node), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (_convert): always use 'manual_content' and 'node_content' in an element with them as sole contents.,
Patrice Dumas <=
- Prev by Date:
branch master updated: * info/window.c (window_make_modeline): Include any numbered version suffix in the displayed manual name, so automake-1.16.info.gz displays as (automake-1.16) not (automake-1).
- Next by Date:
branch master updated: * tp/Texinfo/Common.pm (parse_node_manual), tp/Texinfo/Convert/HTML.pm (command_tree, _convert_xref_commands, _convert_menu_entry_type) (_normalized_label_id_file, _external_node_href), tp/Texinfo/Convert/Info.pm (format_node), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (node_line), tp/Texinfo/Convert/Texinfo.pm (link_element_to_texi) (check_node_same_texinfo_code), tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), tp/Texinfo/ParserNonXS.pm (_end_line_misc_line) [...]
- Previous by thread:
branch master updated: * info/window.c (window_make_modeline): Include any numbered version suffix in the displayed manual name, so automake-1.16.info.gz displays as (automake-1.16) not (automake-1).
- Next by thread:
branch master updated: * tp/Texinfo/Common.pm (parse_node_manual), tp/Texinfo/Convert/HTML.pm (command_tree, _convert_xref_commands, _convert_menu_entry_type) (_normalized_label_id_file, _external_node_href), tp/Texinfo/Convert/Info.pm (format_node), tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Plaintext.pm (node_line), tp/Texinfo/Convert/Texinfo.pm (link_element_to_texi) (check_node_same_texinfo_code), tp/Texinfo/Convert/TexinfoMarkup.pm (_convert), tp/Texinfo/ParserNonXS.pm (_end_line_misc_line) [...]
- Index(es):