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

[Xen-changelog] [xen master] docs/gen-html-index: Make HTML::TreeBuilder::XPath optional again



commit 16fb4b5a9a79f95df17f10ba62e9f44d21cf89b5
Author:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
AuthorDate: Fri Apr 13 14:55:27 2018 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Fri Apr 13 17:04:36 2018 +0100

    docs/gen-html-index: Make HTML::TreeBuilder::XPath optional again
    
    7782db9260d4 "docs/gen-html-index: Extract titles from HTML documents"
    requires HTML::TreeBuilder::XPath.
    
    This is sadly not as widely available as I had hoped.  Work around
    this problem by making the use of this module optional: instead of
    `use'ing at the toplevel, we `require' it in the eval.  If it's not
    present, then the title is simply not extracted and the filename is
    used as before, which is tolerable.
    
    Also add some debugging.
    
    Reported-by: Doug Goldstein <cardoe@xxxxxxxxxx>
    Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    Reviewed-by: Doug Goldstein <cardoe@xxxxxxxxxx>
    Tested-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
 docs/gen-html-index | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/docs/gen-html-index b/docs/gen-html-index
index 8258e2bf22..4fad6db974 100644
--- a/docs/gen-html-index
+++ b/docs/gen-html-index
@@ -10,7 +10,6 @@ use warnings;
 use Getopt::Long;
 use IO::File;
 use File::Basename;
-use HTML::TreeBuilder::XPath;
 
 Getopt::Long::Configure('bundling');
 
@@ -21,8 +20,10 @@ our @dirs;
 our %index;
 
 our $outdir;
+our $debug;
 
-GetOptions("i=s" => sub { read_index(@_);} )
+GetOptions("i=s" => sub { read_index(@_);},
+           "D" => \$debug)
     or die;
 
 ($outdir,@docs) = @ARGV;
@@ -68,6 +69,7 @@ sub make_linktext ($) {
 
     my $from_html;
     eval {
+        require HTML::TreeBuilder::XPath;
         my $tree = new HTML::TreeBuilder::XPath;
         my $f = "$outdir/$l.html";
         open F, '<', $f or die "$l $f $!";
@@ -75,6 +77,7 @@ sub make_linktext ($) {
         close F;
         $from_html = $tree->findvalue("/html/head/title");
     };
+    print "$l: get title: $@" if $@ && $debug;
     return $from_html if $from_html;
 
     return basename($l);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.