mirror of
https://github.com/TeachBooks/manual.git
synced 2026-11-12 22:35:51 +00:00
27 lines
No EOL
927 B
Python
27 lines
No EOL
927 B
Python
from dataclasses import dataclass, field
|
|
import sphinxcontrib.bibtex.plugin
|
|
|
|
from sphinxcontrib.bibtex.style.referencing import BracketStyle
|
|
from sphinxcontrib.bibtex.style.referencing.author_year import AuthorYearReferenceStyle
|
|
|
|
|
|
def bracket_style() -> BracketStyle:
|
|
return BracketStyle(
|
|
left='(',
|
|
right=')',
|
|
)
|
|
|
|
|
|
@dataclass
|
|
class MyReferenceStyle(AuthorYearReferenceStyle):
|
|
bracket_parenthetical: BracketStyle = field(default_factory=bracket_style)
|
|
bracket_textual: BracketStyle = field(default_factory=bracket_style)
|
|
bracket_author: BracketStyle = field(default_factory=bracket_style)
|
|
bracket_label: BracketStyle = field(default_factory=bracket_style)
|
|
bracket_year: BracketStyle = field(default_factory=bracket_style)
|
|
|
|
|
|
def setup(app):
|
|
sphinxcontrib.bibtex.plugin.register_plugin(
|
|
'sphinxcontrib.bibtex.style.referencing',
|
|
'author_year_round', MyReferenceStyle) |