BibTeX Extension Example

From EPrints Documentation
Revision as of 13:22, 8 February 2010 by Pm705 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


This is an example for a rant on the How to contribute page.

package EPrints::Plugin::Export::BibTeXLocal;

use EPrints::Plugin::Export::BibTeX;

@ISA = ( "EPrints::Plugin::Export::BibTeX" );

use strict;

sub new
{
        my( $class, %params ) = @_;

        my $self = $class->SUPER::new(%params);
        # just override the name...       
        $self->{name} = "BibTeX (foo group format)";

        return $self;
}

sub convert_dataobj
{
        my( $plugin, $dataobj ) = @_;

        my $data = $plugin->SUPER::convert_dataobj($dataobj);

        # add the authorbio field if possible.
        if( $dataobj->exists_and_set( "authorbio" ) ) # just to be safe
        {
                $data->{bibtex}->{authorbio} = $dataobj->get_value( "authorbio" );
        }
        return $data;
}