Skip to content

Commit

Permalink
Revert "Fix for #483"
Browse files Browse the repository at this point in the history
This reverts commit 3182c32.
  • Loading branch information
plk committed Aug 29, 2024
1 parent 3182c32 commit f9600df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
30 changes: 3 additions & 27 deletions lib/Biber/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1077,32 +1077,19 @@ sub filter_entry_options {

sub imatch {
my ($value, $val_match, $negmatch, $ci) = @_;
my @result;

return 0 unless $val_match;
if ($ci) {
$val_match = qr/$val_match/i;
}
else {
$val_match = qr/$val_match/;
}

# Have to make $value temporarily NFC as unicode character clases (e.g. \p{Lu}) only work on characters
# not glyphs and people will want to use these
$value = NFC($value);

# ... and if we make $value NFC, the match item has to be NFC too otherwise we can't match NFD glyphs
$val_match = NFC($val_match);

if ($negmatch) {# "!~" doesn't work here as we need an array returned
@result = $value =~ m/$val_match/xmsg ? () : (1);
return $value =~ m/$val_match/xmsg ? () : (1);
}
else {
@result = $value =~ m/$val_match/xmsg;
return $value =~ m/$val_match/xmsg;
}

# ... but we return NFD to keep the internals consistently NFD
return map {NFD($_)} @result;
}


Expand All @@ -1122,21 +1109,10 @@ sub ireplace {
else {
$val_match = qr/$val_match/;
}

# Tricky quoting because of later evals
$val_replace = '"' . $val_replace . '"';

# Have to make $value temporarily NFC as unicode character clases (e.g. \p{Lu}) only work on characters
# not glyphs and people will want to use these
$value = NFC($value);

# ... and if we make $value NFC, the match item has to be NFC too otherwise we can't match NFD glyphs
$val_match = NFC($val_match);

$value =~ s/$val_match/$val_replace/eegxms;

# ... but we return NFD to keep the internals consistently NFD
return NFD($value);
return $value;
}


Expand Down
2 changes: 1 addition & 1 deletion t/basic-misc.t
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ ok(is_undef($bibentries->entry('i1')->get_field('abstract')), 'map 1' );
eq_or_diff($bibentries->entry('i1')->get_field('userd'), 'test', 'map 2' );
ok(is_undef($bibentries->entry('i2')->get_field('userb')), 'map 3' );
eq_or_diff(NFC($bibentries->entry('i2')->get_field('usere')), 'a Štring', 'map 4' );
# Testing of UTF8 match/replace
# Testing ot UTF8 match/replace
eq_or_diff($biber->_liststring('i1', 'listd'), 'abc', 'map 5' );
# Testing of user field map match/replace
eq_or_diff($biber->_liststring('i1', 'listb'), 'REPlacedte!early', 'map 6');
Expand Down

0 comments on commit f9600df

Please sign in to comment.