TeX: Make bibitem extractor resilient to square brackets in labels
@@ -458,24 +458,19 @@ def test_extract_bibitem_include_hyperref_contents():
def test_extract_bibitem_wrapping_key():
- tex = "\n".join(
- [
- r"\bibitem[\protect\citeauthoryear{Grossman, Chevalier, and Kazi}{Grossman",
- r" et~al\mbox{.}}{2015}]%",
- r" {ref:grossman2015your}",
- r"\bibfield{author}{\bibinfo{person}{Tovi Grossman}, \bibinfo{person}{Fanny",
- r" Chevalier}, {and} \bibinfo{person}{Rubaiat~Habib Kazi}.}",
- r" \bibinfo{year}{2015}\natexlab{}.",
- r"\newblock \showarticletitle{Your Paper is Dead! Bringing Life to Research",
- r" Articles with Animated Figures}. In \bibinfo{booktitle}{\emph{\confchi}}.",
- r" \bibinfo{publisher}{ACM}, \bibinfo{pages}{461--475}.",
- r"\newblock.",
- ]
- )
+ tex = "\n".join([r"\bibitem[label]%", r" {key}", r" token"])
+ extractor = BibitemExtractor()
+ bibitems = list(extractor.parse(tex))
+ assert len(bibitems) == 1
+ assert "token" in bibitems[0].text
+
+
+def test_extract_bibitem_with_brackets_in_label():
+ tex = "\n".join([r"\bibitem[label{[]}]{key}", r"token"])
extractor = BibitemExtractor()
bibitems = list(extractor.parse(tex))
assert len(bibitems) == 1
- assert "Animated" in bibitems[0].text
+ assert "token" in bibitems[0].text
def test_extract_macro():
