Biblio::Citation::Parser 1.10 Documentation - How-To Guides

HOW TO: Modify Templates in Biblio::Citation::Parser::Standard

Adding new templates to the Standard parser is relatively easy:

The file should contain a structure similar to this:

 $Biblio::Citation::Parser::Templates::templates = [

Each template is a string containing a set of placeholders. For example, '_AUTHORS_ (_YEAR_) _TITLE_' can match 'Jewell, M (2002) Title'. The following are valid field names:

Matches anything.

Matches the first name of an author.

Matches the last name of an author.

Matches a list of authors.

Matches a capitalised publication title (e.g. ``Journal of Lemurs'').

Matches a capitalised title.

Matches a chapter number.

Matches a date in nn/nn/nn form.

Matches an editor's name.

Matches the last page in a page range.

Matches an ISBN number.

Matches an ISSN number.

Matches an issue number.

Matches a page range in nn-nn form.

Matches a publication name.

Matches a publisher name.

Matches the location of a publisher.

Matches the start page.

Matches a subtitle.

Matches an article title.

Matches a publication in entirely upper-case (e.g. JOURNAL OF LEMURS).

Matches a title in entirely upper-case.

Matches a URL.

Matches a volume.

Matches a year (4 digits).

HOW TO: Integrate ParaTools with EPrints 2

EPrints already contains ParaCite support, but using a specially built version of the module before it was part of ParaTools. To alter your cgi/paracite script to use ParaTools, you need to do the following:

First replace

 use Citation::Parser::Simple;


 use Biblio::Citation::Parser::Standard;

Next, replace this line:

 my $parser = new Citation::Parser::Simple();

with this line:

 my $parser = new Biblio::Citation::Parser::Standard();

This should work fine, although you can obviously integrate ParaCite more if you wish.

HOW TO: Create a New Parser

Creating a Citation Parser

All new citation parsers should be named Biblio::Citation::Parser::SomeName, where SomeName is replaced with a unique name (ideally the author's surname). The parser should extend the Biblio::Citation::Parser module like so:

 package Biblio::Citation::Parser::SomeName;
 require Exporter;
 @ISA = ("Exporter", "Biblio::Citation::Parser");
 our @EXPORT_OK = ( 'new', 'parse' );

You should then override the 'new' and 'parse' methods:


 sub new
         my($class) = @_;
         my $self = {};
         return bless($self, $class);
 sub parse
         my($self, $ref) = @_;
         my $hashout = $self->extract_metadata($ref);
         return $hashout;

This makes it easy for users to swap out one reference parser for another.

 Biblio::Citation::Parser 1.10 Documentation - How-To Guides