c2c3e091fe4a462e853ec6a8b7549c8f6b0160be
[www.jankratochvil.net.git] / project / captive / doc / Macros.pm
1 #! /usr/bin/perl
2
3 # $Id$
4 # Captive project doc macros.
5 # Copyright (C) 2003 Jan Kratochvil <project-www.jankratochvil.net@jankratochvil.net>
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; exactly version 2 of June 1991 is required
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20
21 package project::captive::doc::Macros;
22 require 5.6.0;  # at least 'use warnings;' but we need some 5.6.0+ modules anyway
23 our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
24 our $CVS_ID=q$Id$;
25 use strict;
26 use warnings;
27
28 use Exporter;
29 our @EXPORT=qw(
30                 &doc_img &productname &captive_srcfile
31                 $doc_Macros_head_css $freespeech $freebeer $Wine $ReactOS $LinuxNTFS $GnomeVFS $GnomeVFSmodule $gnulinux
32                 );
33 our @ISA=qw(Exporter);
34
35 BEGIN{ open F,"Makefile"; our $top_dir=pop @{[split /\s/,(grep /^top_srcdir/,<F>)[0]]}; eval "use lib '$top_dir'"; close F; }
36 use My::Web;
37 require CGI;
38
39
40 our $doc_Macros_head_css="
41 .productname { font-family: cursive; }
42 .fname       { font-family: monospace; }
43 .constant    { font-family: monospace; }
44 .author      { font-family: cursive; }
45 .stuff       { font-style: italic; font-size: larger; margin-left: 20%; margin-right: 10%; }
46 .function    { font-family: monospace; }
47 .type        { font-family: monospace; }
48 .command     { font-family: monospace; }
49 .instruction { font-style: italic; }
50 ";
51
52
53 sub doc_img ($$)
54 {
55 my($img_base,$caption)=@_;
56
57         my $r="";
58         $r.='<table border="0" align="center">'."\n";
59                 $r.="\t<tr><td>".img($img_base,$caption)."</td></tr>\n";
60                 $r.="\t<caption>$caption</caption>\n";
61         $r.='</table>'."\n";
62         $r.=vskip "2ex";
63         return $r;
64 }
65
66 sub captive_srcfile ($;$)
67 {
68 my($filename,$text)=@_;
69
70         a_href 'http://cvs.jankratochvil.net/viewcvs/*checkout*/priv/captive/'.$filename.'?rev=HEAD',
71                         ($text || $filename);
72 }
73
74 our $freespeech=a_href 'http://www.gnu.org/philosophy/free-sw.html','Free';
75 our $freebeer=a_href 'http://www.gnu.org/philosophy/free-sw.html','free (as in beer)';
76
77 sub productname
78 {
79 my($url,$name)=@_;
80
81         return '<span class="productname">'.a_href($url,CGI::escapeHTML($name)).'</span>';
82 }
83 our $Wine=productname 'http://www.winehq.com/','Wine';
84 our $ReactOS=productname 'http://www.reactos.com/','ReactOS';
85 our $LinuxNTFS=productname 'http://linux-ntfs.sourceforge.net/','Linux NTFS';
86 our $GnomeVFS=productname 'http://developer.gnome.org/doc/API/gnome-vfs/','Gnome-VFS';
87 our $GnomeVFSmodule=productname 'http://developer.gnome.org/doc/API/gnome-vfs/modules.html','Gnome-VFS-module';
88 our $gnulinux='GNU/Linux';
89
90
91 1;