-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from mcmtroffaes/feature/style_config_value
Add bibtex_default_style option to override the default bibliography style. Resolves issue #91.
- Loading branch information
Showing
11 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.3.4a0 | ||
0.3.4a1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
extensions = ['sphinxcontrib.bibtex'] | ||
exclude_patterns = ['_build'] | ||
|
||
# create and register pybtex plugins | ||
|
||
from pybtex.style.formatting.unsrt import Style as UnsrtStyle | ||
from pybtex.style.template import words | ||
from pybtex.plugin import register_plugin | ||
|
||
|
||
extensions = ['sphinxcontrib.bibtex'] | ||
exclude_patterns = ['_build'] | ||
|
||
|
||
class NoWebRefStyle(UnsrtStyle): | ||
|
||
def format_web_refs(self, e): | ||
# the following is just one simple way to return an empty node | ||
return words[''] | ||
|
||
|
||
register_plugin('pybtex.style.formatting', 'nowebref', NoWebRefStyle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
extensions = ['sphinxcontrib.bibtex'] | ||
exclude_patterns = ['_build'] | ||
bibtex_default_style = 'plain' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
:cite:`2009:mandel` | ||
|
||
.. bibliography:: test.bib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@Misc{2009:mandel, | ||
author = {Jan Mandel}, | ||
title = {A Brief Tutorial on the Ensemble {K}alman Filter}, | ||
howpublished = {arXiv:0901.3725v1 [physics.ao-ph]}, | ||
month = jan, | ||
year = {2009}, | ||
archivePrefix = {arXiv}, | ||
eprint = {0901.3725}, | ||
primaryClass = {physics.ao-ph} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
""" | ||
test_issue91 | ||
~~~~~~~~~~~~ | ||
Test bibtex_default_style config value. | ||
""" | ||
|
||
import os.path | ||
import re | ||
|
||
from sphinx_testing.util import path, with_app | ||
|
||
srcdir = path(__file__).dirname().joinpath('issue91').abspath() | ||
|
||
|
||
def teardown_module(): | ||
(srcdir / '_build').rmtree(True) | ||
|
||
|
||
@with_app(srcdir=srcdir, warningiserror=True) | ||
def test_issue91(app, status, warning): | ||
app.builder.build_all() | ||
# default style is plain; check output | ||
with open(os.path.join(app.outdir, "contents.html")) as stream: | ||
output = stream.read() | ||
# ensure Man09 is cited with plain style and not with alpha style | ||
assert len(re.findall('\\[1\\]', output)) == 2 | ||
assert len(re.findall('\\[Man09\\]', output)) == 0 |