Skip to content

Commit

Permalink
Add test for issue #319.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmtroffaes committed Aug 24, 2023
1 parent dbfc2eb commit 337285f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sphinxcontrib/bibtex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_role("footcite", FootCiteRole())

return {
"version": "2.6.0a4",
"version": "2.6.0a5",
"env_version": 9,
"parallel_read_safe": True,
"parallel_write_safe": True,
Expand Down
3 changes: 3 additions & 0 deletions test/roots/test-citation_label_special_chars/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extensions = ["sphinxcontrib.bibtex"]
exclude_patterns = ["_build"]
bibtex_bibfiles = ["refs.bib"]
2 changes: 2 additions & 0 deletions test/roots/test-citation_label_special_chars/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.. bibliography::
:all:
19 changes: 19 additions & 0 deletions test/roots/test-citation_label_special_chars/refs.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@book{Manning2008,
author = {Christopher D. Manning and Prabhakar Raghavan and Hinrich Sch\"utze},
title = {Introduction to Information Retrieval},
address = {Cambridge},
publisher = {Cambridge University Press},
year = {2008},
url = {https://nlp.stanford.edu/IR-book/},
}

@article{Serrano2009,
author = {M. {\'A}ngeles Serrano and Mari{\'a}n Bogu{\~n}{\'a} and Alessandro Vespignani},
title = {Extracting the multiscale backbone of complex weighted networks},
journal = {Proceedings of the National Academy of Sciences},
volume = {106},
number = {16},
year = {2009},
pages = {6483--6488},
doi = {10.1073/pnas.0808904106},
}
11 changes: 11 additions & 0 deletions test/test_citation.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,14 @@ def test_citation_tooltip3(app, warning) -> None:
assert (
len(html_citation_refs(label="tes", title="whoop whoop").findall(output)) == 1
)


# https://bitbucket.org/pybtex-devs/pybtex/issues/442/author-names-with-special-latex-characters
@pytest.mark.xfail(reason="upstream bug")
@pytest.mark.sphinx("html", testroot="citation_label_special_chars")
def test_citation_label_special_chars(app, warning) -> None:
app.build()
assert not warning.getvalue()
output = (app.outdir / "index.html").read_text(encoding="utf-8-sig")
assert len(html_citations(label="MRS08").findall(output)) == 1
assert len(html_citations(label="SBV09").findall(output)) == 1

0 comments on commit 337285f

Please sign in to comment.