3 This is part of the YARRG website. YARRG is a tool and website
4 for assisting players of Yohoho Puzzle Pirates.
6 Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
7 Copyright (C) 2009 Clare Boothby
9 YARRG's client code etc. is covered by the ordinary GNU GPL (v3 or later).
10 The YARRG website is covered by the GNU Affero GPL v3 or later, which
11 basically means that every installation of the website will let you
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Affero General Public License as
16 published by the Free Software Foundation, either version 3 of the
17 License, or (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU Affero General Public License for more details.
24 You should have received a copy of the GNU Affero General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
27 Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
28 are used without permission. This program is not endorsed or
29 sponsored by Three Rings.
32 This Mason autohandler contains the doctype, charset and
40 my $printable= printable($m);
41 if ($printable =~ m/^pdf|^ps/) {
43 my $got= $m->call_self(\$output);
45 my @htargs= qw(htmldoc --continuous --gray --size 210x279mm
46 --left 1cm --right 1cm);
47 $printable =~ m/^[a-z]+/;
48 push @htargs, '-t',$&;
49 if ($printable =~ m/2$/) {
50 push @htargs, qw(--nup 2);
54 my $tmpfile= IO::File::new_tmpfile();
55 print $tmpfile $output or die $!;
56 $tmpfile->flush() or die $!;
57 seek $tmpfile,0,0 or die $!;
58 my $htmldoc= open HTMLDOC, "-|";
59 defined $htmldoc or die $!;
62 $ENV{'HTMLDOC_NOCGI'}=1;
63 open STDIN, '<&', $tmpfile or die $!;
68 print STDERR "HTMLDOC FAILURE $@";
72 $r->content_type($printable eq 'pdf' ? 'application/pdf' :
73 'application/postscript');
74 while ($read= read HTMLDOC,$data,32768) { print $data; }
75 defined $read or die $!;
76 $?=0; $!=0; close HTMLDOC or die "$! $? $output ";
81 $r->content_type('text/html; charset=UTF-8');
83 </%perl><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
85 This HTML is generated by the YARRG website, which is
88 The YARRG website is Free Software and licenced according to the
89 GNU Affero General Public Licence (v3 or later). See the link at
90 the bottom of this page for full licence and copyright
93 Many YARRG web pages also display data from the YARRG database,
94 which contains mostly contributions from YARRG users and is not