25 lines
997 B
Plaintext
25 lines
997 B
Plaintext
|
Fun with Perl 5.30
|
||
|
|
||
|
---
|
||
|
lib/Biber/LaTeX/Recode.pm | 7 ++++++-
|
||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||
|
|
||
|
--- lib/Biber/LaTeX/Recode.pm
|
||
|
+++ lib/Biber/LaTeX/Recode.pm 2018-03-15 08:49:32.341586613 +0000
|
||
|
@@ -312,9 +312,14 @@ sub latex_decode {
|
||
|
#
|
||
|
# Workaround perl's lack of variable-width negative look-behind -
|
||
|
# Reverse string (and therefore some of the Re) and use variable width negative look-ahead
|
||
|
+ # Careful here - reversing puts any combining chars before the char so \X can't be used
|
||
|
$text = reverse $text;
|
||
|
- $text =~ s/}(\pM+\pL){(?!\pL+\\)/$1/g;
|
||
|
+ $text =~ s/\}(\pM*\pL)\{(?!(?:\}[^}]+\{)*\pL+\\)/$1/g;
|
||
|
$text = reverse $text;
|
||
|
+ # Put brace markers back after doing the brace elimination as we only want to eliminate
|
||
|
+ # braces introduced as part of decoding, not explicit braces in the data
|
||
|
+ $text =~ s/\x{1f}/{/g;
|
||
|
+ $text =~ s/\x{1e}/}/g;
|
||
|
|
||
|
# Replace verbatim field markers
|
||
|
$text =~ s/([a-f0-9]{32})/$saveverb->{$1}/gie;
|