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