# HG changeset patch # User Rik # Date 1521653287 25200 # Node ID 13edbb760108c68980acef7e31ee10ba1e51c281 # Parent cc55705f1f84456da9dc677b8935c40c11fd6a87# Parent 23b5c067805165f9d2a75e812d7874330fb9cbb2 maint: merge stable to default. diff -r cc55705f1f84 -r 13edbb760108 doc/interpreter/mk_qthelp.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/interpreter/mk_qthelp.pl Wed Mar 21 10:28:07 2018 -0700 @@ -0,0 +1,196 @@ +#!/usr/bin/env perl + +################################################################################ +# File : mk_qthelp.pl +# Purpose : Transform Octave HTML documentation into intermediate formats +# for Qt Help Project (.qhp) and Qt Help Collection Project (.qhcp). +# Usage : mk_qthelp.pl input_htmldir output_filename +################################################################################ +use warnings; # report warnings for questionable run-time code +use strict qw(refs subs); # check at compile-time for bad programming style +use autodie; # issue an error and exit if any system call fails +use File::Basename; # For splitting paths between dir and file +use File::Spec; # For combining dirs and filenames into paths + +################################################################################ +# Extract command line arguments +if ($#ARGV != 1) +{ die "USAGE: %0 input_htmldir output_filename"; } + +$htmldir = basename ($ARGV[0]); +$basedir = File::Spec->rel2abs (dirname ($ARGV[1])); +$fname = File::Spec->catfile ($basedir, basename ($ARGV[1])); + +################################################################################ +# Parse index.html to retrieve the table of contents +$htmlfname = File::Spec->catfile ($basedir, $htmldir, "index.html"); +open (my $HTML, "<", $htmlfname) or die "Unable to open $htmlfname"; + +# Skip through preamble of file to find start of list +while (($_ = <$HTML>) !~ /^
/ ) {;} +while (($_ = <$HTML>) !~ /^