Skip to content

Commit

Permalink
Delete more whitespace to save MBs in the consolidated BibTeX file (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpost authored Nov 8, 2024
1 parent ec9636e commit ee681e4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bin/create_bibtex.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ def create_bibtex(anthology, trgdir, limit=0, clean=False) -> None:
concise_contents,
)

# Convert spaces to tabs to save a bit of space
concise_contents = re.sub(r"\n ", "\n\t", concise_contents)
# Remove whitespace to save space and keep things under 50 MB
concise_contents = re.sub(r",\n +", ",", concise_contents)
concise_contents = re.sub(r" and\n +", " and ", concise_contents)
concise_contents = re.sub(r",\n}", "}", concise_contents)

print(concise_contents, file=file_anthology_raw)

Expand All @@ -182,7 +184,8 @@ def create_bibtex(anthology, trgdir, limit=0, clean=False) -> None:

# If NOBIB is set, generate only three bibs per volume
limit = 0 if os.environ.get("NOBIB", "false") == "false" else 3
log.info(f"NOBIB=true, generating only {limit} BibTEX files per volume")
if limit != 0:
log.info(f"NOBIB=true, generating only {limit} BibTEX files per volume")

anthology = Anthology(importdir=args["--importdir"], fast_load=True)
create_bibtex(anthology, args["--exportdir"], limit=limit, clean=args["--clean"])
Expand Down

0 comments on commit ee681e4

Please sign in to comment.