texinfo-commits
[Top][All Lists]
Advanced

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

[7033] htmlxref tests conf value to get htmlxref.cnf


From: Gavin D. Smith
Subject: [7033] htmlxref tests conf value to get htmlxref.cnf
Date: Sat, 27 Feb 2016 15:36:25 +0000

Revision: 7033
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7033
Author:   gavin
Date:     2016-02-27 15:31:55 +0000 (Sat, 27 Feb 2016)
Log Message:
-----------
htmlxref tests conf value to get htmlxref.cnf

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/MANIFEST
    trunk/tp/Texinfo/Common.pm
    trunk/tp/Texinfo/Convert/HTML.pm
    trunk/tp/tests/Makefile.am
    trunk/tp/tests/README
    trunk/tp/tests/htmlxref/res_parser/htmlxref/test_refs.2
    trunk/tp/tests/htmlxref/res_parser/htmlxref_nodes/test_refs.2
    trunk/tp/tests/htmlxref/tests-parser.txt
    trunk/tp/tests/htmlxref-only_mono/tests-parser.txt
    trunk/tp/tests/htmlxref-only_split/tests-parser.txt
    trunk/tp/texi2any.pl

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/ChangeLog     2016-02-27 15:31:55 UTC (rev 7033)
@@ -1,5 +1,25 @@
 2016-02-27  Gavin Smith  <address@hidden>
 
+       * tp/Texinfo/Common.pm (HTMLXREF): New customization variable.
+       * tp/texi2any.pl: If HTMLXREF given on the command line, use it 
+       as the location of the htmlxref.cnf file.
+
+       * tp/Texinfo/Common.pm (parse_htmlxref_files): Move function to 
+       tp/Texinfo/Convert/HTML.pm.
+
+       * tp/tests/htmlxref/tests-parser.txt,
+       * tp/tests/htmlxref-only_mono/tests-parser.txt,
+       * tp/tests/htmlxref-only_split/tests-parser.txt:
+       Set HTMLXREF customization variable.
+
+       * tp/tests/htmlxref/Makefile.am:
+       tp/tests/Makefile.am: Don't build in htmlxref, htmlxref-only_mono,
+       htmlxref-only_split directories using a recursive make.  Run the 
+       tests in those directories the same way that all of the others 
+       are, except many_input_files.
+
+2016-02-27  Gavin Smith  <address@hidden>
+
        * info/info-utils.c (info_get_menu_entry_by_label): Always check 
        case-insensitively, so that manpages are not preferred to a 
        case-insensitive dir match when invoking.  Problem reported by 

Modified: trunk/tp/MANIFEST
===================================================================
--- trunk/tp/MANIFEST   2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/MANIFEST   2016-02-27 15:31:55 UTC (rev 7033)
@@ -1308,9 +1308,7 @@
 t/results/sectioning/sectioning_part_appendix_no_top.pl
 t/results/sectioning/sections.pl
 t/results/sectioning/semi_auto.pl
-t/results/sectioning/setcontentsaftertitlepage.pl
 t/results/sectioning/setfilename_on_top_and_after_node.pl
-t/results/sectioning/setshortcontentsaftertitlepage.pl
 t/results/sectioning/shortcontents.pl
 t/results/sectioning/space_in_node.pl
 t/results/sectioning/top_chapter_sections.pl

Modified: trunk/tp/Texinfo/Common.pm
===================================================================
--- trunk/tp/Texinfo/Common.pm  2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/Texinfo/Common.pm  2016-02-27 15:31:55 UTC (rev 7033)
@@ -263,7 +263,8 @@
   'MACRO_BODY_IGNORES_LEADING_SPACE', 'CHECK_HTMLXREF',
   'TEXINFO_DTD_VERSION', 'TEXINFO_COLUMN_FOR_DESCRIPTION',
   'TEXINFO_OUTPUT_FORMAT', 'INFO_SPECIAL_CHARS_WARNING',
-  'INDEX_SPECIAL_CHARS_WARNING', 'INFO_SPECIAL_CHARS_QUOTE'
+  'INDEX_SPECIAL_CHARS_WARNING', 'INFO_SPECIAL_CHARS_QUOTE',
+  'HTMLXREF'
 );
 # Not strings. 
 # FIXME To be documented somewhere, but where?
@@ -1505,78 +1506,6 @@
   return 1;
 }
 
-our %htmlxref_entries = (
- 'node' => [ 'node', 'section', 'chapter', 'mono' ],
- 'section' => [ 'section', 'chapter','node', 'mono' ],
- 'chapter' => [ 'chapter', 'section', 'node', 'mono' ],
- 'mono' => [ 'mono', 'chapter', 'section', 'node' ],
-);
-
-sub parse_htmlxref_files($$)
-{
-  my $self = shift;
-  my $files = shift;
-  my $htmlxref;
-
-  foreach my $file (@$files) {
-    print STDERR "html refs config file: $file\n" if 
($self->get_conf('DEBUG'));
-    unless (open (HTMLXREF, $file)) {
-      $self->document_warn(
-        sprintf($self->__("could not open html refs config file %s: %s"),
-          $file, $!));
-      next;
-    }
-    my $line_nr = 0;
-    my %variables;
-    while (my $hline = <HTMLXREF>) {
-      my $line = $hline;
-      $line_nr++;
-      next if $hline =~ /^\s*#/;
-      #$hline =~ s/[#]\s.*//;
-      $hline =~ s/^\s*//;
-      next if $hline =~ /^\s*$/;
-      chomp ($hline);
-      if ($hline =~ s/^\s*(\w+)\s*=\s*//) {
-        # handle variables
-        my $var = $1;
-        my $re = join '|', map { quotemeta $_ } keys %variables;
-        $hline =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1} 
-                                                       : "\${$1}"/ge;
-        $variables{$var} = $hline;
-        next;
-      }
-      my @htmlxref = split /\s+/, $hline;
-      my $manual = shift @htmlxref;
-      my $split_or_mono = shift @htmlxref;
-      #print STDERR "$split_or_mono 
$Texi2HTML::Config::htmlxref_entries{$split_or_mono} $line_nr\n";
-      if (!defined($split_or_mono)) {
-        $self->file_line_warn($self->__("missing type"), $file, $line_nr);
-        next;
-      } elsif (!defined($htmlxref_entries{$split_or_mono})) {
-        $self->file_line_warn(sprintf($self->__("unrecognized type: %s"), 
-                               $split_or_mono), $file, $line_nr);
-        next;
-      }
-      my $href = shift @htmlxref;
-      next if (exists($htmlxref->{$manual}->{$split_or_mono}));
-
-      if (defined($href)) { # substitute 'variables'
-        my $re = join '|', map { quotemeta $_ } keys %variables;
-        $href =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1} 
-                                                      : "\${$1}"/ge;
-        $href =~ s/\/*$// if ($split_or_mono ne 'mono');
-      }
-      $htmlxref->{$manual}->{$split_or_mono} = $href;
-    }
-    if (!close (HTMLXREF)) {
-      $self->document_warn(sprintf($self->__(
-                       "error on closing html refs config file %s: %s"),
-                             $file, $!));
-    }
-  }
-  return $htmlxref;
-}
-
 sub parse_renamed_nodes_file($$;$$)
 {
   my $self = shift;

Modified: trunk/tp/Texinfo/Convert/HTML.pm
===================================================================
--- trunk/tp/Texinfo/Convert/HTML.pm    2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/Texinfo/Convert/HTML.pm    2016-02-27 15:31:55 UTC (rev 7033)
@@ -4584,6 +4584,78 @@
   }
 }
 
+my %htmlxref_entries = (
+ 'node' => [ 'node', 'section', 'chapter', 'mono' ],
+ 'section' => [ 'section', 'chapter','node', 'mono' ],
+ 'chapter' => [ 'chapter', 'section', 'node', 'mono' ],
+ 'mono' => [ 'mono', 'chapter', 'section', 'node' ],
+);
+
+sub _parse_htmlxref_files($$)
+{
+  my $self = shift;
+  my $files = shift;
+  my $htmlxref;
+
+  foreach my $file (@$files) {
+    print STDERR "html refs config file: $file\n" if 
($self->get_conf('DEBUG'));
+    unless (open (HTMLXREF, $file)) {
+      $self->document_warn(
+        sprintf($self->__("could not open html refs config file %s: %s"),
+          $file, $!));
+      next;
+    }
+    my $line_nr = 0;
+    my %variables;
+    while (my $hline = <HTMLXREF>) {
+      my $line = $hline;
+      $line_nr++;
+      next if $hline =~ /^\s*#/;
+      #$hline =~ s/[#]\s.*//;
+      $hline =~ s/^\s*//;
+      next if $hline =~ /^\s*$/;
+      chomp ($hline);
+      if ($hline =~ s/^\s*(\w+)\s*=\s*//) {
+        # handle variables
+        my $var = $1;
+        my $re = join '|', map { quotemeta $_ } keys %variables;
+        $hline =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1} 
+                                                       : "\${$1}"/ge;
+        $variables{$var} = $hline;
+        next;
+      }
+      my @htmlxref = split /\s+/, $hline;
+      my $manual = shift @htmlxref;
+      my $split_or_mono = shift @htmlxref;
+      #print STDERR "$split_or_mono 
$Texi2HTML::Config::htmlxref_entries{$split_or_mono} $line_nr\n";
+      if (!defined($split_or_mono)) {
+        $self->file_line_warn($self->__("missing type"), $file, $line_nr);
+        next;
+      } elsif (!defined($htmlxref_entries{$split_or_mono})) {
+        $self->file_line_warn(sprintf($self->__("unrecognized type: %s"), 
+                               $split_or_mono), $file, $line_nr);
+        next;
+      }
+      my $href = shift @htmlxref;
+      next if (exists($htmlxref->{$manual}->{$split_or_mono}));
+
+      if (defined($href)) { # substitute 'variables'
+        my $re = join '|', map { quotemeta $_ } keys %variables;
+        $href =~ s/\$\{($re)\}/defined $variables{$1} ? $variables{$1} 
+                                                      : "\${$1}"/ge;
+        $href =~ s/\/*$// if ($split_or_mono ne 'mono');
+      }
+      $htmlxref->{$manual}->{$split_or_mono} = $href;
+    }
+    if (!close (HTMLXREF)) {
+      $self->document_warn(sprintf($self->__(
+                       "error on closing html refs config file %s: %s"),
+                             $file, $!));
+    }
+  }
+  return $htmlxref;
+}
+
 sub converter_initialize($)
 {
   my $self = shift;
@@ -4600,8 +4672,8 @@
 
   $self->{'htmlxref'} = {};
   if ($self->{'htmlxref_files'}) {
-    $self->{'htmlxref'} = Texinfo::Common::parse_htmlxref_files($self, 
-                                                  $self->{'htmlxref_files'});
+    $self->{'htmlxref'} = _parse_htmlxref_files($self,
+                                                $self->{'htmlxref_files'});
   }
 
   foreach my $type (keys(%default_types_conversion)) {
@@ -5722,8 +5794,6 @@
   return $self->{'htmlxref'}->{$file};
 }
 
-my %htmlxref_entries = %Texinfo::Common::htmlxref_entries;
-
 sub _external_node_href($$$$)
 {
   my $self = shift;

Modified: trunk/tp/tests/Makefile.am
===================================================================
--- trunk/tp/tests/Makefile.am  2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/tests/Makefile.am  2016-02-27 15:31:55 UTC (rev 7033)
@@ -1,6 +1,6 @@
 # $Id$
 # Makefile.am for texinfo/tp/tests.
-# Copyright 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
+# Copyright 2012, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.
 #
 # This file is free software; as a special exception the author gives
 # unlimited permission to copy and/or distribute it, with or without
@@ -22,18 +22,15 @@
          -long '$(long_tests)' \
          -tex_html '$(tex_html_tests)'
 
-base_tests = formatting 
+base_tests = formatting htmlxref htmlxref-only_mono htmlxref-only_split
 long_tests = sectioning coverage indices nested_formats contents layout
 tex_html_tests = tex_html
 
-test_subdirs = htmlxref htmlxref-only_mono htmlxref-only_split
+DIST_SUBDIRS = many_input_files $(base_tests) $(long_tests) $(tex_html_tests)
+SUBDIRS = . many_input_files
 
-DIST_SUBDIRS = many_input_files $(test_subdirs) $(base_tests) $(long_tests) 
$(tex_html_tests)
-SUBDIRS = . many_input_files $(test_subdirs)
-
 copy-tests: copy-base copy-long
        cd many_input_files && $(MAKE) copy-tests
-       for dir in $(test_subdirs); do (cd $$dir && $(MAKE) copy-tests); done
 
 copy-base:
        $(srcdir)/parser_tests.sh -copy $(base_tests)

Modified: trunk/tp/tests/README
===================================================================
--- trunk/tp/tests/README       2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/tests/README       2016-02-27 15:31:55 UTC (rev 7033)
@@ -164,17 +164,7 @@
 ----------
 Init files are searched for in ../t/init/.
 
-Subdirectories
---------------
 
-There are three subdirectories containing tests, each of which is 
-organized like this one: htmlxref, htmlxref-only_mono and htmlxref-only_split.
-These groups of tests are in their own subdirectorie so they can use 
-their own htmlxref.cnf init file (which is copied to the build dir in 
-tests/Makefile.am).  In htmlxref-only_split, using a .texinfo directory 
-is tested.
-
-
 Creating a new test
 ===================
 - choose the subdir here for the new test.  Each subdir only generates

Modified: trunk/tp/tests/htmlxref/res_parser/htmlxref/test_refs.2
===================================================================
--- trunk/tp/tests/htmlxref/res_parser/htmlxref/test_refs.2     2016-02-27 
10:26:28 UTC (rev 7032)
+++ trunk/tp/tests/htmlxref/res_parser/htmlxref/test_refs.2     2016-02-27 
15:31:55 UTC (rev 7033)
@@ -1,2 +1,2 @@
-./htmlxref.cnf:15: warning: unrecognized type: foo
-./htmlxref.cnf:16: warning: missing type
+./htmlxref/htmlxref.cnf:15: warning: unrecognized type: foo
+./htmlxref/htmlxref.cnf:16: warning: missing type

Modified: trunk/tp/tests/htmlxref/res_parser/htmlxref_nodes/test_refs.2
===================================================================
--- trunk/tp/tests/htmlxref/res_parser/htmlxref_nodes/test_refs.2       
2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/tests/htmlxref/res_parser/htmlxref_nodes/test_refs.2       
2016-02-27 15:31:55 UTC (rev 7033)
@@ -1,2 +1,2 @@
-./htmlxref.cnf:15: warning: unrecognized type: foo
-./htmlxref.cnf:16: warning: missing type
+./htmlxref/htmlxref.cnf:15: warning: unrecognized type: foo
+./htmlxref/htmlxref.cnf:16: warning: missing type

Modified: trunk/tp/tests/htmlxref/tests-parser.txt
===================================================================
--- trunk/tp/tests/htmlxref/tests-parser.txt    2016-02-27 10:26:28 UTC (rev 
7032)
+++ trunk/tp/tests/htmlxref/tests-parser.txt    2016-02-27 15:31:55 UTC (rev 
7033)
@@ -1,2 +1,3 @@
-htmlxref ../sectioning/test_refs.texi --set-customization-variable 
CHECK_HTMLXREF
-htmlxref_nodes ../sectioning/test_refs.texi --split node 
--set-customization-variable 'USE_NODES 1' --node-files
+htmlxref ../sectioning/test_refs.texi --set-customization-variable 
CHECK_HTMLXREF -c HTMLXREF=htmlxref.cnf-ref --set-customization-variable 
'HTMLXREF=htmlxref/htmlxref.cnf'
+
+htmlxref_nodes ../sectioning/test_refs.texi --split node 
--set-customization-variable 'USE_NODES 1' --node-files 
--set-customization-variable 'HTMLXREF=htmlxref/htmlxref.cnf'

Modified: trunk/tp/tests/htmlxref-only_mono/tests-parser.txt
===================================================================
--- trunk/tp/tests/htmlxref-only_mono/tests-parser.txt  2016-02-27 10:26:28 UTC 
(rev 7032)
+++ trunk/tp/tests/htmlxref-only_mono/tests-parser.txt  2016-02-27 15:31:55 UTC 
(rev 7033)
@@ -1,2 +1,2 @@
-htmlxref ../sectioning/test_refs.texi
-htmlxref_nodes ../sectioning/test_refs.texi --split node 
--set-customization-variable 'USE_NODES 1' --node-files
+htmlxref ../sectioning/test_refs.texi -c 
HTMLXREF=htmlxref-only_mono/htmlxref.cnf
+htmlxref_nodes ../sectioning/test_refs.texi --split node 
--set-customization-variable 'USE_NODES 1' --node-files -c 
HTMLXREF=htmlxref-only_mono/htmlxref.cnf

Modified: trunk/tp/tests/htmlxref-only_split/tests-parser.txt
===================================================================
--- trunk/tp/tests/htmlxref-only_split/tests-parser.txt 2016-02-27 10:26:28 UTC 
(rev 7032)
+++ trunk/tp/tests/htmlxref-only_split/tests-parser.txt 2016-02-27 15:31:55 UTC 
(rev 7033)
@@ -1,2 +1,2 @@
-htmlxref ../sectioning/test_refs.texi
-htmlxref_nodes ../sectioning/test_refs.texi --split node 
--set-customization-variable 'USE_NODES 1' --node-files
+htmlxref ../sectioning/test_refs.texi -c 
HTMLXREF=htmlxref-only_split/htmlxref.cnf
+htmlxref_nodes ../sectioning/test_refs.texi --split node 
--set-customization-variable 'USE_NODES 1' --node-files -c 
HTMLXREF=htmlxref-only_split/htmlxref.cnf

Modified: trunk/tp/texi2any.pl
===================================================================
--- trunk/tp/texi2any.pl        2016-02-27 10:26:28 UTC (rev 7032)
+++ trunk/tp/texi2any.pl        2016-02-27 15:31:55 UTC (rev 7033)
@@ -1194,8 +1194,15 @@
     unshift @htmlxref_dirs, $input_directory;
   }
   unshift @htmlxref_dirs, '.';
-  my @texinfo_htmlxref_files 
+
+  my @texinfo_htmlxref_files;
+  my $init_file_from_conf = get_conf('HTMLXREF');
+  if ($init_file_from_conf) {
+    @texinfo_htmlxref_files = ( $init_file_from_conf );
+  } else {
+    @texinfo_htmlxref_files 
       = locate_init_file ($texinfo_htmlxref, address@hidden, 1);
+  }
 
   my $parser_options = { %$parser_default_options };
 




reply via email to

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