diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 14441b2..5a24130 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ We are always looking for people to improve the library. Contributions include, ### Some guidelines -1. Be nice! Were all doing this in our free time; no one is obligated to do anything. +1. Be nice! We're all doing this in our free time; no one is obligated to do anything. 2. Add sufficient tests to your PRs. 3. Document your code. 4. Don't hesitate to ask questions. diff --git a/README.md b/README.md index 1999044..4a4d13d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # python-bibtexparser v2 -Welcome to python-bibtexparser, a parser for `.bib` files with a long history and wide adaption. +Welcome to python-bibtexparser, a parser for `.bib` files with a long history and wide adoption. Bibtexparser is available in two versions: V1 and V2. For new projects, we recommend using v2 which, in the long run, will provide an overall more robust and faster experience. **For now, however, note that v2 is an early beta, and does not contain all features of v1**. Install v2 using pip: @@ -61,7 +61,7 @@ bib_database = bibtexparser.parse_string(bibtex_string, # Let's transform it back to a bibtex_string. new_bibtex_string = bibtexparser.write_string(bib_database, - # Revert aboves transfomration + # Revert above transformation prepend_middleware=[MergeNameParts(), MergeCoAuthors()] ) ``` @@ -76,14 +76,14 @@ Consult the documentation for a list of available middleware, parsing options an The architecture consists of the following components: #### Library -Reflects the contents of a parsed bibtex files, including all comments, entries, strings, preamples and their metadata (e.g. order). +Reflects the contents of a parsed bibtex files, including all comments, entries, strings, preambles and their metadata (e.g. order). #### A Splitter Splits a bibtex string into basic blocks (Entry, String, Preamble, ...), with correspondingly split content (e.g. fields on Entry, key-value on String, ...). The splitter aims to be forgiving when facing invalid bibtex: A line starting with a block definition (``@....``) ends the previous block, even if not yet every bracket is closed, failing the parsing of the previous block. Correspondingly, one block type is "ParsingFailedBlock". #### Middleware -Middleware layers transform a library and its blocks, for example by decoding latex special characters, interpolating string references, resoling crossreferences or re-ordering blocks. Thus, the choice of middleware allows to customize parsing and writing to ones specific usecase. Note: Middlewares, by default, no not mutate their input, but return a modified copy. +Middleware layers transform a library and its blocks, for example by decoding latex special characters, interpolating string references, resolving crossreferences or re-ordering blocks. Thus, the choice of middleware allows to customize parsing and writing to ones specific usecase. Note: Middlewares, by default, do not mutate their input, but return a modified copy. #### Writer Writes the content of a bibtex library to a ``.bib`` file. Optional formatting parameters can be passed using a corresponding dedicated data structure. diff --git a/bibtexparser/entrypoint.py b/bibtexparser/entrypoint.py index f1bad67..2ca2bcd 100644 --- a/bibtexparser/entrypoint.py +++ b/bibtexparser/entrypoint.py @@ -174,7 +174,7 @@ def write_string( :param unparse_stack: List of middleware to apply to the database before writing. If None, a default stack will be used. :param prepend_middleware: List of middleware to prepend to the default stack. - Only applicable if `parse_stack` is None. + Only applicable if `unparse_stack` is None. :param bibtex_format: Customized BibTeX format to use (optional). """ middleware: Middleware diff --git a/bibtexparser/middlewares/latex_encoding.py b/bibtexparser/middlewares/latex_encoding.py index fd3d130..9556c91 100644 --- a/bibtexparser/middlewares/latex_encoding.py +++ b/bibtexparser/middlewares/latex_encoding.py @@ -166,9 +166,9 @@ def __init__( if decoder is not None and (keep_braced_groups is not None or keep_math_mode is not None): raise ValueError( - "Cannot specify both encoder and one of " - "`keep_braced_groups` or `keep_braced_groups`." - "If you want to use a custom encoder, " + "Cannot specify both decoder and one of " + "`keep_braced_groups` or `keep_math_mode`." + "If you want to use a custom decoder, " "you have to specify it completely." ) diff --git a/bibtexparser/middlewares/names.py b/bibtexparser/middlewares/names.py index 415beea..e0a3d0f 100644 --- a/bibtexparser/middlewares/names.py +++ b/bibtexparser/middlewares/names.py @@ -196,7 +196,7 @@ def metadata_key(cls) -> str: return "merge_name_parts" def _transform_field_value(self, name) -> List[str]: - if not isinstance(name, list) and all(isinstance(n, NameParts) for n in name): + if not (isinstance(name, list) and all(isinstance(n, NameParts) for n in name)): raise ValueError(f"Expected a list of NameParts, got {name}. ") if self.style == "last": diff --git a/bibtexparser/model.py b/bibtexparser/model.py index 4558efa..1f775c3 100644 --- a/bibtexparser/model.py +++ b/bibtexparser/model.py @@ -7,7 +7,7 @@ class Block(abc.ABC): - """A abstract superclass of all top-level building blocks of a bibtex file. + """An 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. """ diff --git a/bibtexparser/splitter.py b/bibtexparser/splitter.py index 634580a..a4f6afc 100644 --- a/bibtexparser/splitter.py +++ b/bibtexparser/splitter.py @@ -310,7 +310,7 @@ def split(self, library: Optional[Library] = None) -> Library: logger.error(e.message) raise e except Exception as e: - # For unknown exeptions, we want to fail hard and get the info in our issue tracker. + # For unknown exceptions, we want to fail hard and get the info in our issue tracker. logger.error( f"Unexpected exception while parsing `{m_val}` block (line {start_line})" "Please report this bug." diff --git a/docs/source/biber.rst b/docs/source/biber.rst index 0d9391d..fb58c3f 100644 --- a/docs/source/biber.rst +++ b/docs/source/biber.rst @@ -3,8 +3,8 @@ Biber & Biblatex ================ -Due to its simpel and high-level nature, this library should not only support BibTeX, but also be able to part biblatex and biber files +Due to its simple and high-level nature, this library should not only support BibTeX, but also be able to parse biblatex and biber files with ease, as they all share the same general syntax. -That said, we did not explicitely check against all of biber and biblatex features. Should you detect anything which is not supported, +That said, we did not explicitly check against all of biber and biblatex features. Should you detect anything which is not supported, please open an issue or send a pull request. diff --git a/docs/source/customize.rst b/docs/source/customize.rst index c7b2c3d..6f94d6d 100644 --- a/docs/source/customize.rst +++ b/docs/source/customize.rst @@ -98,7 +98,7 @@ Names * :mod:`bibtexparser.middlewares.SeparateCoAuthors` * :mod:`bibtexparser.middlewares.MergeCoAuthors` -* :mod:`bibtexparser.middlewares.SplitNameParts` (requires SeperateCoAuthors to be applied first) +* :mod:`bibtexparser.middlewares.SplitNameParts` (requires SeparateCoAuthors to be applied first) * :mod:`bibtexparser.middlewares.MergeNameParts` .. _middleware_sorting: diff --git a/docs/source/install.rst b/docs/source/install.rst index 26d1af5..ec23ec3 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -5,6 +5,7 @@ Installation Requirements ------------ + Bibtexparser's only requirement is a python interpreter which is not yet EOL (currently >= 3.9). As of version 2.0.0, bibtexparser is a pure-python project (no direct bindings to C libraries). diff --git a/docs/source/migrate.rst b/docs/source/migrate.rst index 6bd3c31..bdd65f6 100644 --- a/docs/source/migrate.rst +++ b/docs/source/migrate.rst @@ -10,7 +10,7 @@ Status of v2 The v2 branch is well tested and reasonably stable, but it is not yet widely adopted - as an early adopter, you may encounter some bugs. If you do, please report them on the issue tracker. -Also, note that some interfaces may change sightly before we release v2.0.0 as stable. +Also, note that some interfaces may change slightly before we release v2.0.0 as stable. Some customizations from v1 are not implemented in v2, as we doubt they are widely used. If you need one of these features, please let us know on the issue tracker. @@ -51,7 +51,7 @@ As such, it makes reduced use of the new features of v2 and makes use of backwar Changing the entrypoint with default settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -To make sure that users dont "migrate by accident" to bibtex v2, we changed the entrypoint of the package: +To make sure that users don't "migrate by accident" to bibtex v2, we changed the entrypoint of the package: .. code-block:: python @@ -102,5 +102,5 @@ but for them, the migration is straight forward and we will not go into detail h Writing a bibtex file (possibly with customizations) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The way to write a bibtex file has changed fundamentally in v2, and is now handeled in a fashion very similar to the parsing. +The way to write a bibtex file has changed fundamentally in v2, and is now handled in a fashion very similar to the parsing. See the :ref:`writing quickstart ` and :ref:`writing formatting ` for more information. diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index d2d0997..692100f 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -20,7 +20,7 @@ Prerequisite: Vocabulary In an entry, you can find * an **entry type** like ``article``, ``book``, etc. -* and **entry key**, e.g. ``Cesar2013`` in ``@article{Cesar2013, ...}``. +* an **entry key**, e.g. ``Cesar2013`` in ``@article{Cesar2013, ...}``. * and **fields**, which are the key-value pairs in the entry, e.g. ``author = {Jean César}``. * each field has a **field key** and a **field value**.