1Biber::Utils(3) User Contributed Perl Documentation Biber::Utils(3)
2
3
4
6 Biber::Utils - Various utility subs used in Biber
7
9 All functions are exported by default.
10
12 locate_biber_file
13 Searches for a file by
14
15 The exact path if the filename is absolute
16 In the input_directory, if defined
17 In the output_directory, if defined
18 Relative to the current directory
19 In the same directory as the control file
20 Using kpsewhich, if available
21
22
23 Check existence of NFC/NFD file variants and return correct one.
24 Account for windows file encodings
25
26 biber_warn
27 Wrapper around various warnings bits and pieces
28 Logs a warning, add warning to the list of .bbl warnings and optionally
29 increments warning count in Biber object, if present
30
31 biber_error
32 Wrapper around error logging
33 Forces an exit.
34
35 makenamesid
36 Given a Biber::Names object, return an underscore normalised
37 concatenation of all of the full name strings.
38
39 makenameid
40 Given a Biber::Name object, return an underscore normalised
41 concatenation of the full name strings.
42
43 latex_recode_output
44 Tries to convert UTF-8 to TeX macros in passed string
45
46 strip_noinit
47 Removes elements which are not to be considered during initials generation
48 in names
49
50 strip_nosort
51 Removes elements which are not to be used in sorting a name from a string
52
53 normalise_string_label
54 Remove some things from a string for label generation.
55
56 normalise_string_sort
57 Removes LaTeX macros, and all punctuation, symbols, separators and
58 control characters, as well as leading and trailing whitespace for
59 sorting strings.
60
61 normalise_string_bblxml
62 Some string normalisation for bblxml output
63
64 normalise_string
65 Removes LaTeX macros, and all punctuation, symbols, separators and
66 control characters, as well as leading and trailing whitespace for
67 sorting strings. Only decodes LaTeX character macros into Unicode if
68 output is UTF-8
69
70 normalise_string_common
71 Common bit for normalisation
72
73 normalise_string_hash
74 Normalise strings used for hashes. We collapse LaTeX macros into a vestige
75 so that hashes are unique between things like:
76
77 Smith
78 {\v S}mith
79
80 we replace macros like this to preserve their vestiges:
81
82 \v S -> v:
83 \" -> 34:
84
85 normalise_string_underscore
86 Like normalise_string, but also substitutes ~ and whitespace with underscore.
87
88 escape_label
89 Escapes a few special character which might be used in labels
90
91 unescape_label
92 Unscapes a few special character which might be used in label but which need
93 sorting without escapes
94
95 reduce_array
96 reduce_array(\@a, \@b) returns all elements in @a that are not in @b
97
98 remove_outer
99 Remove surrounding curly brackets:
100 '{string}' -> 'string'
101 but not
102 '{string} {string}' -> 'string} {string'
103
104 Return (boolean if stripped, string)
105
106 has_outer
107 Return (boolean if surrounded in braces
108
109 add_outer
110 Add surrounding curly brackets:
111 'string' -> '{string}'
112
113 ucinit
114 upper case of initial letters in a string
115
116 is_undef
117 Checks for undefness of arbitrary things, including
118 composite method chain calls which don't reliably work
119 with defined() (see perldoc for defined())
120 This works because we are just testing the value passed
121 to this sub. So, for example, this is randomly unreliable
122 even if the resulting value of the arg to defined() is "undef":
123
124 defined($thing->method($arg)->method)
125
126 wheras:
127
128 is_undef($thing->method($arg)->method)
129
130 works since we only test the return value of all the methods
131 with defined()
132
133 is_def
134 Checks for definedness in the same way as is_undef()
135
136 is_undef_or_null
137 Checks for undef or nullness (see is_undef() above)
138
139 is_def_and_notnull
140 Checks for def and unnullness (see is_undef() above)
141
142 is_def_and_null
143 Checks for def and nullness (see is_undef() above)
144
145 is_null
146 Checks for nullness
147
148 is_notnull
149 Checks for notnullness
150
151 is_notnull_scalar
152 Checks for notnullness of a scalar
153
154 is_notnull_array
155 Checks for notnullness of an array (passed by ref)
156
157 is_notnull_hash
158 Checks for notnullness of an hash (passed by ref)
159
160 is_notnull_object
161 Checks for notnullness of an object (passed by ref)
162
163 stringify_hash
164 Turns a hash into a string of keys and values
165
166 normalise_utf8
167 Normalise any UTF-8 encoding string immediately to exactly what we want
168 We want the strict perl utf8 "UTF-8"
169
170 inits
171 We turn the initials into an array so we can be flexible with them later
172 The tie here is used only so we know what to split on. We don't want to make
173 any typesetting decisions in Biber, like what to use to join initials so on
174 output to the .bbl, we only use BibLaTeX macros.
175
176 join_name
177 Replace all join typsetting elements in a name part (space, ties) with BibLaTeX macros
178 so that typesetting decisions are made in BibLaTeX, not hard-coded in Biber
179
180 filter_entry_options
181 Process any per_entry option transformations which are necessary on output
182
183 imatch
184 Do an interpolating (neg)match using a match RE and a string passed in as variables
185 Using /g on matches so that $1,$2 etc. can be populated from repeated matches of
186 same capture group as well as different groups
187
188 ireplace
189 Do an interpolating match/replace using a match RE, replacement RE
190 and string passed in as variables
191
192 validate_biber_xml
193 Validate a biber/biblatex XML metadata file against an RNG XML schema
194
195 map_boolean
196 Convert booleans between strings and numbers. Because standard XML "boolean"
197 datatype considers "true" and "1" the same etc.
198
199 remove_entry_options
200 Remove per-entry options
201
202 process_entry_options
203 Set per-entry options
204
205 expand_option
206 Expand option such as meta-options coming from biblatex
207
208 parse_date_range
209 Parse of ISO8601 date range
210 Returns two-element array ref: [start DT object, end DT object]
211
212 parse_date_unspecified
213 Parse of ISO8601-2:2016 4.3 unspecified format into date range
214 Returns range plus specification of granularity of unspecified
215
216 parse_date_start
217 Convenience wrapper
218
219 parse_date_end
220 Convenience wrapper
221
222 parse_date
223 Parse of EDTF dates
224
225 date_monthday
226 Force month/day to ISO8601-2:2016 format with leading zero
227
228 biber_decode_utf8
229 Perform NFD form conversion as well as UTF-8 conversion. Used to normalize
230 bibtex input as the T::B interface doesn't allow a neat whole file slurping.
231
232 out
233 Output to target. Outputs NFC UTF-8 if output is UTF-8
234
235 process_comment
236 Fix up some problems with comments after being processed by btparse
237
238 locale2bcp47
239 Map babel/polyglossia language options to a sensible CLDR (bcp47) locale default
240 Return input string if there is no mapping
241
242 bcp472locale
243 Map CLDR (bcp47) locale to a babel/polyglossia locale
244 Return input string if there is no mapping
245
246 rangelen
247 Calculate the length of a range field
248 Range fields are an array ref of two-element array refs [range_start, range_end]
249 range_end can be be empty for open-ended range or undef
250 Deals with Unicode and ASCII roman numerals via the magic of Unicode NFKD form
251
252 m-n -> [m, n]
253 m -> [m, undef]
254 m- -> [m, '']
255 -n -> ['', n]
256 - -> ['', undef]
257
258 match_indices
259 Return array ref of array refs of matches and start indices of matches
260 for provided array of compiled regexps into string
261
262 parse_range
263 Parses a range of values into a two-value array ref.
264 Ranges with no starting value default to "1"
265 Ranges can be open-ended and it's up to surrounding code to interpret this
266 Ranges can be single figures which is shorthand for 1-x
267
268 parse_range_alt
269 Parses a range of values into a two-value array ref.
270 Either start or end can be undef and it's up to surrounding code to interpret this
271
272 maploopreplace
273 Replace loop markers with values.
274
275 get_transliterator
276 Get a ref to a transliterator for the given from/to
277 We are abstracting this in this way because it is not clear what the future
278 of the transliteration library is. We want to be able to switch.
279
280 call_transliterator
281 Run a transliterator on passed text. Hides call semantics of transliterator
282 so we can switch engine in the future.
283
285 Francois Charette, "<firmicus at ankabut.net>" Philip Kime "<philip at
286 kime.org.uk>"
287
289 Please report any bugs or feature requests on our Github tracker at
290 <https://github.com/plk/biber/issues>.
291
293 Copyright 2009-2018 Francois Charette and Philip Kime, all rights
294 reserved.
295
296 This module is free software. You can redistribute it and/or modify it
297 under the terms of the Artistic License 2.0.
298
299 This program is distributed in the hope that it will be useful, but
300 without any warranty; without even the implied warranty of
301 merchantability or fitness for a particular purpose.
302
303
304
305perl v5.28.0 2018-10-18 Biber::Utils(3)