Generating faq/faq.body automatically from faq/faq.html whenever latter
is updated, using new bodysnatcher.pl script.
This commit is contained in:
parent
1f8b70e2a1
commit
32d9bab55e
@ -1,3 +1,9 @@
|
|||||||
|
2013-05-01 Warren Young <warren@etr-usa.com>
|
||||||
|
|
||||||
|
* bodysnatcher.pl: Created
|
||||||
|
* Makefile.in (faq/faq.body): Added target to create this file from
|
||||||
|
faq/faq.html using new bodysnatcher.pl script.
|
||||||
|
|
||||||
2013-05-01 Warren Young <warren@etr-usa.com>
|
2013-05-01 Warren Young <warren@etr-usa.com>
|
||||||
|
|
||||||
* cygwin-ug.xml: Renamed from cygwin-ug.in.sgml
|
* cygwin-ug.xml: Renamed from cygwin-ug.in.sgml
|
||||||
|
@ -24,13 +24,16 @@ include $(srcdir)/../Makefile.common
|
|||||||
|
|
||||||
FAQ_SOURCES:= faq*.xml
|
FAQ_SOURCES:= faq*.xml
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES: .html .body
|
||||||
|
|
||||||
|
.html.body:
|
||||||
|
$(srcdir)/bodysnatcher.pl $<
|
||||||
|
|
||||||
all: Makefile \
|
all: Makefile \
|
||||||
cygwin-ug-net/cygwin-ug-net.html \
|
cygwin-ug-net/cygwin-ug-net.html \
|
||||||
cygwin-ug-net/cygwin-ug-net-nochunks.html.gz \
|
cygwin-ug-net/cygwin-ug-net-nochunks.html.gz \
|
||||||
cygwin-api/cygwin-api.html \
|
cygwin-api/cygwin-api.html \
|
||||||
faq/faq.html \
|
faq/faq.body faq/faq.html \
|
||||||
cygwin-ug-net/cygwin-ug-net.pdf \
|
cygwin-ug-net/cygwin-ug-net.pdf \
|
||||||
cygwin-api/cygwin-api.pdf
|
cygwin-api/cygwin-api.pdf
|
||||||
|
|
||||||
|
44
winsup/doc/bodysnatcher.pl
Executable file
44
winsup/doc/bodysnatcher.pl
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
# Copyright © 2013 by Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# This file is part of Cygwin.
|
||||||
|
#
|
||||||
|
# This software is a copyrighted work licensed under the terms of the
|
||||||
|
# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||||
|
# details.
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
if (@ARGV) {
|
||||||
|
my $infile = $ARGV[0];
|
||||||
|
my $outfile = $infile;
|
||||||
|
$outfile =~ s/\.html$/.body/;
|
||||||
|
if ($infile ne $outfile) {
|
||||||
|
open my $input, '<', $infile or die "Failed to open $infile: $!\n";
|
||||||
|
my $html = do { local $/; <$input> }; # slurp!
|
||||||
|
my ($body) = $html =~ m|<body[^>]*>(.*)</body>|is;
|
||||||
|
if ($body) {
|
||||||
|
open my $output, '>', $outfile
|
||||||
|
or die "Failed to write $outfile: $!\n";
|
||||||
|
print $output $body;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print STDERR "Could not find <body> element in $infile!\n\n";
|
||||||
|
exit 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print STDERR "Input file name must end in .html!\n\n";
|
||||||
|
exit 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print STDERR <<USAGE;
|
||||||
|
usage: $0 <input.html>
|
||||||
|
|
||||||
|
Transforms input.html to input.body by extracting whatever is
|
||||||
|
between <body> and </body> in input.html.
|
||||||
|
|
||||||
|
USAGE
|
||||||
|
exit 1;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user