Debian Codegraph @

docs/html/howto.html

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