Difference between revisions of "BibTeX Extension Example"

From EPrints Documentation
Jump to: navigation, search
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
[[Category:Contribute]]
 +
[[Category:Plugins]]
 +
 
This is an example for a rant on the [[How to contribute]] page.
 
This is an example for a rant on the [[How to contribute]] page.
 
<pre><nowiki>
 
<pre><nowiki>
 
 
package EPrints::Plugin::Export::BibTeXLocal;
 
package EPrints::Plugin::Export::BibTeXLocal;
  

Latest revision as of 13:22, 8 February 2010


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;
}