Skip to content

Commit

Permalink
📝 Fixing sphinx syntax (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus authored Feb 7, 2024
1 parent 57bdc8e commit 9305ca3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
4 changes: 2 additions & 2 deletions bibtexparser/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def __init__(self, message: str):
class RegexMismatchException(ParserStateException):
"""Raised when regex matches are inconsistent, implying a bug in the parser.
For example, raised when first match `@string{`
is not followed by an overlapping match `}`.
For example, raised when first match ``@string{``
is not followed by an overlapping match ``}``.
"""

def __init__(self, first_match, expected_match, second_match):
Expand Down
43 changes: 22 additions & 21 deletions bibtexparser/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
class Block(abc.ABC):
"""A abstract superclass of all top-level building blocks of a bibtex file.
E.g. a `@string` block, a `@preamble` block, an `@entry` block, a comment, etc."""
E.g. a ``@string`` block, a ``@preamble`` block, an ``@entry`` block, a comment, etc.
"""

def __init__(
self,
Expand Down Expand Up @@ -51,15 +52,15 @@ def parser_metadata(self) -> Dict[str, Any]:
return self._parser_metadata

def get_parser_metadata(self, key: str) -> Optional[Any]:
"""EXPERIMENTAL: get auxiliary information stored in `parser_metadata`.
"""EXPERIMENTAL: get auxiliary information stored in ``parser_metadata``.
See attribute `parser_metadata` for more information."""
See attribute ``parser_metadata`` for more information."""
return self._parser_metadata.get(key, None)

def set_parser_metadata(self, key: str, value: Any):
"""EXPERIMENTAL: set auxiliary information stored in `parser_metadata`.
"""EXPERIMENTAL: set auxiliary information stored in ``parser_metadata``.
See attribute `parser_metadata` for more information."""
See attribute ``parser_metadata`` for more information."""
self._parser_metadata[key] = value

def __eq__(self, other):
Expand All @@ -72,7 +73,7 @@ def __eq__(self, other):


class String(Block):
"""Bibtex Blocks of the `@string` type, e.g. @string{me = "My Name"}."""
"""Bibtex Blocks of the ``@string`` type, e.g. ``@string{me = "My Name"}``."""

def __init__(
self,
Expand All @@ -87,7 +88,7 @@ def __init__(

@property
def key(self) -> str:
"""The key of the string, e.g. `me` in `@string{me = "My Name"}`."""
"""The key of the string, e.g. ``me`` in ``@string{me = "My Name"}``."""
return self._key

@key.setter
Expand All @@ -96,7 +97,7 @@ def key(self, value: str):

@property
def value(self) -> str:
"""The value of the string, e.g. `"My Name"` in `@string{me = "My Name"}`."""
"""The value of the string, e.g. ``"My Name"`` in ``@string{me = "My Name"}``."""
return self._value

@value.setter
Expand All @@ -114,7 +115,7 @@ def __repr__(self):


class Preamble(Block):
"""Bibtex Blocks of the `@preamble` type, e.g. @preamble{This is a preamble}."""
"""Bibtex Blocks of the ``@preamble`` type, e.g. ``@preamble{This is a preamble}``."""

def __init__(
self, value: str, start_line: Optional[int] = None, raw: Optional[str] = None
Expand All @@ -124,7 +125,7 @@ def __init__(

@property
def value(self) -> str:
"""The value of the preamble, e.g. `blabla` in `@preamble{blabla}`."""
"""The value of the preamble, e.g. ``blabla`` in ``@preamble{blabla}``."""
return self._value

@value.setter
Expand All @@ -142,7 +143,7 @@ def __repr__(self):


class ExplicitComment(Block):
"""Bibtex Blocks of the `@comment` type, e.g. @comment{This is a comment}."""
"""Bibtex Blocks of the ``@comment`` type, e.g. ``@comment{This is a comment}``."""

def __init__(
self, comment: str, start_line: Optional[int] = None, raw: Optional[str] = None
Expand All @@ -152,7 +153,7 @@ def __init__(

@property
def comment(self) -> str:
"""The value of the comment, e.g. `blabla` in `@comment{blabla}`."""
"""The value of the comment, e.g. ``blabla`` in ``@comment{blabla}``."""
return self._comment

@comment.setter
Expand All @@ -170,7 +171,7 @@ def __repr__(self):


class ImplicitComment(Block):
"""Bibtex outside of an @{...} block, which is treated as a comment."""
"""Bibtex outside of an ``@{...}`` block, which is treated as a comment."""

def __init__(
self, comment: str, start_line: Optional[int] = None, raw: Optional[str] = None
Expand Down Expand Up @@ -198,7 +199,7 @@ def __repr__(self):


class Field:
"""A field of a Bibtex entry, e.g. `author = {John Doe}`."""
"""A field of a Bibtex entry, e.g. ``author = {John Doe}``."""

def __init__(self, key: str, value: Any, start_line: Optional[int] = None):
self._start_line = start_line
Expand All @@ -207,7 +208,7 @@ def __init__(self, key: str, value: Any, start_line: Optional[int] = None):

@property
def key(self) -> str:
"""The key of the field, e.g. `author` in `author = {John Doe}`."""
"""The key of the field, e.g. ``author`` in ``author = {John Doe}``."""
return self._key

@key.setter
Expand All @@ -216,7 +217,7 @@ def key(self, value: str):

@property
def value(self) -> Any:
"""The value of the field, e.g. `{John Doe}` in `author = {John Doe}`."""
"""The value of the field, e.g. ``{John Doe}`` in ``author = {John Doe}``."""
return self._value

@value.setter
Expand Down Expand Up @@ -247,7 +248,7 @@ def __repr__(self):


class Entry(Block):
"""Bibtex Blocks of the `@entry` type, e.g. @article{Cesar2013, ...}."""
"""Bibtex Blocks of the ``@entry`` type, e.g. ``@article{Cesar2013, ...}``."""

def __init__(
self,
Expand All @@ -264,7 +265,7 @@ def __init__(

@property
def entry_type(self):
"""The type of the entry, e.g. `article` in `@article{Cesar2013, ...}`."""
"""The type of the entry, e.g. ``article`` in ``@article{Cesar2013, ...}``."""
return self._entry_type

@entry_type.setter
Expand All @@ -273,7 +274,7 @@ def entry_type(self, value: str):

@property
def key(self):
"""The key of the entry, e.g. `Cesar2013` in `@article{Cesar2013, ...}`."""
"""The key of the entry, e.g. ``Cesar2013`` in ``@article{Cesar2013, ...}``."""
return self._key

@key.setter
Expand All @@ -282,7 +283,7 @@ def key(self, value: str):

@property
def fields(self) -> List[Field]:
"""The key-value attributes of an entry, as `Field` instances."""
"""The key-value attributes of an entry, as ``Field`` instances."""
return self._fields

@fields.setter
Expand Down Expand Up @@ -436,7 +437,7 @@ def __init__(

@property
def key(self) -> str:
"""The key of the entry, e.g. `Cesar2013` in `@article{Cesar2013, ...}`."""
"""The key of the entry, e.g. ``Cesar2013`` in ``@article{Cesar2013, ...}``."""
return self._key

@key.setter
Expand Down

0 comments on commit 9305ca3

Please sign in to comment.