[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Convert/HTML.pm (_external_node_href
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Convert/HTML.pm (_external_node_href): initialize explicitly $target_split. Use a different variable for the case of $target_split ($file) and !$target_split ($directory). Rearrange code returning the final href to have less conditions. If target is empty and TOP_NODE_FILE_TARGET is not set use the directory and target_filebase as in the other cases. This case probably never happens, though, as TOP_NODE_FILE_TARGET is always set. |
Date: |
Tue, 05 Sep 2023 02:59:04 -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 0361f1c9a8 * tp/Texinfo/Convert/HTML.pm (_external_node_href):
initialize explicitly $target_split. Use a different variable for the case of
$target_split ($file) and !$target_split ($directory). Rearrange code
returning the final href to have less conditions. If target is empty and
TOP_NODE_FILE_TARGET is not set use the directory and target_filebase as in the
other cases. This case probably never happens, though, as TOP_NODE_FILE_TARGET
is always set.
0361f1c9a8 is described below
commit 0361f1c9a84394ce555d9514712b11cb5f8fd5dd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Sep 5 08:58:54 2023 +0200
* tp/Texinfo/Convert/HTML.pm (_external_node_href): initialize
explicitly $target_split. Use a different variable for the case of
$target_split ($file) and !$target_split ($directory). Rearrange code
returning the final href to have less conditions. If target is empty
and TOP_NODE_FILE_TARGET is not set use the directory and
target_filebase as in the other cases. This case probably never
happens, though, as TOP_NODE_FILE_TARGET is always set.
---
ChangeLog | 10 +++++++
tp/Texinfo/Convert/HTML.pm | 67 +++++++++++++++++++++++++---------------------
2 files changed, 46 insertions(+), 31 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e6626259ac..e3acf9eea8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-09-04 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Convert/HTML.pm (_external_node_href): initialize
+ explicitly $target_split. Use a different variable for the case of
+ $target_split ($file) and !$target_split ($directory). Rearrange code
+ returning the final href to have less conditions. If target is empty
+ and TOP_NODE_FILE_TARGET is not set use the directory and
+ target_filebase as in the other cases. This case probably never
+ happens, though, as TOP_NODE_FILE_TARGET is always set.
+
2023-09-04 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_external_node_href): do not call
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 5510917f24..2fef0995c6 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -9493,7 +9493,8 @@ sub _external_node_href($$$;$)
{
my $self = shift;
my $external_node = shift;
- my $filename = shift;
+ # unused
+ my $source_filename = shift;
# for messages only
my $source_command = shift;
@@ -9502,6 +9503,7 @@ sub _external_node_href($$$;$)
= $self->_normalized_label_id_file($external_node->{'normalized'},
$external_node->{'node_content'});
+ # undef if conversion is called through convert()
my $default_target_split = $self->get_conf('EXTERNAL_CROSSREF_SPLIT');
my $external_file_extension = '';
@@ -9511,8 +9513,17 @@ sub _external_node_href($$$;$)
$external_file_extension = '.' . $external_extension
if (defined($external_extension) and $external_extension ne '');
+ # initialize to $default_target_split
my $target_split;
- my $file;
+ if (defined($default_target_split) and $default_target_split) {
+ $target_split = 1;
+ } else {
+ $target_split = 0;
+ }
+ # used if !$target_split
+ my $file = '';
+ # used if $target_split
+ my $directory = '';
if ($external_node->{'manual_content'}) {
my $manual_name = Texinfo::Convert::Text::convert_to_text(
{'contents' => $external_node->{'manual_content'}},
@@ -9542,9 +9553,12 @@ sub _external_node_href($$$;$)
}
}
if (defined($split_found)) {
- $target_split = 1 unless ($split_found eq 'mono');
+ if ($split_found eq 'mono') {
+ $target_split = 0;
+ } else {
+ $target_split = 1;
+ }
} else { # nothing specified for that manual, use default
- $target_split = $default_target_split;
if ($self->get_conf('CHECK_HTMLXREF')) {
if (defined($source_command) and $source_command->{'source_info'}) {
my $node_manual_key = $source_command.'-'.$manual_name;
@@ -9568,20 +9582,20 @@ sub _external_node_href($$$;$)
if ($target_split) {
if (defined($href)) {
- $file = $href;
+ $directory = $href;
} else {
my $manual_dir = $manual_base;
if (defined($self->{'output_format'}) and $self->{'output_format'} ne
'') {
$manual_dir .= '_'.$self->{'output_format'};
}
if (defined($self->get_conf('EXTERNAL_DIR'))) {
- $file = $self->get_conf('EXTERNAL_DIR')."/$manual_dir";
+ $directory = $self->get_conf('EXTERNAL_DIR')."/$manual_dir";
} elsif ($self->get_conf('SPLIT')) {
- $file = "../$manual_dir";
+ $directory = "../$manual_dir";
}
- $file = $self->url_protect_file_text($file);
+ $directory = $self->url_protect_file_text($directory);
}
- $file .= "/";
+ $directory .= "/";
} else {# target not split
if (defined($href)) {
$file = $href;
@@ -9597,33 +9611,26 @@ sub _external_node_href($$$;$)
$file = $self->url_protect_file_text($file);
}
}
- } else {
- $file = '';
- $target_split = $default_target_split;
}
- if ($target eq '') {
- if ($target_split) {
- if (defined($self->get_conf('TOP_NODE_FILE_TARGET'))) {
- return $file . $self->get_conf('TOP_NODE_FILE_TARGET');
- } else {
- return $file;
- }
- } else {
- return $file . '#Top';
- }
- }
-
- if (! $target_split) {
- return $file . '#' . $target;
- } else {
+ if ($target_split) {
my $file_name;
- if ($target eq 'Top' and defined($self->get_conf('TOP_NODE_FILE_TARGET')))
{
+ if (($target eq 'Top' or $target eq '')
+ and defined($self->get_conf('TOP_NODE_FILE_TARGET'))) {
$file_name = $self->get_conf('TOP_NODE_FILE_TARGET');
} else {
$file_name = $target_filebase . $external_file_extension;
}
- return $file . $file_name . '#' . $target;
+ my $result = $directory . $file_name;
+ if ($target ne '') {
+ $result .= '#' . $target;
+ }
+ return $result;
+ } else {
+ if ($target eq '') {
+ $target = 'Top';
+ }
+ return $file . '#' . $target;
}
}
@@ -11988,8 +11995,6 @@ sub _set_variables_texi2html($)
'Top', 'Contents', 'Index', 'About' ]],
);
foreach my $option (@texi2html_options) {
- #no warnings 'once';
- #$defaults{$option->[0]} = $option->[1];
$options->{$option->[0]} = $option->[1];
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Convert/HTML.pm (_external_node_href): initialize explicitly $target_split. Use a different variable for the case of $target_split ($file) and !$target_split ($directory). Rearrange code returning the final href to have less conditions. If target is empty and TOP_NODE_FILE_TARGET is not set use the directory and target_filebase as in the other cases. This case probably never happens, though, as TOP_NODE_FILE_TARGET is always set.,
Patrice Dumas <=