Skip to content

Commit 7a1e73c

Browse files
committed
Support accent characters in cite names.
A new commit introduces a cite name that contains an accent character: @inproceedings{Müller2024a, It will cause the bibtex parser to fail with the following two errors: failed to extract cite name of: @inproceedings{Müller2024a, and parse failed at 55:17: syntax error: unexpected $end, expecting tCOMM The second error is an upstream limitation, which I will try to get it merged to the upstream: https://github.com/nickng/bibtex.
1 parent 8637920 commit 7a1e73c

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import (
1313
"github.com/nickng/bibtex"
1414
)
1515

16-
// Matches e.g.: @inproceedings{Doe2024a,
17-
var re = regexp.MustCompile(`@[a-z]*\{([A-Za-z\-]*[0-9]{4}[a-z]),`)
16+
// Matches e.g.: @inproceedings{Müller2024a,
17+
// \p{L}\p{M} matches any letter, including accented characters.
18+
var re = regexp.MustCompile(`@[a-z]*\{([\"\p{L}\p{M}\-]*[0-9]{4}[a-z]),`)
1819

1920
// Map a cite name (e.g., Doe2024a) to its line number in the .bib file. All
2021
// cite names are unique.

src/vendor/github.com/nickng/bibtex/token.go

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)