--- GenPDFLatex.pm.org 2007-11-15 11:19:28.000000000 +0100 +++ GenPDFLatex.pm 2008-01-31 03:27:49.000000000 +0100 @@ -307,5 +307,5 @@ my $optpg = &TWiki::Func::getPreferencesValue( "GENPDFLATEX_OPTIONSPAGE" ) || ""; - + $optpg =~ s/\s+$//; # this should not be needed, but apparently is :( my $text = ""; if ( $optpg ne "" ) { @@ -320,8 +320,22 @@ $optWeb = $webName if ($optWeb eq ""); - if (TWiki::UI::webExists( $optWeb, $optTopic ) ) { - + my $exists; + my $session; + if( $TWiki::Plugins::VERSION >= 1.1 ) { + $session = $TWiki::Plugins::SESSION; + $exists = $session->{store}->topicExists( $optWeb, $optTopic ); + } else { + $exists = TWiki::UI::webExists( $optWeb, $optTopic ); + } + if ($exists) { my $skin = "plain"; # $query->param( "skin" ); - my $tmpl = &TWiki::Store::readTemplate( "view", $skin ); + my $tmpl; + if( $TWiki::Plugins::VERSION >= 1.2 ) { + $tmpl = $session->templates->readTemplate( 'view', $skin ); + } elsif( $TWiki::Plugins::VERSION >= 1.1 ) { + $tmpl = $session->{templates}->readTemplate( 'view', $skin ); + } else { + $tmpl = &TWiki::Store::readTemplate( "view", $skin ); + } $text = TWiki::Func::readTopicText($optWeb, $optTopic, undef ); @@ -457,5 +471,5 @@ my $tmpl; if( $TWiki::Plugins::VERSION >= 1.1 ) { - # Dakar interface + # Dakar interface or better my $session = $TWiki::Plugins::SESSION; my $store = $session->{store}; @@ -463,5 +477,9 @@ return unless ( $store->topicExists( $webName, $topic ) ); - my $tmpl = $session->{templates}->readTemplate( 'view', $skin ); + if( $TWiki::Plugins::VERSION >= 1.2 ) { + $tmpl = $session->templates->readTemplate( 'view', $skin ); + } else { + $tmpl = $session->{templates}->readTemplate( 'view', $skin ); + } } else { return unless TWiki::UI::webExists( $webName, $topic ); @@ -589,5 +607,6 @@ # SMELL: there must be a better way to do this. if ( ($tex =~ m/\\textcolor/) and - !($tex =~ m/includepackage\{color\}/) ) { + !($tex =~ m/\\usepackage(\[[^\]]*\])?\{x?color\}/) and + !($tex =~ m/\\includepackage(\[[^\]]*\])?\{x?color\}/) ) { $tex =~ s!(\\begin\{document\})!\\usepackage{color}\n$1!; }