Commit df5d8a11 authored by Andy Yates's avatar Andy Yates
Browse files

Moved the filters around and made ensembldoxygenfilter.pl a standalone script...

Moved the filters around and made ensembldoxygenfilter.pl a standalone script to avoid having to edit the Doxygen PerlFilter installation which was our only original way of doing this. Namespacing also means dependency management is easier with less to level packages getting in the way
parent bda77b92
......@@ -29,6 +29,9 @@
# Revision History:
#
# $Log$
# Revision 1.1 2011-10-18 13:46:34 kt7
# Transferring Doxygen filter into EnsEMBL CVS.
#
# Revision 1.1 2011-05-16 15:31:44 kt7
# Preservative backup of all code required to run Doxygen to
# generate API reference.
......@@ -40,18 +43,23 @@
# =======================================================================
## @file
# implementation of DoxyGen::Filter.
# implementation of Filter as derrived from Doxygen::Filter.
## @class
# Filter from non-C++ syntax API docs to Doxygen-compatible syntax.
# This class is meant to be used as a filter for the
# <a href="http://www.doxygen.org/">Doxygen</a> documentation tool.
package DoxyGen::Filter;
package EnsEMBL::Filter;
use warnings;
use strict;
my $debug_home_location = '';
if($ENV{PERL_DOXYGEN_DEBUG_LOCATION}) {
$debug_home_location = $ENV{PERL_DOXYGEN_DEBUG_LOCATION};
}
## @cmethod object new($outfh)
# create a filter object.
# @param outfh optional output filehandle; defaults to STDOUT
......@@ -60,9 +68,20 @@ sub new {
my $class = shift;
my $outfh = shift || \*STDOUT;
open(DEBUG,">/home/ktaylor/debug.doxygen");
my $self = bless {outfh => $outfh}, $class;
if($debug_home_location) {
open(my $debug, '>', $debug_home_location);
$self->{debug_fh} = $debug;
}
return bless {outfh => $outfh}, $class;
return $self;
}
sub DESTROY {
my ($self) = @_;
close $self->{debug_fh} if $self->{debug_fh};
return;
}
## @method virtual void filter($infh)=0
......@@ -141,7 +160,8 @@ sub print {
} else {
my $outfh = $self->{outfh};
print $outfh @_;
print DEBUG @_;
my $debug_fh = $self->{debug_fh};
print $debug_fh @_ if $debug_fh;
}
return $self;
}
......@@ -199,7 +219,7 @@ __END__
=head1 NAME
Doxygen::Filter - use DoxyGen with Perl and other languages.
EnsEMBL::Filter - use DoxyGen with Perl and other languages.
=head1 DESCRIPTION
......
......@@ -21,7 +21,7 @@
1735 Giffers
------------------------------------------------
This completely rewritten version of PerlFilter
This completely rewritten version of Doxygen::PerlFilter
Copyright (c) 1999-2012 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
......@@ -42,11 +42,11 @@
=head1 NAME
Doxygen::PerlFilter
EnsEMBL::PerlFilter
=head1 DESCRIPTION
Implementation of DoxyGen::PerlFilter.
Implementation of EnsEMBL::PerlFilter.
Derived from http://www.bigsister.ch/doxygenfilter by Bart Schuller and Thomas Aeby
Original distributed under Perl artistic license, see: http://www.bigsister.ch/doxygenfilter/license.html
......@@ -58,17 +58,15 @@
This is a 80/20 EnsEMBL specific POD->Doxygen converter, however it should work somewhat with other code.
This code is still highly volatile.
Presently this code is installed in conjunction with Doxygen::Filter such that Doxygen can find them both.
e.g. /usr/share/perl5/Doxygen/
=cut
package DoxyGen::PerlFilter;
package EnsEMBL::PerlFilter;
use warnings;
use strict;
use base qw(DoxyGen::Filter);
use base qw(EnsEMBL::Filter);
# Possible states
use constant {
......
#!/usr/bin/env perl
use warnings;
use strict;
sub BEGIN {
use FindBin qw/$Bin/;
use lib $Bin;
use EnsEMBL::PerlFilter;
}
use Getopt::Long;
use Pod::Usage;
my $opts = {
help => 0,
verbose => 0
};
GetOptions( $opts, qw/verbose help/) or pod2usage(-msg => 'Error during command line parsing', -exitlevel => 1, -verbose => 1);
pod2usage(-exitlevel => 0, -verbose => 2) if $opts->{help};
my $file = $ARGV[0];
pod2usage(-msg => 'No file given', -exitlevel => 1, -verbose => 1) if ! $file;
pod2usage(-msg => 'File '.$file.' does not exist', -exitlevel => 1, -verbose => 1) if ! -f $file;
my ($ext) = lc($ARGV[0]) =~ /\.([a-z]+)$/;
if( $ext eq 'pl' || $ext eq 'pm' || $ext eq 'perl' ) {
print STDERR "Working with a Perl file\n" if $opts->{verbose};
my $filter = EnsEMBL::PerlFilter->new(\*STDOUT);
$filter->filter($file);
}
else {
print STDERR "Passing file through\n" if $opts->{verbose};
print <>;
}
exit 0;
__END__
=pod
=head1 NAME
ensembldoxygenfilter.pl
=head1 SYNOPSIS
./ensembldoxygenfilter.pl -v modules/Bio/EnsEMBL/Registry.pm
./ensembldoxygenfilter.pl -help
=head1 DESCRIPTION
Generate Doxygen compatible filtered files from Ensembl POD. Bring this onto
your PATH and edit your Doxygen configuration file and specify
INPUT_FILTER=ensembldoxygenfilter.pl
The code has been flagged as executable in the
=head1 OPTIONS
=over 8
=item B<--verbose>
Prints messages to STDERR
=item B<--help>
Prints this message
=back
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment