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