1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Biblio::Citation::Parser 1.10 Documentation - How-To Guides</title>
<link rel="stylesheet" href="epdocs.css" type="text/css" />
<link rev="made" href="mailto:root@scampi.ecs.soton.ac.uk" />
</head>
<body>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" valign="middle">
<big><strong><span class="block"> Biblio::Citation::Parser 1.10 Documentation - How-To Guides</span></strong></big>
</td></tr>
</table>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#how_to__modify_templates_in_biblio__citation__parser__standard">HOW TO: Modify Templates in Biblio::Citation::Parser::Standard</a></li>
<li><a href="#how_to__integrate_paratools_with_eprints_2">HOW TO: Integrate ParaTools with EPrints 2</a></li>
<li><a href="#how_to__create_a_new_parser">HOW TO: Create a New Parser</a></li>
<ul>
<li><a href="#creating_a_citation_parser">Creating a Citation Parser</a></li>
</ul>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="how_to__modify_templates_in_biblio__citation__parser__standard">HOW TO: Modify Templates in Biblio::Citation::Parser::Standard</a></h1>
<p>Adding new templates to the Standard parser is relatively easy:</p>
<ul>
<li></li>
Locate where your Templates.pm file has been installed.
<p>On Linux systems this should just involve doing 'locate Templates.pm', otherwise 'find / -name Templates.pm' should work.
Alternatively, you can edit the Templates.pm in the Biblio/Citation/Parser/ directory of an unpacked distribution, and install it once you have finished.</p>
<p></p>
<li></li>
Add the template to the list.
<p>If you are editing an already installed Templates.pm file you will probably have to be root to do this. If you are editing the Templates.pm inside an unpacked distribution, you will have to reinstall the modules once you are finished (see the Installation section).</p>
<p></p></ul>
<p>The Templates.pm file should contain a structure similar to this:</p>
<pre>
$Biblio::Citation::Parser::Templates::templates = [
'_AUTHORS_, _PUBLICATION_, _YEAR_, _ISSUE_, _SPAGE_-_EPAGE_',
...
];</pre>
<p>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:</p>
<dl>
<dt><strong><a name="item__any_">_ANY_</a></strong><br />
</dt>
<dd>
Matches anything.
</dd>
<p></p>
<dt><strong><a name="item__aufirst_">_AUFIRST_</a></strong><br />
</dt>
<dd>
Matches the first name of an author.
</dd>
<p></p>
<dt><strong><a name="item__aulast_">_AULAST_</a></strong><br />
</dt>
<dd>
Matches the last name of an author.
</dd>
<p></p>
<dt><strong><a name="item__authors_">_AUTHORS_</a></strong><br />
</dt>
<dd>
Matches a list of authors.
</dd>
<p></p>
<dt><strong><a name="item__cappublication_">_CAPPUBLICATION_</a></strong><br />
</dt>
<dd>
Matches a capitalised publication title (e.g. ``Journal of Lemurs'').
</dd>
<p></p>
<dt><strong><a name="item__captitle_">_CAPTITLE_</a></strong><br />
</dt>
<dd>
Matches a capitalised title.
</dd>
<p></p>
<dt><strong><a name="item__chapter_">_CHAPTER_</a></strong><br />
</dt>
<dd>
Matches a chapter number.
</dd>
<p></p>
<dt><strong><a name="item__date_">_DATE_</a></strong><br />
</dt>
<dd>
Matches a date in nn/nn/nn form.
</dd>
<p></p>
<dt><strong><a name="item__editor_">_EDITOR_</a></strong><br />
</dt>
<dd>
Matches an editor's name.
</dd>
<p></p>
<dt><strong><a name="item__epage_">_EPAGE_</a></strong><br />
</dt>
<dd>
Matches the last page in a page range.
</dd>
<p></p>
<dt><strong><a name="item__isbn_">_ISBN_</a></strong><br />
</dt>
<dd>
Matches an ISBN number.
</dd>
<p></p>
<dt><strong><a name="item__issn_">_ISSN_</a></strong><br />
</dt>
<dd>
Matches an ISSN number.
</dd>
<p></p>
<dt><strong><a name="item__issue_">_ISSUE_</a></strong><br />
</dt>
<dd>
Matches an issue number.
</dd>
<p></p>
<dt><strong><a name="item__pages_">_PAGES_</a></strong><br />
</dt>
<dd>
Matches a page range in nn-nn form.
</dd>
<p></p>
<dt><strong><a name="item__publication_">_PUBLICATION_</a></strong><br />
</dt>
<dd>
Matches a publication name.
</dd>
<p></p>
<dt><strong><a name="item__publisher_">_PUBLISHER_</a></strong><br />
</dt>
<dd>
Matches a publisher name.
</dd>
<p></p>
<dt><strong><a name="item__publoc_">_PUBLOC_</a></strong><br />
</dt>
<dd>
Matches the location of a publisher.
</dd>
<p></p>
<dt><strong><a name="item__spage_">_SPAGE_</a></strong><br />
</dt>
<dd>
Matches the start page.
</dd>
<p></p>
<dt><strong><a name="item__subtitle_">_SUBTITLE_</a></strong><br />
</dt>
<dd>
Matches a subtitle.
</dd>
<p></p>
<dt><strong><a name="item__title_">_TITLE_</a></strong><br />
</dt>
<dd>
Matches an article title.
</dd>
<p></p>
<dt><strong><a name="item__ucpublication_">_UCPUBLICATION_</a></strong><br />
</dt>
<dd>
Matches a publication in entirely upper-case (e.g. JOURNAL OF LEMURS).
</dd>
<p></p>
<dt><strong><a name="item__uctitle_">_UCTITLE_</a></strong><br />
</dt>
<dd>
Matches a title in entirely upper-case.
</dd>
<p></p>
<dt><strong><a name="item__url_">_URL_</a></strong><br />
</dt>
<dd>
Matches a URL.
</dd>
<p></p>
<dt><strong><a name="item__volume_">_VOLUME_</a></strong><br />
</dt>
<dd>
Matches a volume.
</dd>
<p></p>
<dt><strong><a name="item__year_">_YEAR_</a></strong><br />
</dt>
<dd>
Matches a year (4 digits).
</dd>
<p></p></dl>
<p>
</p>
<hr />
<h1><a name="how_to__integrate_paratools_with_eprints_2">HOW TO: Integrate ParaTools with EPrints 2</a></h1>
<p>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:</p>
<p>First replace</p>
<pre>
use Citation::Parser::Simple;</pre>
<p>with</p>
<pre>
use Biblio::Citation::Parser::Standard;</pre>
<p>Next, replace this line:</p>
<pre>
my $parser = new Citation::Parser::Simple();</pre>
<p>with this line:</p>
<pre>
my $parser = new Biblio::Citation::Parser::Standard();</pre>
<p>This should work fine, although you can obviously integrate ParaCite more if you wish.</p>
<p>
</p>
<hr />
<h1><a name="how_to__create_a_new_parser">HOW TO: Create a New Parser</a></h1>
<p>
</p>
<h2><a name="creating_a_citation_parser">Creating a Citation Parser</a></h2>
<p>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:</p>
<pre>
package Biblio::Citation::Parser::SomeName;
require Exporter;
@ISA = ("Exporter", "Biblio::Citation::Parser");
our @EXPORT_OK = ( 'new', 'parse' );</pre>
<p>You should then override the 'new' and 'parse' methods:</p>
<p>e.g.</p>
<pre>
sub new
{
my($class) = @_;
my $self = {};
return bless($self, $class);
}</pre>
<pre>
sub parse
{
my($self, $ref) = @_;
my $hashout = $self->extract_metadata($ref);
return $hashout;
}</pre>
<p>This makes it easy for users to swap out one reference parser for another.</p>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" valign="middle">
<big><strong><span class="block"> Biblio::Citation::Parser 1.10 Documentation - How-To Guides</span></strong></big>
</td></tr>
</table>
</body>
</html>
|