![]() |
![]()
| ![]() |
![]()
NAMEBiber::Utils - Various utility subs used in Biber EXPORTAll functions are exported by default. FUNCTIONSglob_data_fileExpands a data file glob to a list of filenames slurp_switchrUse different read encoding/slurp interfaces for Windows due to its horrible legacy codepage system slurp_switchwUse different write encoding/slurp interfaces for Windows due to its horrible legacy codepage system locate_data_fileSearches for a data file by The exact path if the filename is absolute In the input_directory, if defined In the output_directory, if defined Relative to the current directory In the same directory as the control file Using kpsewhich, if available Check existence of NFC/NFD file variants and return correct one. Account for windows file encodings check_emptyWrapper around empty check to deal with Win32 Unicode filenames check_existsWrapper around exists check to deal with Win32 Unicode filenames biber_warnWrapper around various warnings bits and pieces. Add warning to the list of .bbl warnings and the master list of warnings biber_errorWrapper around error logging Forces an exit. makenamesidGiven a Biber::Names object, return an underscore normalised concatenation of all of the full name strings. makenameidGiven a Biber::Name object, return an underscore normalised concatenation of the full name strings. latex_recode_outputTries to convert UTF-8 to TeX macros in passed string strip_noinitRemoves elements which are not to be considered during initials generation in names strip_nosortRemoves elements which are not to be used in sorting a name from a string strip_nonamestringRemoves elements which are not to be used in certain name-related operations like: * fullhash generation * uniquename generation from a name normalise_string_labelRemove some things from a string for label generation. Don't strip \p{Dash} as this is needed to process compound names or label generation. normalise_string_sortRemoves LaTeX macros, and all punctuation, symbols, separators as well as leading and trailing whitespace for sorting strings. Control chars don't need to be stripped as they are completely ignorable in DUCET normalise_string_bblxmlSome string normalisation for bblxml output normalise_stringRemoves LaTeX macros, and all punctuation, symbols, separators and control characters, as well as leading and trailing whitespace for sorting strings. Only decodes LaTeX character macros into Unicode if output is UTF-8 normalise_string_commonCommon bit for normalisation normalise_string_hashNormalise strings used for hashes. We collapse LaTeX macros into a vestige so that hashes are unique between things like: Smith {\v S}mith we replace macros like this to preserve their vestiges: \v S -> v: \" -> 34: normalise_string_underscoreLike normalise_string, but also substitutes ~ and whitespace with underscore. escape_labelEscapes a few special character which might be used in labels unescape_labelUnscapes a few special character which might be used in label but which need sorting without escapes reduce_arrayreduce_array(\@a, \@b) returns all elements in @a that are not in @b remove_outerRemove surrounding curly brackets: '{string}' -> 'string' but not '{string} {string}' -> 'string} {string' Return (boolean if stripped, string) has_outerReturn (boolean if surrounded in braces add_outerAdd surrounding curly brackets: 'string' -> '{string}' ucinitupper case of initial letters in a string is_undefChecks for undefness of arbitrary things, including composite method chain calls which don't reliably work with defined() (see perldoc for defined()) This works because we are just testing the value passed to this sub. So, for example, this is randomly unreliable even if the resulting value of the arg to defined() is "undef": defined($thing->method($arg)->method) whereas: is_undef($thing->method($arg)->method) works since we only test the return value of all the methods with defined() is_defChecks for definedness in the same way as is_undef() is_undef_or_nullChecks for undef or nullness (see is_undef() above) is_def_and_notnullChecks for def and unnullness (see is_undef() above) is_def_and_nullChecks for def and nullness (see is_undef() above) is_nullChecks for nullness is_notnullChecks for notnullness is_notnull_scalarChecks for notnullness of a scalar is_notnull_arrayChecks for notnullness of an array (passed by ref) is_notnull_hashChecks for notnullness of an hash (passed by ref) is_notnull_objectChecks for notnullness of an object (passed by ref) stringify_hashTurns a hash into a string of keys and values normalise_utf8Normalise any UTF-8 encoding string immediately to exactly what we want We want the strict perl utf8 "UTF-8" initsWe turn the initials into an array so we can be flexible with them later The tie here is used only so we know what to split on. We don't want to make any typesetting decisions in Biber, like what to use to join initials so on output to the .bbl, we only use BibLaTeX macros. join_nameReplace all join typsetting elements in a name part (space, ties) with BibLaTeX macros so that typesetting decisions are made in BibLaTeX, not hard-coded in Biber filter_entry_optionsProcess any per_entry option transformations which are necessary on output imatchDo an interpolating (neg)match using a match RE and a string passed in as variables Using /g on matches so that $1,$2 etc. can be populated from repeated matches of same capture group as well as different groups ireplaceDo an interpolating match/replace using a match RE, replacement RE and string passed in as variables validate_biber_xmlValidate a biber/biblatex XML metadata file against an RNG XML schema map_booleanConvert booleans between strings and numbers. Because standard XML "boolean" datatype considers "true" and "1" the same etc. process_entry_optionsSet per-entry options merge_entry_optionsMerge entry options, dealing with conflicts expand_option_inputExpand options such as meta-options coming from biblatex parse_date_rangeParse of ISO8601 date range parse_date_unspecifiedParse of ISO8601-2:2016 4.3 unspecified format into date range Returns range plus specification of granularity of unspecified parse_date_startConvenience wrapper parse_date_endConvenience wrapper parse_dateParse of iso8601-2 dates date_monthdayForce month/day to ISO8601-2:2016 format with leading zero biber_decode_utf8Perform NFD form conversion as well as UTF-8 conversion. Used to normalize bibtex input as the T::B interface doesn't allow a neat whole file slurping. outOutput to target. Outputs NFC UTF-8 if output is UTF-8 process_commentFix up some problems with comments after being processed by btparse locale2bcp47Map babel/polyglossia language options to a sensible CLDR (bcp47) locale default Return input string if there is no mapping bcp472localeMap CLDR (bcp47) locale to a babel/polyglossia locale Return input string if there is no mapping rangelenCalculate the length of a range field Range fields are an array ref of two-element array refs [range_start, range_end] range_end can be be empty for open-ended range or undef Deals with Unicode and ASCII roman numerals via the magic of Unicode NFKD form m-n -> [m, n] m -> [m, undef] m- -> [m, ''] -n -> ['', n] - -> ['', undef] match_indicesReturn array ref of array refs of matches and start indices of matches for provided array of compiled regexps into string parse_rangeParses a range of values into a two-value array ref. Ranges with no starting value default to "1" Ranges can be open-ended and it's up to surrounding code to interpret this Ranges can be single figures which is shorthand for 1-x strip_annotationRemoves annotation marker from a field name parse_range_altParses a range of values into a two-value array ref. Either start or end can be undef and it's up to surrounding code to interpret this maploopreplaceReplace loop markers with values. get_transliteratorGet a ref to a transliterator for the given from/to We are abstracting this in this way because it is not clear what the future of the transliteration library is. We want to be able to switch. call_transliteratorRun a transliterator on passed text. Hides call semantics of transliterator so we can switch engine in the future. AUTHORPhilip Kime "<philip at kime.org.uk>" BUGSPlease report any bugs or feature requests on our Github tracker at <https://github.com/plk/biber/issues>. COPYRIGHT & LICENSECopyright 2012-2024 Philip Kime, all rights reserved. This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
|