#! /usr/bin/perl # # $Id$ # Captive project doc macros. # Copyright (C) 2003 Jan Kratochvil # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; exactly version 2 of June 1991 is required # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package project::captive::doc::Macros; require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway our $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; }; our $CVS_ID=q$Id$; use strict; use warnings; use Exporter; our @EXPORT=qw( &doc_img &productname &captive_srcfile $freespeech $freebeer $Wine $ReactOS $LinuxNTFS $GnomeVFS $GnomeVFSmodule $gnulinux ); our @ISA=qw(Exporter); BEGIN{ open F,"Makefile"; our $top_dir=pop @{[split /\s/,(grep /^top_srcdir/,)[0]]}; eval "use lib '$top_dir'"; close F; } use My::Web; require CGI; Wrequire 'My::Project'; sub init ($%) { my($class,%args)=@_; %args=( "rel_start"=>top_dir("/project/captive/"), "rel_up"=>top_dir("/project/captive/doc/"), %args); My::Web->init( "head_css"=>" .productname { font-family: cursive; } .fname { font-family: monospace; } .constant { font-family: monospace; } .author { font-family: cursive; } .stuff { font-style: italic; font-size: larger; margin-left: 20%; margin-right: 10%; } .function { font-family: monospace; } .type { font-family: monospace; } .command { font-family: monospace; } .instruction { font-style: italic; } ", "WebConfig::heading_novskip"=>1, %args, ); My::Web->heading(); print My::Project->section("captive"); $class->navigate(); } sub footer ($) { my($class)=@_; print vskip "2ex"; project::captive::doc::Macros->navigate("footer"); My::Web->footer(); } sub navigate ($;$) { my($class,$where)=@_; print ''."\n"; print ''."\n" for (qw(10 20 40 20 10)); print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'; print a_href $My::Web::W->{"rel_prev"},img("/My/arrow-left" ,"Previous document") if $My::Web::W->{"rel_prev"}; print ''; print a_href $My::Web::W->{"rel_up"} ,img("/My/arrow-up" ,"Parent") if $My::Web::W->{"rel_up"} && !($where && $where eq "footer"); print ''; print a_href $My::Web::W->{"rel_next"},img("/My/arrow-right","Next document") if $My::Web::W->{"rel_next"}; print '
'."\n"; } sub doc_img ($$) { my($img_base,$caption)=@_; my $r=""; $r.=''."\n"; $r.="\t\n"; $r.="\t\n"; $r.='
".img($img_base,$caption)."
$caption
'."\n"; $r.=vskip "2ex"; return $r; } sub captive_srcfile ($;$) { my($filename,$text)=@_; a_href 'http://cvs.jankratochvil.net/viewcvs/*checkout*/priv/captive/'.$filename.'?rev=HEAD', ($text || $filename); } our $freespeech=a_href 'http://www.gnu.org/philosophy/free-sw.html','Free'; our $freebeer=a_href 'http://www.gnu.org/philosophy/free-sw.html','free (as in beer)'; sub productname { my($url,$name)=@_; return ''.a_href($url,CGI::escapeHTML($name)).''; } our $Wine=productname 'http://www.winehq.com/','Wine'; our $ReactOS=productname 'http://www.reactos.com/','ReactOS'; our $LinuxNTFS=productname 'http://linux-ntfs.sourceforge.net/','Linux NTFS'; our $GnomeVFS=productname 'http://developer.gnome.org/doc/API/gnome-vfs/','Gnome-VFS'; our $GnomeVFSmodule=productname 'http://developer.gnome.org/doc/API/gnome-vfs/modules.html','Gnome-VFS-module'; our $gnulinux='GNU/Linux'; 1;