[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert), tp/Te
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert), tp/Texinfo/Convert/LaTeX.pm (_convert): simplify condition for element args. |
Date: |
Sun, 29 Sep 2024 09:37:58 -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 76c1e15e6d * tp/Texinfo/Convert/DocBook.pm (_convert),
tp/Texinfo/Convert/LaTeX.pm (_convert): simplify condition for element args.
76c1e15e6d is described below
commit 76c1e15e6d2c4afc5dc166b2203dee16f6eb4b2e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Jul 1 15:49:55 2024 +0200
* tp/Texinfo/Convert/DocBook.pm (_convert),
tp/Texinfo/Convert/LaTeX.pm (_convert): simplify condition for element
args.
---
ChangeLog | 6 ++++++
tp/Texinfo/Convert/DocBook.pm | 18 +++++++-----------
tp/Texinfo/Convert/LaTeX.pm | 22 ++++++++--------------
3 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 630154afb6..133143e90f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-07-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/DocBook.pm (_convert),
+ tp/Texinfo/Convert/LaTeX.pm (_convert): simplify condition for element
+ args.
+
2024-07-01 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_convert_exdent_command): handle better
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 1ce32a9df1..c9b84052b3 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -1454,12 +1454,11 @@ sub _convert($$;$)
return '';
}
- } elsif ($element->{'cmdname'} eq 'uref' or $element->{'cmdname'} eq
'url') {
+ } elsif ($element->{'cmdname'} eq 'uref'
+ or $element->{'cmdname'} eq 'url') {
if ($element->{'args'}) {
my ($url_text, $url_arg);
- if (defined($element->{'args'}->[0])
- and $element->{'args'}->[0]->{'contents'}
- and @{$element->{'args'}->[0]->{'contents'}}) {
+ if ($element->{'args'}->[0]->{'contents'}) {
$url_arg = $element->{'args'}->[0];
Texinfo::Convert::Text::set_options_code(
$self->{'convert_text_options'});
@@ -1477,16 +1476,12 @@ sub _convert($$;$)
}
my $replacement;
if (scalar(@{$element->{'args'}}) >= 2
- and defined($element->{'args'}->[1])
- and $element->{'args'}->[1]->{'contents'}
- and @{$element->{'args'}->[1]->{'contents'}}) {
+ and $element->{'args'}->[1]->{'contents'}) {
$replacement = $self->_convert($element->{'args'}->[1]);
}
if (!defined($replacement) or $replacement eq '') {
if (scalar(@{$element->{'args'}}) == 3
- and defined($element->{'args'}->[2])
- and $element->{'args'}->[2]->{'contents'}
- and @{$element->{'args'}->[2]->{'contents'}}) {
+ and $element->{'args'}->[2]->{'contents'}) {
$replacement = $self->_convert($element->{'args'}->[2]);
}
}
@@ -1500,7 +1495,8 @@ sub _convert($$;$)
# return "<link xlink:href=\"$url_text\">$replacement</link>";
}
- } elsif ($element->{'cmdname'} eq 'abbr' or $element->{'cmdname'} eq
'acronym') {
+ } elsif ($element->{'cmdname'} eq 'abbr'
+ or $element->{'cmdname'} eq 'acronym') {
my $argument;
if ($element->{'args'}
and $element->{'args'}->[0]->{'contents'}) {
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 542bfbdb04..e9e988232f 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3293,29 +3293,23 @@ sub _convert($$)
} elsif ($cmdname eq 'uref' or $cmdname eq 'url') {
if ($element->{'args'}) {
if (scalar(@{$element->{'args'}}) == 3
- and defined($element->{'args'}->[2])
- and $element->{'args'}->[2]->{'contents'}
- and @{$element->{'args'}->[2]->{'contents'}}) {
+ and $element->{'args'}->[2]->{'contents'}) {
unshift @{$self->{'current_contents'}->[-1]},
- {'contents' => $element->{'args'}->[2]->{'contents'}};
- } elsif ($element->{'args'}->[0]
- and $element->{'args'}->[0]->{'contents'}
- and @{$element->{'args'}->[0]->{'contents'}}) {
- my $url_content = $element->{'args'}->[0];
+ $element->{'args'}->[2];
+ } elsif ($element->{'args'}->[0]->{'contents'}) {
+ my $url_arg = $element->{'args'}->[0];
Texinfo::Convert::Text::set_options_code(
$self->{'convert_text_options'});
my $url_text = $self->_protect_url(
- Texinfo::Convert::Text::convert_to_text($url_content,
+ Texinfo::Convert::Text::convert_to_text($url_arg,
$self->{'convert_text_options'}));
Texinfo::Convert::Text::reset_options_code(
$self->{'convert_text_options'});
if (scalar(@{$element->{'args'}}) == 2
- and defined($element->{'args'}->[1])
- and $element->{'args'}->[1]->{'contents'}
- and @{$element->{'args'}->[1]->{'contents'}}) {
- my $description = _convert($self, $element->{'args'}->[1]);
+ and $element->{'args'}->[1]->{'contents'}) {
+ my $description_text = _convert($self, $element->{'args'}->[1]);
my $text = $self->cdt_string('{text} ({url})',
- {'text' => $description, 'url' => "\\nolinkurl{$url_text}"});
+ {'text' => $description_text, 'url' =>
"\\nolinkurl{$url_text}"});
$result .= "\\href{$url_text}{$text}";
return $result;
} else {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/DocBook.pm (_convert), tp/Texinfo/Convert/LaTeX.pm (_convert): simplify condition for element args.,
Patrice Dumas <=