.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Biblio::EndnoteStyle 3pm" .TH Biblio::EndnoteStyle 3pm "2016-12-28" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Biblio::EndnoteStyle \- reference formatting using Endnote\-like templates .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Biblio::EndnoteStyle; \& $style = new Biblio::EndnoteStyle(); \& ($text, $errmsg) = $style\->format($template, \e%fields); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This small module provides a way of formatting bibliographic references using style templates similar to those used by the popular reference management software Endnote (http://www.endnote.com/). The \&\s-1API\s0 is embarrassingly simple: a formatter object is made using the class's constructor, the \f(CW\*(C`new()\*(C'\fR method; \f(CW\*(C`format()\*(C'\fR may then be repeatedly called on this object, using the same or different templates. .PP (The sole purpose of the object is to cache compiled templates so that multiple \f(CW\*(C`format()\*(C'\fR invocations are more efficient than they would otherwise be. Apart from that, the \s-1API\s0 might just as well have been a single function.) .SH "METHODS" .IX Header "METHODS" .SS "\fInew()\fP" .IX Subsection "new()" .Vb 1 \& $style = new Biblio::EndnoteStyle(); .Ve .PP Creates a new formatter object. Takes no arguments. .SS "\fIdebug()\fP" .IX Subsection "debug()" .Vb 1 \& $olddebug = $style\->debug(1); .Ve .PP Turns debugging on or off and returns the old debugging status. If an argument is provided, then debugging is turned either on or off according to whether then argument is true or false. In any case, the old value of the debugging status is returned, so that a call with no argument is a side-effect-free inquiry. .PP When debugging is turned on, compiled templates are dumped to standard error. It is not pretty. .SS "\fIformat()\fP" .IX Subsection "format()" .Vb 1 \& ($text, $errmsg) = $style\->format($template, \e%fields); .Ve .PP Formats a reference, consisting of a hash of fields, according to an Endnote-like template. The template is a string essentially the same as those used in Endnote, as documented in the Endnote X User Guide at http://www.endnote.com/support/helpdocs/EndNoteXWinManual.pdf pages 390ff. In particular, pages 415\-210 have details of the recipe format. Because the templates used in this module are plain text, a few special characters are used: .IP "¬" 4 Link adjacent words. This is the \*(L"non-breaking space\*(R" described on page 418 of the EndNote X .IP "|" 4 Forced Separation of elements that would otherwise be dependent. .IP "^" 4 Separator for singular/plural aternatives. .IP "`" 4 Used to prevent literal text from being interpreted as a fieldname. .PP The hash of fields is passed by reference: keys are fieldnames, and the corresponding values are the data. \s-1PLEASE NOTE AN IMPORTANT DIFFERENCE. \s0 Keys that do not appear in the hash at all are not considered to be fields, so that if they appear in the template, they will be interpreted as literal text; keys that appear in the hash but whose values are undefined or empty are considered to be fields with no value, and will be formatted as empty with dependent text omitted. So for example: .PP .Vb 3 \& $style\->format(";Author: ", { Author => "Taylor" }) eq ":Taylor: " \& $style\->format(";Author: ", { Author => "" }) eq ";" \& $style\->format(";Author: ", { xAuthor => "" }) eq ";Author: " .Ve .PP \&\f(CW\*(C`format()\*(C'\fR returns two values: the formatted reference and an error-message. The error message is defined if and only if the formatted reference is not. .SH "AUTHOR" .IX Header "AUTHOR" Mike Taylor, .SH "COPYRIGHT AND LICENCE" .IX Header "COPYRIGHT AND LICENCE" Copyright (C) 2007 by Mike Taylor. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.