texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Replace HTMLXREF by HTMLXREF_FILE and add HTMLXRE


From: Patrice Dumas
Subject: branch master updated: Replace HTMLXREF by HTMLXREF_FILE and add HTMLXREF_MODE
Date: Fri, 05 Aug 2022 05:52:53 -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 d375f36148 Replace HTMLXREF by HTMLXREF_FILE and add HTMLXREF_MODE
d375f36148 is described below

commit d375f36148631ada30b1fa8e27215d94a341c3a6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Aug 5 11:52:42 2022 +0200

    Replace HTMLXREF by HTMLXREF_FILE and add HTMLXREF_MODE
    
    * tp/Texinfo/Common.pm (@variable_string_settables),
    tp/Texinfo/Convert/HTML.pm (_parse_htmlxref_files), NEWS,
    infog/README, doc/texinfo.texi (HTML Customization Variables)
    (HTML Xref Configuration): add HTMLXREF_MODE.  Set to 'none'
    do not use of external information (useful for a collection of
    manuals), set to 'file' use the value of HTMLXREF_FILE, which
    could be useful for in source runs/tests.  HTMLXREF_FILE
    replaces HTMLXREF and is used even if TEST is not set.  If TEST
    is set and HTMLXREF_MODE is the default mode, HTMLXREF_FILE
    needs to be set to have some cross-reference information used.
---
 ChangeLog                  | 15 +++++++++
 NEWS                       |  1 +
 doc/texinfo.texi           | 30 +++++++++++++----
 infog/README               |  9 ++---
 tp/Texinfo/Common.pm       |  3 +-
 tp/Texinfo/Convert/HTML.pm | 83 ++++++++++++++++++++++++++++------------------
 tp/t/94htmlxref.t          | 12 +++----
 7 files changed, 101 insertions(+), 52 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8e124746ed..390283c1ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2022-08-05  Patrice Dumas  <pertusus@free.fr>
+
+       Replace HTMLXREF by HTMLXREF_FILE and add HTMLXREF_MODE
+
+       * tp/Texinfo/Common.pm (@variable_string_settables),
+       tp/Texinfo/Convert/HTML.pm (_parse_htmlxref_files), NEWS,
+       infog/README, doc/texinfo.texi (HTML Customization Variables)
+       (HTML Xref Configuration): add HTMLXREF_MODE.  Set to 'none'
+       do not use of external information (useful for a collection of
+       manuals), set to 'file' use the value of HTMLXREF_FILE, which
+       could be useful for in source runs/tests.  HTMLXREF_FILE
+       replaces HTMLXREF and is used even if TEST is not set.  If TEST
+       is set and HTMLXREF_MODE is the default mode, HTMLXREF_FILE
+       needs to be set to have some cross-reference information used.
+
 2022-08-04  Patrice Dumas  <pertusus@free.fr>
 
        Use HTMLXREF customization variable information only if TEST
diff --git a/NEWS b/NEWS
index 0b9f7793ee..33521a4823 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,7 @@ See the manual for detailed information.
      . remove PRE_ABOUT, AFTER_ABOUT, and add PROGRAM_NAME_IN_ABOUT
      . remove KEEP_TOP_EXTERNAL_REF
      . new variable CONVERT_TO_LATEX_IN_MATH
+     . add HTMLXREF_MODE and HTMLXREF_FILE
      . link to table of contents from short table of contents only if a
        table of contents is actually output
  . DocBook output:
diff --git a/doc/texinfo.texi b/doc/texinfo.texi
index 365011948c..5cd64c6e42 100644
--- a/doc/texinfo.texi
+++ b/doc/texinfo.texi
@@ -16538,12 +16538,25 @@ set to @samp{l2h}, which uses @command{latex2html}
 Use that string for the @code{<html>} HTML document root element.
 Default undefined.
 
-@c not documented, only relevant for tests
-@c @item HTMLXREF
-@c Does nothing unless @code{TEST} is set.  If @code{TEST} is set,
-@c set cross-references to other manuals information to be used and use
-@c the value instead of @file{htmlxref.cnf} for the file name
-@c (@pxref{HTML Xref Configuration}).
+@item HTMLXREF_FILE
+Set the file name used for cross-references to other manuals.  If
+not defined, @file{htmlxref.cnf} is used (@pxref{HTML Xref Configuration}).
+Not defined in the default case.  If @code{TEST} is set, @code{HTMLXREF_MODE}
+is set to the default and @code{HTMLXREF_FILE} is not defined, information on
+cross-references to other manuals is not used.
+
+If @code{HTMLXREF_MODE} is set to @samp{file} the file name is directly used
+as the source of information, otherwise the file name is searched for in
+directories, and all the files found are used (@pxref{HTML Xref
+Configuration}).
+
+@item HTMLXREF_MODE
+How cross-references to other manuals information is determined.
+If set to @samp{none}, no information is used.  If set to @samp{file},
+the information is determined from a file path, @file{htmlxref.cnf}
+in the default case, or the value of @code{HTMLXREF_FILE}.  If not defined
+(the default) or set to any other value, search in
+directories and use all the files (@pxref{HTML Xref Configuration}).
 
 @item ICONS
 Use icons for the navigation panel; default false.
@@ -18900,6 +18913,11 @@ The Texinfo distribution includes a default file which 
handles many
 GNU manuals; it is installed in the last of the above directories,
 i.e., @file{@var{datadir}/texinfo/htmlxref.cnf}.
 
+The @code{HTMLXREF_MODE} customization variable can be set to modify how the
+files are found.  For instance, if set to @samp{none}, no external information
+is used.  @code{HTMLXREF_FILE} sets the file name to something else than
+@file{htmlxref.cnf}.  @pxref{HTML Customization Variables}.
+
 The file is line-oriented.  Lines consisting only of whitespace are
 ignored.  Comments are indicated with a @samp{#} at the beginning of a
 line, optionally preceded by whitespace.  Since @samp{#} can occur in
diff --git a/infog/README b/infog/README
index 05578c7c07..c20c45471d 100644
--- a/infog/README
+++ b/infog/README
@@ -6,14 +6,9 @@ Then configure and make.
 
 Set INFO_HTML_DIR to the directory containing the documentation files.
 Each manual is in its own directory, named with the name of the manual.
-For links to work, create an empty file with "touch dummy" and create
-the manuals with e.g.
-
-texi2any -c HTMLXREF=dummy --html  --no-number-sections ../../../hello.texi
-
-The HTMLXREF option makes inter-manual links begin with "../".  (Texinfo 
-6.7 needed if indices are to be found.)
+For links to work, the htmlxref.cnf file should not be used.
 
+texi2any --html --no-number-sections -c HTMLXREF_MODE=none ../../../hello.texi
 
 Notes on architecture -
 
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 2ebab3ce6d..6d2cc15d6e 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -305,7 +305,8 @@ my @variable_string_settables = (
 'HEADER_IN_TABLE',
 'HTML_MATH',
 'HTML_ROOT_ELEMENT_ATTRIBUTES',
-'HTMLXREF',
+'HTMLXREF_FILE',
+'HTMLXREF_MODE',
 'ICONS',
 'IMAGE_LINK_PREFIX',
 'INDEX_ENTRY_COLON',
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index dc249718af..d7ccff9967 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -6627,45 +6627,64 @@ sub _parse_htmlxref_files($$)
 sub _load_htmlxref_files {
   my ($self) = @_;
 
-  my @htmlxref_dirs = ();
-  if ($self->get_conf('TEST')) {
-    my $curdir = File::Spec->curdir();
-    # to have reproducible tests, do not use system or user
-    # directories if TEST is set.
-    @htmlxref_dirs = File::Spec->catdir($curdir, '.texinfo');
-
-    if (defined($self->{'parser_info'})
-        and defined($self->{'parser_info'}->{'input_directory'})) {
-      my $input_directory = $self->{'parser_info'}->{'input_directory'};
-      if ($input_directory ne '.' and $input_directory ne '') {
-        unshift @htmlxref_dirs, $input_directory;
+  my $htmlxref_mode = $self->get_conf('HTMLXREF_MODE');
+  return if (defined($htmlxref_mode) and $htmlxref_mode eq 'none');
+  my $htmlxref_file_name = 'htmlxref.cnf';
+  if (defined($htmlxref_mode) and $htmlxref_mode eq 'file') {
+    if (defined($self->get_conf('HTMLXREF_FILE'))) {
+      $htmlxref_file_name = $self->get_conf('HTMLXREF_FILE');
+    }
+    my ($encoded_htmlxref_file_name, $htmlxref_file_encoding)
+      = $self->encoded_output_file_name($htmlxref_file_name);
+    if (-e $encoded_htmlxref_file_name and -r $encoded_htmlxref_file_name) {
+      $self->{'htmlxref_files'} = [$encoded_htmlxref_file_name];
+    } else {
+      $self->document_warn($self,
+        sprintf(__("could not find html refs config file %s"),
+          $htmlxref_file_name));
+    }
+  } else {
+    my @htmlxref_dirs = ();
+    if ($self->get_conf('TEST')) {
+      my $curdir = File::Spec->curdir();
+      # to have reproducible tests, do not use system or user
+      # directories if TEST is set.
+      @htmlxref_dirs = File::Spec->catdir($curdir, '.texinfo');
+
+      if (defined($self->{'parser_info'})
+          and defined($self->{'parser_info'}->{'input_directory'})) {
+        my $input_directory = $self->{'parser_info'}->{'input_directory'};
+        if ($input_directory ne '.' and $input_directory ne '') {
+          unshift @htmlxref_dirs, $input_directory;
+        }
       }
+    } elsif ($self->{'language_config_dirs'}
+             and @{$self->{'language_config_dirs'}}) {
+      @htmlxref_dirs = @{$self->{'language_config_dirs'}};
     }
-  } elsif ($self->{'language_config_dirs'}
-            and @{$self->{'language_config_dirs'}}) {
-    @htmlxref_dirs = @{$self->{'language_config_dirs'}};
-  }
-  unshift @htmlxref_dirs, '.';
+    unshift @htmlxref_dirs, '.';
 
-  my @texinfo_htmlxref_files;
-  my $htmlxref_file_name = 'htmlxref.cnf';
-  # no htmlxref for tests, unless explicitely specified with HTMLXREF
-  if ($self->get_conf('TEST')) {
-    if (defined($self->get_conf('HTMLXREF'))) {
-      $htmlxref_file_name = $self->get_conf('HTMLXREF');
-    } else {
-      $htmlxref_file_name = undef;
+    my @texinfo_htmlxref_files;
+    # no htmlxref for tests, unless explicitely specified
+    if ($self->get_conf('TEST')) {
+      if (defined($self->get_conf('HTMLXREF_FILE'))) {
+        $htmlxref_file_name = $self->get_conf('HTMLXREF_FILE');
+      } else {
+        $htmlxref_file_name = undef;
+      }
+    } elsif (defined($self->get_conf('HTMLXREF_FILE'))) {
+      $htmlxref_file_name = $self->get_conf('HTMLXREF_FILE');
     }
-  }
 
-  if (defined($htmlxref_file_name)) {
-    my ($encoded_htmlxref_file_name, $htmlxref_file_encoding)
-      = $self->encoded_output_file_name($htmlxref_file_name);
-    @texinfo_htmlxref_files
-      = Texinfo::Common::locate_init_file($encoded_htmlxref_file_name,
+    if (defined($htmlxref_file_name)) {
+      my ($encoded_htmlxref_file_name, $htmlxref_file_encoding)
+        = $self->encoded_output_file_name($htmlxref_file_name);
+      @texinfo_htmlxref_files
+        = Texinfo::Common::locate_init_file($encoded_htmlxref_file_name,
                                           \@htmlxref_dirs, 1);
+    }
+    $self->{'htmlxref_files'} = \@texinfo_htmlxref_files;
   }
-  $self->{'htmlxref_files'} = \@texinfo_htmlxref_files;
 
   $self->{'htmlxref'} = {};
   if (scalar(@{$self->{'htmlxref_files'}})) {
diff --git a/tp/t/94htmlxref.t b/tp/t/94htmlxref.t
index 19a0fbcd2e..2a28a29767 100644
--- a/tp/t/94htmlxref.t
+++ b/tp/t/94htmlxref.t
@@ -11,31 +11,31 @@ require 't/test_utils.pl';
 my @test_cases = (
 ['htmlxref',
   undef, {'test_file' => 'test_refs.texi' },
-  {'HTMLXREF' => 'htmlxref.cnf'}
+  {'HTMLXREF_FILE' => 'htmlxref.cnf'}
 ],
 ['htmlxref_nodes',
   undef, {'test_file' => 'test_refs.texi' },
-  {'HTMLXREF' => 'htmlxref.cnf',
+  {'HTMLXREF_FILE' => 'htmlxref.cnf',
    'SPLIT' => 'node',
    'USE_NODES' => 1, 'NODE_FILES' => 1}
 ],
 ['htmlxref_only_mono',
   undef, {'test_file' => 'test_refs.texi' },
-  {'HTMLXREF' => 'htmlxref-mono.cnf'}
+  {'HTMLXREF_FILE' => 'htmlxref-mono.cnf'}
 ],
 ['htmlxref_only_mono_nodes',
   undef, {'test_file' => 'test_refs.texi' },
-  {'HTMLXREF' => 'htmlxref-mono.cnf',
+  {'HTMLXREF_FILE' => 'htmlxref-mono.cnf',
    'SPLIT' => 'node',
    'USE_NODES' => 1, 'NODE_FILES' => 1}
 ],
 ['htmlxref_only_split',
   undef, {'test_file' => 'test_refs.texi' },
-  {'HTMLXREF' => 'htmlxref-split.cnf'}
+  {'HTMLXREF_FILE' => 'htmlxref-split.cnf'}
 ],
 ['htmlxref_only_split_nodes',
   undef, {'test_file' => 'test_refs.texi' },
-  {'HTMLXREF' => 'htmlxref-split.cnf',
+  {'HTMLXREF_FILE' => 'htmlxref-split.cnf',
    'SPLIT' => 'node',
    'USE_NODES' => 1, 'NODE_FILES' => 1}
 ],



reply via email to

[Prev in Thread] Current Thread [Next in Thread]