Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit aecfef5

Browse files
upgrade
1 parent f0b0146 commit aecfef5

File tree

15 files changed

+814
-1
lines changed

15 files changed

+814
-1
lines changed

book/_config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,15 @@ sphinx:
3030
launch_buttons:
3131
thebe: true
3232
html_last_updated_fmt: '%B %-d, %Y'
33+
bibtex_default_style: myapastyle
34+
bibtex_reference_style: author_year_round
35+
local_extensions:
36+
apastyle: _ext/
37+
bracket_citation_style: _ext/
3338
extra_extensions:
3439
- sphinx.ext.imgconverter
3540
- jupyterbook_patches
41+
- sphinx_tudelft_theme
3642
- sphinx_image_inverter
3743

3844
bibtex_bibfiles:

book/_ext/apastyle.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# from pybtex.style.formatting.unsrt import Style
3+
from pybtexapastyle.formatting.apa import APAStyle
4+
from pybtexapastyle.labels.apa import LabelStyle as APALabelStyle
5+
from pybtex.plugin import register_plugin
6+
# from pybtex.style.template import names, sentence
7+
8+
class MyAPALabelStyle(APALabelStyle):
9+
def format_label(self, entry):
10+
return APALabelStyle.format_label(self, entry)
11+
12+
class MyAPAStyle(APAStyle):
13+
default_label_style = 'myapa'
14+
15+
def setup(app):
16+
register_plugin('pybtex.style.labels', 'myapa', MyAPALabelStyle)
17+
register_plugin('pybtex.style.formatting', 'myapastyle', MyAPAStyle)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from dataclasses import dataclass, field
2+
import sphinxcontrib.bibtex.plugin
3+
4+
from sphinxcontrib.bibtex.style.referencing import BracketStyle
5+
from sphinxcontrib.bibtex.style.referencing.author_year import AuthorYearReferenceStyle
6+
7+
8+
def bracket_style() -> BracketStyle:
9+
return BracketStyle(
10+
left='(',
11+
right=')',
12+
)
13+
14+
15+
@dataclass
16+
class MyReferenceStyle(AuthorYearReferenceStyle):
17+
bracket_parenthetical: BracketStyle = field(default_factory=bracket_style)
18+
bracket_textual: BracketStyle = field(default_factory=bracket_style)
19+
bracket_author: BracketStyle = field(default_factory=bracket_style)
20+
bracket_label: BracketStyle = field(default_factory=bracket_style)
21+
bracket_year: BracketStyle = field(default_factory=bracket_style)
22+
23+
24+
def setup(app):
25+
sphinxcontrib.bibtex.plugin.register_plugin(
26+
'sphinxcontrib.bibtex.style.referencing',
27+
'author_year_round', MyReferenceStyle)

book/_ext/pybtexapastyle/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Naeka
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

book/_ext/pybtexapastyle/formatting/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)