[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Remove empty lines in inter item when processing
From: |
Patrice Dumas |
Subject: |
branch master updated: Remove empty lines in inter item when processing the inter_item |
Date: |
Thu, 11 Aug 2022 09:13:01 -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 2192ddc453 Remove empty lines in inter item when processing the
inter_item
2192ddc453 is described below
commit 2192ddc4538e77922dde5e25689ef2ff59938d43
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Aug 11 15:12:49 2022 +0200
Remove empty lines in inter item when processing the inter_item
* tp/Texinfo/Convert/LaTeX.pm (_convert): process directly the
inter_item content and remove empty lines directly in that
processing.
---
ChangeLog | 8 ++++++++
tp/Texinfo/Convert/LaTeX.pm | 48 +++++++++++++++++++++++++++++----------------
2 files changed, 39 insertions(+), 17 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8dca7ab866..21c252eb4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-08-11 Patrice Dumas <pertusus@free.fr>
+
+ Remove empty lines in inter item when processing the inter_item
+
+ * tp/Texinfo/Convert/LaTeX.pm (_convert): process directly the
+ inter_item content and remove empty lines directly in that
+ processing.
+
2022-08-11 Patrice Dumas <pertusus@free.fr>
Rename after_description_line type as after_menu_description_line
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index ed8b0aabb4..cd86c5bd03 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -1861,11 +1861,6 @@ sub _open_preformatted($$)
push @{$self->{'formatting_context'}->[-1]->{'code'}}, 1;
}
- # no preformatted formatting if in a @table item, it leads
- # to an error, and also it is only for some inter item
- # content.
- return ''
- if
(scalar(@{$self->{'formatting_context'}->[-1]->{'nr_table_items_context'}}));
my $result = '';
$result .= '\\begin{GNUTexinfopreformatted}'."\n";
@@ -1896,8 +1891,6 @@ sub _close_preformatted($$)
if ($preformatted_code_commands{$command}) {
pop @{$self->{'formatting_context'}->[-1]->{'code'}};
}
- return ''
- if
(scalar(@{$self->{'formatting_context'}->[-1]->{'nr_table_items_context'}}));
return '\\end{GNUTexinfopreformatted}'."\n";
}
@@ -2273,16 +2266,7 @@ sub _convert($$)
}
if ($type and ($type eq 'empty_line')) {
- # if nr_table_items_context the whole @item/@itemx formatting
- # is put in a parbox, in which there should not be paragraphs,
- # so we remove empty lines.
- # FIXME this conditions is probably checked a lot in a document
- # formatting may be better to avoid.
- if
(scalar(@{$self->{'formatting_context'}->[-1]->{'nr_table_items_context'}})) {
- return '';
- } else {
- return "\n";
- }
+ return "\n";
}
# process text
@@ -3684,6 +3668,36 @@ sub _convert($$)
}
push @{$self->{'formatting_context'}->[-1]->{'nr_table_items_context'}},
$nr_item;
+ } elsif ($element->{'type'} eq 'inter_item') {
+ # the whole @item/@itemx formatting is put in a parbox, in which
+ # there should not be paragraphs, so we remove empty lines from
+ # inter_item. We format directly here while ignoring the empty lines
+ # for performance reasons, and not below like all the contents, to
+ # avoid needing to check if in table items using a context information,
+ # we know that only comments and index entries or a lone preformatted
+ # should be in inter_item.
+ if ($element->{'contents'}) {
+ my $contents;
+ # if in an preformatted context, ie in @example, the inter_item
+ # content is within a preformatted. In that case we use content
+ # from within the preformatted. We do not do anything that is done
+ # in _open_preformatted/_close_preformatted as the only things
+ # that should be in inter_item, besides empty lines we want to
+ # remove, are comments and index entries, which formatting should
+ # not be affected.
+ if ($element->{'contents'}->[0]->{'type'}
+ and $element->{'contents'}->[0]->{'type'} eq 'preformatted') {
+ $contents = $element->{'contents'}->[0]->{'contents'}
+ if $element->{'contents'}->[0]->{'contents'};
+ } else {
+ $contents = $element->{'contents'};
+ }
+ foreach my $content (@$contents) {
+ $result .= _convert($self, $content)
+ unless ($content->{'type'} and $content->{'type'} eq 'empty_line');
+ }
+ }
+ return $result;
} elsif ($element->{'type'} eq 'preformatted') {
$result .= _open_preformatted($self, $element);
} elsif ($element->{'type'} eq '_dot_not_end_sentence') {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Remove empty lines in inter item when processing the inter_item,
Patrice Dumas <=