Skip to main content

A minimalistic bibLaTeX linter by Tristan Cuvelier.

Project description

bibla

bibla is a minimalistic linter (style checker) for biblatex files with support for libraries managed by JabRef.

bibla does not come with its own biblatex parser, but leverages the pybtex parser.

Bibla is an extension of bibl, which was made by Arne Van Den Kerckhove. The original Bibl can be found here. I do not claim any form of ownership over the original Bibl, I have only made some changes to it. Those changes I do claim ownership over. Just like the original Bibl, this will also be licensed under the MIT license.

Installation

pip install bibla

Usage - This still needs to receive an update!

Run bibla on your biblatex files with the following command

bibla lint bibliography1.bib bibliography2.bib ... 

or as a python module with

python -m bibla lint bibliography1.bib bibliography2.bib ... 

bibla will check these files for a variety of style issues and deviations from the biblatex spec (http://www.biblatex.org/Format/, https://en.wikipedia.org/wiki/biblatex). Each possible type of issue is formulated as a rule. Each rule is identified by a unique code. Some examples of rules are

Rule ID Rule description
D00 Entry not in alphabetical order by ke
T00 Non-ascii character
E00 Keys of published works should have format AuthorYEARa
E06 Incorrect doi format
T01 Non-standard whitespace at beginning of line (indents should be 4 spaces)
M01ArticleYear Missing required field year for entry type article
... ...

This link provides a list of all available rules [TODO] generated with the default configuration (see Configuration section below).

The first character of a rule id refers to a rules category, e.g. E for issues with entry values, T for textual issues with the .bib file, etc. You can specify which rules to check by using --select or --ignore. Wildcards are allowed. --select will only enable the specified rules, disabling all other rules, while --ignore will disable all rules except the ones specified. --select and --ignore may not be specified simultaneously.

bibla --select "D*,E06,T01" lint bibliography.bib

will only check all rules starting with D, rule E06 and rule T01

bibla --ignore "D*,E06,T01" lint bibliography.bib

will check all rules except all rules starting with D, rule E06 and rule T01

Configuration

Aside from --select and --ignore, other configuration options can be provided via the cli, like --max-line-length to specify the line length for which an issue should be reported if exceeded. See below for a full list.

Configuration can also be specified in a yaml format configuration file, provided by the --config option. If no configuration file is provided and a bibla.yml or .bibla.yml file is present in the current working directory, this file will be used as a configuration file. Command line option configuration will override configuration provided by a file. See the default configuration bibla.yml [TODO] for all values that can be overwritten in a configuration file.

Some rules, like the various M01*, M02* and U01* rules, are procedurally generated based on the type_spec setting. This setting specifies which entry and field types should be present and can be modified to more easily ignore generated rules for specific entry types or fields, or to add custom fields or entry types for which warnings should be given while linting.

CLI

Usage: bibla [OPTIONS] COMMAND [ARGS]...

Options:
  -c, --config TEXT          Custom configuration file path.
  --select TEXT              Comma separated list of enabled rules, all other
                             rules will be disabled.

  --ignore TEXT              Comma separated list of disabled rules, all other
                             rules will be enabled.

  --indent-spaces INTEGER    Number of trailing whitespaces for indented line,
                             used by TO1.

  --max-line-length INTEGER  Max line length before wrap recommended, used by
                             T03.

  --abbreviation-dot         Abbreviate middle names with dot.
  --help                     Show this message and exit.

Commands:
  lint          Lint a biblatex bibliography file.
  list-all      Show all available rules.
  list-enabled  Show all rules enabled by the configuration.
  version       Show the package version.
Usage: bibla lint [OPTIONS] [BIBLIOGRAPHY]...

  Lint a biblatex bibliography file.

Options:
  --help  Show this message and exit.
Usage: bibla list-all [OPTIONS]

  Show all available rules.

Options:
  -m      Format rules as markdown table.
  --help  Show this message and exit.
Usage: bibla list-enabled [OPTIONS]

  Show all rules enabled by the configuration.

Options:
  -m      Format rules as markdown table.
  --help  Show this message and exit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bibla-2.0.4.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

bibla-2.0.4-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file bibla-2.0.4.tar.gz.

File metadata

  • Download URL: bibla-2.0.4.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for bibla-2.0.4.tar.gz
Algorithm Hash digest
SHA256 7d9976bb5f9880f77c02b7957f0f253422cd438ec9d8eec61f71b7b97c3c2659
MD5 cab1d844efd74cfa1d1699092e3342e4
BLAKE2b-256 15a85638e0ed01d2a62a407e0abe1febb48833d67d99eecaa24545bb2ad1d5f3

See more details on using hashes here.

File details

Details for the file bibla-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: bibla-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for bibla-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 871d3f189f6c79e3c2d3665c562dc851eb0caaf6946e55af796fdb68ef433201
MD5 de7ba255e2b916fda1e966bfdc45656b
BLAKE2b-256 831942a005f9b311dd8f7788a466a30688b004d22fc53d577ae4df7822d47a9d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page