We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Compact bibfile
Overleaf has a 50 MB file size limit, and `anthology.bib` is now larger than this. We should create a compact BibTeX export using string substitution [as suggested here](https://twitter.com/daniel_hers/status/1744434842895294496). I'm not sure if this should just replace the current Anthology bib file, or become a new export, say `anthology-compact.bib`:

* The advantage of encompactifying the current file is it would work for everyone without having to change anything.
* The disadvantage is it complicates cutting-and-pasting.
* However, we already have [https://aclanthology.org/anthology+abstracts.bib.gz](https://aclanthology.org/anthology+abstracts.bib.gz). I'm not sure how often people cut-and-paste individual entries from the complete file, anyway; it seems that it's main use is in Overleaf.

I'm therefore include to simply replace `anthology.bib`.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bin/create_bibtex.py`
Content:
```
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 #
4 # Copyright 2019 Marcel Bollmann <marcel@bollmann.me>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 
18 """Usage: create_bibtex.py [--importdir=DIR] [--exportdir=DIR] [-c] [--debug]
19 
20 Creates .bib files for all papers in the Hugo directory.
21 
22 Options:
23   --importdir=DIR          Directory to import XML files from. [default: {scriptdir}/../data/]
24   --exportdir=DIR          Directory to write exported files to.   [default: {scriptdir}/../build/data-export/]
25   --debug                  Output debug-level log messages.
26   -c, --clean              Delete existing files in target directory before generation.
27   -h, --help               Display this helpful text.
28 """
29 
30 from docopt import docopt
31 from tqdm import tqdm
32 import gzip
33 import logging as log
34 import os
35 
36 from anthology import Anthology
37 from anthology.utils import SeverityTracker, deconstruct_anthology_id, infer_year
38 from create_hugo_pages import check_directory
39 
40 
41 def volume_sorter(volume_tuple):
42     """
43     Extracts the year so that we can sort by the year and then
44     the collection ID.
45     """
46     volume_id = volume_tuple[0]
47     collection_id, year, _ = deconstruct_anthology_id(volume_id)
48     year = infer_year(collection_id)
49     return year, volume_id
50 
51 
52 def create_bibtex(anthology, trgdir, limit=0, clean=False) -> None:
53     """Creates .bib files for all papers.
54 
55     :param anthology: The Anthology object.
56     :param trgdir: The target directory to write to
57     :param limit: If nonzero, only generate {limit} entries per volume
58     :param clean: Clean the directory first
59     """
60     if not check_directory("{}/papers".format(trgdir), clean=clean):
61         return
62     if not check_directory("{}/volumes".format(trgdir), clean=clean):
63         return
64 
65     log.info("Creating BibTeX files for all papers...")
66     with open(
67         "{}/anthology.bib".format(trgdir), "wt", encoding="utf-8"
68     ) as file_anthology_raw, gzip.open(
69         "{}/anthology.bib.gz".format(trgdir), "wt", encoding="utf-8"
70     ) as file_anthology, gzip.open(
71         "{}/anthology+abstracts.bib.gz".format(trgdir), "wt", encoding="utf-8"
72     ) as file_anthology_with_abstracts:
73         for volume_id, volume in tqdm(
74             sorted(anthology.volumes.items(), key=volume_sorter, reverse=True)
75         ):
76             volume_dir = trgdir
77             if not os.path.exists(volume_dir):
78                 os.makedirs(volume_dir)
79             with open("{}/volumes/{}.bib".format(trgdir, volume_id), "w") as file_volume:
80                 for i, paper in enumerate(volume, 1):
81                     if limit and i > limit:
82                         break
83 
84                     with open(
85                         "{}/{}.bib".format(volume_dir, paper.full_id), "w"
86                     ) as file_paper:
87                         contents = paper.as_bibtex()
88                         print(contents, file=file_paper)
89                         print(contents, file=file_anthology_with_abstracts)
90 
91                         concise_contents = paper.as_bibtex(concise=True)
92                         print(concise_contents, file=file_volume)
93                         print(concise_contents, file=file_anthology)
94                         print(concise_contents, file=file_anthology_raw)
95 
96 
97 if __name__ == "__main__":
98     args = docopt(__doc__)
99     scriptdir = os.path.dirname(os.path.abspath(__file__))
100     if "{scriptdir}" in args["--importdir"]:
101         args["--importdir"] = os.path.abspath(
102             args["--importdir"].format(scriptdir=scriptdir)
103         )
104     if "{scriptdir}" in args["--exportdir"]:
105         args["--exportdir"] = os.path.abspath(
106             args["--exportdir"].format(scriptdir=scriptdir)
107         )
108 
109     log_level = log.DEBUG if args["--debug"] else log.INFO
110     log.basicConfig(format="%(levelname)-8s %(message)s", level=log_level)
111     tracker = SeverityTracker()
112     log.getLogger().addHandler(tracker)
113 
114     # If NOBIB is set, generate only three bibs per volume
115     limit = 0 if os.environ.get("NOBIB", "false") == "false" else 3
116     log.info(f"NOBIB=true, generating only {limit} BibTEX files per volume")
117 
118     anthology = Anthology(importdir=args["--importdir"], fast_load=True)
119     create_bibtex(anthology, args["--exportdir"], limit=limit, clean=args["--clean"])
120 
121     if tracker.highest >= log.ERROR:
122         exit(1)
123
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/bin/create_bibtex.py b/bin/create_bibtex.py
--- a/bin/create_bibtex.py
+++ b/bin/create_bibtex.py
@@ -27,6 +27,7 @@
   -h, --help               Display this helpful text.
 """
 
+import re
 from docopt import docopt
 from tqdm import tqdm
 import gzip
@@ -70,9 +71,20 @@
     ) as file_anthology, gzip.open(
         "{}/anthology+abstracts.bib.gz".format(trgdir), "wt", encoding="utf-8"
     ) as file_anthology_with_abstracts:
+        # Add some shortcuts to the consolidated bib file
+        print(
+            "@string{acl = {Association for Computational Linguistics}}",
+            file=file_anthology_raw,
+        )
+        print("@string{anth = {https://aclanthology.org/}}", file=file_anthology_raw)
+        print(file=file_anthology_raw)
+
         for volume_id, volume in tqdm(
             sorted(anthology.volumes.items(), key=volume_sorter, reverse=True)
         ):
+            # reset this each time
+            abbrev = None
+
             volume_dir = trgdir
             if not os.path.exists(volume_dir):
                 os.makedirs(volume_dir)
@@ -91,6 +103,53 @@
                         concise_contents = paper.as_bibtex(concise=True)
                         print(concise_contents, file=file_volume)
                         print(concise_contents, file=file_anthology)
+
+                        # Space saver (https://github.com/acl-org/acl-anthology/issues/3016)
+                        # Replace verbose text with abbreviations to get the file under 50 MB for Overleaf
+
+                        concise_contents = concise_contents.replace(
+                            'publisher = "Association for Computational Linguistics",',
+                            "publisher = acl,",
+                        )
+                        concise_contents = re.sub(
+                            r'url = "https://aclanthology.org/(.*)"',
+                            r"url = anth # {\1}",
+                            concise_contents,
+                        )
+
+                        # Abbreviate the booktitle by extracting it and printing it before
+                        # the first entry in each volume
+                        if concise_contents.startswith("@proceedings"):
+                            # Grab the title string and create the alias
+                            abbrev = f"{volume.get_venues()[0].upper()}:{infer_year(volume.collection_id)}:{volume.volume_id}"
+                            try:
+                                booktitle = re.search(
+                                    r"    title = \"(.*)\",", concise_contents
+                                ).group(1)
+                                print(
+                                    f"@string{{{abbrev} = {{{booktitle}}}}}",
+                                    file=file_anthology_raw,
+                                )
+                            except AttributeError:
+                                import sys
+
+                                print(
+                                    f"Could not find title for {volume_id}",
+                                    file=sys.stderr,
+                                )
+                                abbrev = None
+
+                        if abbrev is not None and "booktitle" in concise_contents:
+                            # substitute the alias for the booktitle
+                            concise_contents = re.sub(
+                                r"    booktitle = (\".*\"),",
+                                f"    booktitle = {abbrev},",
+                                concise_contents,
+                            )
+
+                        # Remove newlines, indentations, and double-spaces around author separators
+                        concise_contents = re.sub(r"\s+", " ", concise_contents)
+
                         print(concise_contents, file=file_anthology_raw)

{"golden_diff": "diff --git a/bin/create_bibtex.py b/bin/create_bibtex.py\n--- a/bin/create_bibtex.py\n+++ b/bin/create_bibtex.py\n@@ -27,6 +27,7 @@\n   -h, --help               Display this helpful text.\n \"\"\"\n \n+import re\n from docopt import docopt\n from tqdm import tqdm\n import gzip\n@@ -70,9 +71,20 @@\n     ) as file_anthology, gzip.open(\n         \"{}/anthology+abstracts.bib.gz\".format(trgdir), \"wt\", encoding=\"utf-8\"\n     ) as file_anthology_with_abstracts:\n+        # Add some shortcuts to the consolidated bib file\n+        print(\n+            \"@string{acl = {Association for Computational Linguistics}}\",\n+            file=file_anthology_raw,\n+        )\n+        print(\"@string{anth = {https://aclanthology.org/}}\", file=file_anthology_raw)\n+        print(file=file_anthology_raw)\n+\n         for volume_id, volume in tqdm(\n             sorted(anthology.volumes.items(), key=volume_sorter, reverse=True)\n         ):\n+            # reset this each time\n+            abbrev = None\n+\n             volume_dir = trgdir\n             if not os.path.exists(volume_dir):\n                 os.makedirs(volume_dir)\n@@ -91,6 +103,53 @@\n                         concise_contents = paper.as_bibtex(concise=True)\n                         print(concise_contents, file=file_volume)\n                         print(concise_contents, file=file_anthology)\n+\n+                        # Space saver (https://github.com/acl-org/acl-anthology/issues/3016)\n+                        # Replace verbose text with abbreviations to get the file under 50 MB for Overleaf\n+\n+                        concise_contents = concise_contents.replace(\n+                            'publisher = \"Association for Computational Linguistics\",',\n+                            \"publisher = acl,\",\n+                        )\n+                        concise_contents = re.sub(\n+                            r'url = \"https://aclanthology.org/(.*)\"',\n+                            r\"url = anth # {\\1}\",\n+                            concise_contents,\n+                        )\n+\n+                        # Abbreviate the booktitle by extracting it and printing it before\n+                        # the first entry in each volume\n+                        if concise_contents.startswith(\"@proceedings\"):\n+                            # Grab the title string and create the alias\n+                            abbrev = f\"{volume.get_venues()[0].upper()}:{infer_year(volume.collection_id)}:{volume.volume_id}\"\n+                            try:\n+                                booktitle = re.search(\n+                                    r\"    title = \\\"(.*)\\\",\", concise_contents\n+                                ).group(1)\n+                                print(\n+                                    f\"@string{{{abbrev} = {{{booktitle}}}}}\",\n+                                    file=file_anthology_raw,\n+                                )\n+                            except AttributeError:\n+                                import sys\n+\n+                                print(\n+                                    f\"Could not find title for {volume_id}\",\n+                                    file=sys.stderr,\n+                                )\n+                                abbrev = None\n+\n+                        if abbrev is not None and \"booktitle\" in concise_contents:\n+                            # substitute the alias for the booktitle\n+                            concise_contents = re.sub(\n+                                r\"    booktitle = (\\\".*\\\"),\",\n+                                f\"    booktitle = {abbrev},\",\n+                                concise_contents,\n+                            )\n+\n+                        # Remove newlines, indentations, and double-spaces around author separators\n+                        concise_contents = re.sub(r\"\\s+\", \" \", concise_contents)\n+\n                         print(concise_contents, file=file_anthology_raw)\n", "issue": "Compact bibfile\nOverleaf has a 50 MB file size limit, and `anthology.bib` is now larger than this. We should create a compact BibTeX export using string substitution [as suggested here](https://twitter.com/daniel_hers/status/1744434842895294496). I'm not sure if this should just replace the current Anthology bib file, or become a new export, say `anthology-compact.bib`:\r\n\r\n* The advantage of encompactifying the current file is it would work for everyone without having to change anything.\r\n* The disadvantage is it complicates cutting-and-pasting.\r\n* However, we already have [https://aclanthology.org/anthology+abstracts.bib.gz](https://aclanthology.org/anthology+abstracts.bib.gz). I'm not sure how often people cut-and-paste individual entries from the complete file, anyway; it seems that it's main use is in Overleaf.\r\n\r\nI'm therefore include to simply replace `anthology.bib`.\n", "before_files": [{"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Copyright 2019 Marcel Bollmann <marcel@bollmann.me>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Usage: create_bibtex.py [--importdir=DIR] [--exportdir=DIR] [-c] [--debug]\n\nCreates .bib files for all papers in the Hugo directory.\n\nOptions:\n  --importdir=DIR          Directory to import XML files from. [default: {scriptdir}/../data/]\n  --exportdir=DIR          Directory to write exported files to.   [default: {scriptdir}/../build/data-export/]\n  --debug                  Output debug-level log messages.\n  -c, --clean              Delete existing files in target directory before generation.\n  -h, --help               Display this helpful text.\n\"\"\"\n\nfrom docopt import docopt\nfrom tqdm import tqdm\nimport gzip\nimport logging as log\nimport os\n\nfrom anthology import Anthology\nfrom anthology.utils import SeverityTracker, deconstruct_anthology_id, infer_year\nfrom create_hugo_pages import check_directory\n\n\ndef volume_sorter(volume_tuple):\n    \"\"\"\n    Extracts the year so that we can sort by the year and then\n    the collection ID.\n    \"\"\"\n    volume_id = volume_tuple[0]\n    collection_id, year, _ = deconstruct_anthology_id(volume_id)\n    year = infer_year(collection_id)\n    return year, volume_id\n\n\ndef create_bibtex(anthology, trgdir, limit=0, clean=False) -> None:\n    \"\"\"Creates .bib files for all papers.\n\n    :param anthology: The Anthology object.\n    :param trgdir: The target directory to write to\n    :param limit: If nonzero, only generate {limit} entries per volume\n    :param clean: Clean the directory first\n    \"\"\"\n    if not check_directory(\"{}/papers\".format(trgdir), clean=clean):\n        return\n    if not check_directory(\"{}/volumes\".format(trgdir), clean=clean):\n        return\n\n    log.info(\"Creating BibTeX files for all papers...\")\n    with open(\n        \"{}/anthology.bib\".format(trgdir), \"wt\", encoding=\"utf-8\"\n    ) as file_anthology_raw, gzip.open(\n        \"{}/anthology.bib.gz\".format(trgdir), \"wt\", encoding=\"utf-8\"\n    ) as file_anthology, gzip.open(\n        \"{}/anthology+abstracts.bib.gz\".format(trgdir), \"wt\", encoding=\"utf-8\"\n    ) as file_anthology_with_abstracts:\n        for volume_id, volume in tqdm(\n            sorted(anthology.volumes.items(), key=volume_sorter, reverse=True)\n        ):\n            volume_dir = trgdir\n            if not os.path.exists(volume_dir):\n                os.makedirs(volume_dir)\n            with open(\"{}/volumes/{}.bib\".format(trgdir, volume_id), \"w\") as file_volume:\n                for i, paper in enumerate(volume, 1):\n                    if limit and i > limit:\n                        break\n\n                    with open(\n                        \"{}/{}.bib\".format(volume_dir, paper.full_id), \"w\"\n                    ) as file_paper:\n                        contents = paper.as_bibtex()\n                        print(contents, file=file_paper)\n                        print(contents, file=file_anthology_with_abstracts)\n\n                        concise_contents = paper.as_bibtex(concise=True)\n                        print(concise_contents, file=file_volume)\n                        print(concise_contents, file=file_anthology)\n                        print(concise_contents, file=file_anthology_raw)\n\n\nif __name__ == \"__main__\":\n    args = docopt(__doc__)\n    scriptdir = os.path.dirname(os.path.abspath(__file__))\n    if \"{scriptdir}\" in args[\"--importdir\"]:\n        args[\"--importdir\"] = os.path.abspath(\n            args[\"--importdir\"].format(scriptdir=scriptdir)\n        )\n    if \"{scriptdir}\" in args[\"--exportdir\"]:\n        args[\"--exportdir\"] = os.path.abspath(\n            args[\"--exportdir\"].format(scriptdir=scriptdir)\n        )\n\n    log_level = log.DEBUG if args[\"--debug\"] else log.INFO\n    log.basicConfig(format=\"%(levelname)-8s %(message)s\", level=log_level)\n    tracker = SeverityTracker()\n    log.getLogger().addHandler(tracker)\n\n    # If NOBIB is set, generate only three bibs per volume\n    limit = 0 if os.environ.get(\"NOBIB\", \"false\") == \"false\" else 3\n    log.info(f\"NOBIB=true, generating only {limit} BibTEX files per volume\")\n\n    anthology = Anthology(importdir=args[\"--importdir\"], fast_load=True)\n    create_bibtex(anthology, args[\"--exportdir\"], limit=limit, clean=args[\"--clean\"])\n\n    if tracker.highest >= log.ERROR:\n        exit(1)\n", "path": "bin/create_bibtex.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n#\n# Copyright 2019 Marcel Bollmann <marcel@bollmann.me>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Usage: create_bibtex.py [--importdir=DIR] [--exportdir=DIR] [-c] [--debug]\n\nCreates .bib files for all papers in the Hugo directory.\n\nOptions:\n  --importdir=DIR          Directory to import XML files from. [default: {scriptdir}/../data/]\n  --exportdir=DIR          Directory to write exported files to.   [default: {scriptdir}/../build/data-export/]\n  --debug                  Output debug-level log messages.\n  -c, --clean              Delete existing files in target directory before generation.\n  -h, --help               Display this helpful text.\n\"\"\"\n\nimport re\nfrom docopt import docopt\nfrom tqdm import tqdm\nimport gzip\nimport logging as log\nimport os\n\nfrom anthology import Anthology\nfrom anthology.utils import SeverityTracker, deconstruct_anthology_id, infer_year\nfrom create_hugo_pages import check_directory\n\n\ndef volume_sorter(volume_tuple):\n    \"\"\"\n    Extracts the year so that we can sort by the year and then\n    the collection ID.\n    \"\"\"\n    volume_id = volume_tuple[0]\n    collection_id, year, _ = deconstruct_anthology_id(volume_id)\n    year = infer_year(collection_id)\n    return year, volume_id\n\n\ndef create_bibtex(anthology, trgdir, limit=0, clean=False) -> None:\n    \"\"\"Creates .bib files for all papers.\n\n    :param anthology: The Anthology object.\n    :param trgdir: The target directory to write to\n    :param limit: If nonzero, only generate {limit} entries per volume\n    :param clean: Clean the directory first\n    \"\"\"\n    if not check_directory(\"{}/papers\".format(trgdir), clean=clean):\n        return\n    if not check_directory(\"{}/volumes\".format(trgdir), clean=clean):\n        return\n\n    log.info(\"Creating BibTeX files for all papers...\")\n    with open(\n        \"{}/anthology.bib\".format(trgdir), \"wt\", encoding=\"utf-8\"\n    ) as file_anthology_raw, gzip.open(\n        \"{}/anthology.bib.gz\".format(trgdir), \"wt\", encoding=\"utf-8\"\n    ) as file_anthology, gzip.open(\n        \"{}/anthology+abstracts.bib.gz\".format(trgdir), \"wt\", encoding=\"utf-8\"\n    ) as file_anthology_with_abstracts:\n        # Add some shortcuts to the consolidated bib file\n        print(\n            \"@string{acl = {Association for Computational Linguistics}}\",\n            file=file_anthology_raw,\n        )\n        print(\"@string{anth = {https://aclanthology.org/}}\", file=file_anthology_raw)\n        print(file=file_anthology_raw)\n\n        for volume_id, volume in tqdm(\n            sorted(anthology.volumes.items(), key=volume_sorter, reverse=True)\n        ):\n            # reset this each time\n            abbrev = None\n\n            volume_dir = trgdir\n            if not os.path.exists(volume_dir):\n                os.makedirs(volume_dir)\n            with open(\"{}/volumes/{}.bib\".format(trgdir, volume_id), \"w\") as file_volume:\n                for i, paper in enumerate(volume, 1):\n                    if limit and i > limit:\n                        break\n\n                    with open(\n                        \"{}/{}.bib\".format(volume_dir, paper.full_id), \"w\"\n                    ) as file_paper:\n                        contents = paper.as_bibtex()\n                        print(contents, file=file_paper)\n                        print(contents, file=file_anthology_with_abstracts)\n\n                        concise_contents = paper.as_bibtex(concise=True)\n                        print(concise_contents, file=file_volume)\n                        print(concise_contents, file=file_anthology)\n\n                        # Space saver (https://github.com/acl-org/acl-anthology/issues/3016)\n                        # Replace verbose text with abbreviations to get the file under 50 MB for Overleaf\n\n                        concise_contents = concise_contents.replace(\n                            'publisher = \"Association for Computational Linguistics\",',\n                            \"publisher = acl,\",\n                        )\n                        concise_contents = re.sub(\n                            r'url = \"https://aclanthology.org/(.*)\"',\n                            r\"url = anth # {\\1}\",\n                            concise_contents,\n                        )\n\n                        # Abbreviate the booktitle by extracting it and printing it before\n                        # the first entry in each volume\n                        if concise_contents.startswith(\"@proceedings\"):\n                            # Grab the title string and create the alias\n                            abbrev = f\"{volume.get_venues()[0].upper()}:{infer_year(volume.collection_id)}:{volume.volume_id}\"\n                            try:\n                                booktitle = re.search(\n                                    r\"    title = \\\"(.*)\\\",\", concise_contents\n                                ).group(1)\n                                print(\n                                    f\"@string{{{abbrev} = {{{booktitle}}}}}\",\n                                    file=file_anthology_raw,\n                                )\n                            except AttributeError:\n                                import sys\n\n                                print(\n                                    f\"Could not find title for {volume_id}\",\n                                    file=sys.stderr,\n                                )\n                                abbrev = None\n\n                        if abbrev is not None and \"booktitle\" in concise_contents:\n                            # substitute the alias for the booktitle\n                            concise_contents = re.sub(\n                                r\"    booktitle = (\\\".*\\\"),\",\n                                f\"    booktitle = {abbrev},\",\n                                concise_contents,\n                            )\n\n                        # Remove newlines, indentations, and double-spaces around author separators\n                        concise_contents = re.sub(r\"\\s+\", \" \", concise_contents)\n\n                        print(concise_contents, file=file_anthology_raw)\n\n\nif __name__ == \"__main__\":\n    args = docopt(__doc__)\n    scriptdir = os.path.dirname(os.path.abspath(__file__))\n    if \"{scriptdir}\" in args[\"--importdir\"]:\n        args[\"--importdir\"] = os.path.abspath(\n            args[\"--importdir\"].format(scriptdir=scriptdir)\n        )\n    if \"{scriptdir}\" in args[\"--exportdir\"]:\n        args[\"--exportdir\"] = os.path.abspath(\n            args[\"--exportdir\"].format(scriptdir=scriptdir)\n        )\n\n    log_level = log.DEBUG if args[\"--debug\"] else log.INFO\n    log.basicConfig(format=\"%(levelname)-8s %(message)s\", level=log_level)\n    tracker = SeverityTracker()\n    log.getLogger().addHandler(tracker)\n\n    # If NOBIB is set, generate only three bibs per volume\n    limit = 0 if os.environ.get(\"NOBIB\", \"false\") == \"false\" else 3\n    log.info(f\"NOBIB=true, generating only {limit} BibTEX files per volume\")\n\n    anthology = Anthology(importdir=args[\"--importdir\"], fast_load=True)\n    create_bibtex(anthology, args[\"--exportdir\"], limit=limit, clean=args[\"--clean\"])\n\n    if tracker.highest >= log.ERROR:\n        exit(1)\n", "path": "bin/create_bibtex.py"}]}