bib_cleaner package

Submodules

bib_cleaner.bib_cleaner module

Main module.

bib_cleaner.bib_cleaner.get_minimal_bib(master_bib, all_tags)[source]

Get the minimal bib file contents.

Parameters:
master_bib : str

Name of master bibliography file which has all citations.

all_tags : List[str]

List of all tags from the TeX files. (where tags are the names that go in cite{} commands in TeX files.)

Returns:
new_contents : str

Contents of the cleaned bib file.

n_used_bibs : int

Number of bib entries used in TeX files.

n_total_bibs : int

Number of bib entries in master.bib.

len_contents : int

Number of lines in master.bib.

bib_cleaner.bib_cleaner.tex_to_tags(tex_files)[source]

Extract tags from TeX files.

Given a list of TeX files, extract the citation tags which are contained in \cite{}. Split multiple citations (e.g. \cite{A, B}) into individual tags (A, B).

Parameters:
tex_files : List[str]

List of TeX files.

Returns:
all_tags : List[str]

List of individual tags.

Notes

Assume :

  1. Citation tags are a combination of letters, numbers, underscores(_) and hyphens (-).
  2. Multiple citations are separated by commas.
  3. Spaces on either side of the comma are okay.
  4. The following don’t appear within citation tag: newlines, accented characters.

bib_cleaner.cli module

Console script for bib_cleaner.

bib_cleaner.cli.main()[source]

Console script for bib_cleaner.

Module contents

Top-level package for Bib Cleaner.