#!/usr/bin/perl -wT -I.
#
# TWiki WikiClone (see $wikiversion in wiki.pm for version)
#
# Based on parts of Ward Cunninghams original Wiki and JosWiki.
# Copyright (C) 1998 Markus Peter - SPiN GmbH (warpi@spin.de)
# Some changes by Dave Harris (drh@bhresearch.co.uk) incorporated
# Copyright (C) 1999 Peter Thoeny, peter.thoeny@takefive.com , 
# TakeFive Software Inc.
#
# 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; either version 2
# of the License, or (at your option) any later version.
#
# 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, published at 
# http://www.gnu.ai.mit.edu/copyleft/gpl.html 

#FB cache
# this is the old view command

use wiki;

&main();

sub main
{
    my ($thePathInfo, $theTopic) = @ARGV;
		
		undef %wiki::dependences;
# the functions &wiki::initialize, 
#  &wiki::handleCommonTags, &wiki::getRenderedVersion
# must update @dependences
# or put "FORCE" if not cachable
# and based on them the new makefile is created

    ( $topic, $webName, $scriptUrlPath) = 
	&wiki::initialize( $thePathInfo, "", $theTopic);
	
    #this is the old stuff for the text part

    my $topicExists = &wiki::topicExists( $webName, $topic );
	  my $text= &wiki::readTopic( $topic );

    $text = &wiki::handleCommonTags( $text, $topic );
    $text = &wiki::getRenderedVersion( $text );
		&wiki::makemake($webName,$topic,$thePathInfo, $theTopic);

    print $text;
}
