zensols.bibstract


Namezensols.bibstract JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/plandes/bibstract
SummaryThis utility extracts Bib(La)Tex references (a.k.a *markers*) from a (La)Tex.
upload_time2023-12-05 23:06:32
maintainer
docs_urlNone
authorPaul Landes
requires_python
license
keywords tooling
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BibTeX Extract and Populate

[![PyPI][pypi-badge]][pypi-link]
[![Python 3.10][python310-badge]][python310-link]
[![Python 3.11][python311-badge]][python311-link]
[![Build Status][build-badge]][build-link]

This utility extracts [BibTeX] references (a.k.a *markers*) from a [(La)TeX]
file and copies entries from a source, which the *master BibTeX file*.  It also
provides easy customization to massage the entries of the BibTeX files (see
[features](#features)).  The use case is exporting all [BetterBibtex] entries
to a file on your file system, usually one that is updated as you add, remove
and modify papers in [Zotero].  While the use case was intended for use with
Zoter and BetterBibtex, it will work on any BibTeX system.

The program does the following:
1. Parses some large master source BibTeX file.
1. Parses a file or recursively all `.tex`, `.sty`, and `.cls` files
   recursively in a directory.
1. Copies the matching entries from the master source BibTeX to standard out.

The program makes the assumption that the BibTeX entry IDs are unique as the
matches are very loose when parsing the (La)TeX file.


## Features

Many features relate to modifying older entries to accommodate newer systems
(i.e. [BibLATEX]) or modifying newer entries to accommodate older systems
(i.e. [BibTex]).

Features:
* Replace or edit Unicode characters, which is useful when
  `\usepackage[utf8]{inputenc}` has no effect.
* Massage date strings.
* Remove certain entries that cause bibliography systems issues (useful for
  [BibLATEX]).
* Modify entries to normalize [arXiv] entries.



## Obtaining

The easiest way to install the command line program is via the `pip` installer:
```bash
pip3 install zensols.bibstract
```

Binaries are also available on [pypi].


## Usage

This is a command line program written that has the following usage (also use
`--help`):

* Print IDs in a master source file BibTeX file: `bibstract showbib`.
* Print cite references in a (La)TeX file: `bibstract showtex <file|directory>`
* Print IDs that will be exported from the BibTeX file: `bibstract showexport <file|directory>`
* Export the matching entries to standard out: `bibstract export <file|directory>`


## Converters

A set of *converters* can be specified in the [configuration file], which
modify each parsed BibTeX entry in succession.  Currently there the following:
* **date_year**: Converts the year part of a date field to a year.  This is
  useful when using Zotero's Better Biblatex extension that produces BibLatex
  formats, but you need BibTeX entries.
* **copy**: Copy or move one or more fields in the entry.  This is useful when
  your bibliography style expects one key, but the output (i.e.BibLatex)
  outputs a different named field). When `destructive` is set to ``True``, this
  copy operation becomes a move.

Converters can be set be set and configured in the [configuration file].  See
the [test cases](test/python) for more examples.


## Configuration

A [configuration file] must be given, whose location is either given with a
`-c` command line argument, or set in the environment variable `BIBSTRACTRC`.

An example [configuration file] is available, which has only one INI section
`default` with option `master_bib` with the master BibTeX file.


### Example Configuration File

The following example configuration file points to the a home directory file
where you tell where [BetterBibtex] to export.  It then specifies to convert
dates with years (deleting the `date` field after)when creating the output.

In addition, it copies the `journaltitle` (exported by [BetterBibtex]) to
`journal`, which is used by BibTeX.  This converter, called *replace* is
configured the `replace_converter` entry.

```ini
[default]
master_bib = ${env:home}/.zotero-betterbib.bib
converters = date_year_destructive, replace

[replace_converter]
class_name = zensols.bibstract.CopyOrMoveConverter
fields = dict: {'journaltitle': 'journal'}
destructive = False
```


## Documentation

See the [full documentation](https://plandes.github.io/bibstract/index.html).
The [API reference](https://plandes.github.io/bibstract/api.html) is also
available.


## Changelog

An extensive changelog is available [here](CHANGELOG.md).


## Community

Please star this repository and let me know how and where you use this API.
Contributions as pull requests, feedback and any input is welcome.


## License

Copyright (c) 2020 - 2023 Paul Landes

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


<!-- links -->
[pypi]: https://pypi.org/project/zensols.bibstract/
[pypi-link]: https://pypi.python.org/pypi/zensols.bibstract
[pypi-badge]: https://img.shields.io/pypi/v/zensols.bibstract.svg
[python310-badge]: https://img.shields.io/badge/python-3.10-blue.svg
[python310-link]: https://www.python.org/downloads/release/python-3100
[python311-badge]: https://img.shields.io/badge/python-3.11-blue.svg
[python311-link]: https://www.python.org/downloads/release/python-3110
[build-badge]: https://github.com/plandes/bibstract/workflows/CI/badge.svg
[build-link]: https://github.com/plandes/bibstract/actions

[configuration file]: #example-configuration-file
[BetterBibtex]: https://github.com/retorquere/zotero-better-bibtex
[Zotero]: https://www.zotero.org
[BibTeX]: http://www.bibtex.org
[BibLATEX]: https://ctan.org/pkg/biblatex?lang=en
[(La)TeX]: http://www.bibtex.org
[arXiv]: https://arxiv.org

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/plandes/bibstract",
    "name": "zensols.bibstract",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "tooling",
    "author": "Paul Landes",
    "author_email": "landes@mailc.net",
    "download_url": "https://github.com/plandes/bibstract/releases/download/v1.2.0/zensols.bibstract-1.2.0-py3-none-any.whl",
    "platform": null,
    "description": "# BibTeX Extract and Populate\n\n[![PyPI][pypi-badge]][pypi-link]\n[![Python 3.10][python310-badge]][python310-link]\n[![Python 3.11][python311-badge]][python311-link]\n[![Build Status][build-badge]][build-link]\n\nThis utility extracts [BibTeX] references (a.k.a *markers*) from a [(La)TeX]\nfile and copies entries from a source, which the *master BibTeX file*.  It also\nprovides easy customization to massage the entries of the BibTeX files (see\n[features](#features)).  The use case is exporting all [BetterBibtex] entries\nto a file on your file system, usually one that is updated as you add, remove\nand modify papers in [Zotero].  While the use case was intended for use with\nZoter and BetterBibtex, it will work on any BibTeX system.\n\nThe program does the following:\n1. Parses some large master source BibTeX file.\n1. Parses a file or recursively all `.tex`, `.sty`, and `.cls` files\n   recursively in a directory.\n1. Copies the matching entries from the master source BibTeX to standard out.\n\nThe program makes the assumption that the BibTeX entry IDs are unique as the\nmatches are very loose when parsing the (La)TeX file.\n\n\n## Features\n\nMany features relate to modifying older entries to accommodate newer systems\n(i.e. [BibLATEX]) or modifying newer entries to accommodate older systems\n(i.e. [BibTex]).\n\nFeatures:\n* Replace or edit Unicode characters, which is useful when\n  `\\usepackage[utf8]{inputenc}` has no effect.\n* Massage date strings.\n* Remove certain entries that cause bibliography systems issues (useful for\n  [BibLATEX]).\n* Modify entries to normalize [arXiv] entries.\n\n\n\n## Obtaining\n\nThe easiest way to install the command line program is via the `pip` installer:\n```bash\npip3 install zensols.bibstract\n```\n\nBinaries are also available on [pypi].\n\n\n## Usage\n\nThis is a command line program written that has the following usage (also use\n`--help`):\n\n* Print IDs in a master source file BibTeX file: `bibstract showbib`.\n* Print cite references in a (La)TeX file: `bibstract showtex <file|directory>`\n* Print IDs that will be exported from the BibTeX file: `bibstract showexport <file|directory>`\n* Export the matching entries to standard out: `bibstract export <file|directory>`\n\n\n## Converters\n\nA set of *converters* can be specified in the [configuration file], which\nmodify each parsed BibTeX entry in succession.  Currently there the following:\n* **date_year**: Converts the year part of a date field to a year.  This is\n  useful when using Zotero's Better Biblatex extension that produces BibLatex\n  formats, but you need BibTeX entries.\n* **copy**: Copy or move one or more fields in the entry.  This is useful when\n  your bibliography style expects one key, but the output (i.e.BibLatex)\n  outputs a different named field). When `destructive` is set to ``True``, this\n  copy operation becomes a move.\n\nConverters can be set be set and configured in the [configuration file].  See\nthe [test cases](test/python) for more examples.\n\n\n## Configuration\n\nA [configuration file] must be given, whose location is either given with a\n`-c` command line argument, or set in the environment variable `BIBSTRACTRC`.\n\nAn example [configuration file] is available, which has only one INI section\n`default` with option `master_bib` with the master BibTeX file.\n\n\n### Example Configuration File\n\nThe following example configuration file points to the a home directory file\nwhere you tell where [BetterBibtex] to export.  It then specifies to convert\ndates with years (deleting the `date` field after)when creating the output.\n\nIn addition, it copies the `journaltitle` (exported by [BetterBibtex]) to\n`journal`, which is used by BibTeX.  This converter, called *replace* is\nconfigured the `replace_converter` entry.\n\n```ini\n[default]\nmaster_bib = ${env:home}/.zotero-betterbib.bib\nconverters = date_year_destructive, replace\n\n[replace_converter]\nclass_name = zensols.bibstract.CopyOrMoveConverter\nfields = dict: {'journaltitle': 'journal'}\ndestructive = False\n```\n\n\n## Documentation\n\nSee the [full documentation](https://plandes.github.io/bibstract/index.html).\nThe [API reference](https://plandes.github.io/bibstract/api.html) is also\navailable.\n\n\n## Changelog\n\nAn extensive changelog is available [here](CHANGELOG.md).\n\n\n## Community\n\nPlease star this repository and let me know how and where you use this API.\nContributions as pull requests, feedback and any input is welcome.\n\n\n## License\n\nCopyright (c) 2020 - 2023 Paul Landes\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n<!-- links -->\n[pypi]: https://pypi.org/project/zensols.bibstract/\n[pypi-link]: https://pypi.python.org/pypi/zensols.bibstract\n[pypi-badge]: https://img.shields.io/pypi/v/zensols.bibstract.svg\n[python310-badge]: https://img.shields.io/badge/python-3.10-blue.svg\n[python310-link]: https://www.python.org/downloads/release/python-3100\n[python311-badge]: https://img.shields.io/badge/python-3.11-blue.svg\n[python311-link]: https://www.python.org/downloads/release/python-3110\n[build-badge]: https://github.com/plandes/bibstract/workflows/CI/badge.svg\n[build-link]: https://github.com/plandes/bibstract/actions\n\n[configuration file]: #example-configuration-file\n[BetterBibtex]: https://github.com/retorquere/zotero-better-bibtex\n[Zotero]: https://www.zotero.org\n[BibTeX]: http://www.bibtex.org\n[BibLATEX]: https://ctan.org/pkg/biblatex?lang=en\n[(La)TeX]: http://www.bibtex.org\n[arXiv]: https://arxiv.org\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "This utility extracts Bib(La)Tex references (a.k.a *markers*) from a (La)Tex.",
    "version": "1.2.0",
    "project_urls": {
        "Download": "https://github.com/plandes/bibstract/releases/download/v1.2.0/zensols.bibstract-1.2.0-py3-none-any.whl",
        "Homepage": "https://github.com/plandes/bibstract"
    },
    "split_keywords": [
        "tooling"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b543f9d9e771b64a9e860f421bc438ededfeafb1ca0b7d4b962ace70ea2424ae",
                "md5": "e5375d0fcb0b1cb03488a22850094a1e",
                "sha256": "fd9d75ee970a9900ba79a009a45e9b27c9f65f1e9c4b21ebc0104e916dc8531c"
            },
            "downloads": -1,
            "filename": "zensols.bibstract-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e5375d0fcb0b1cb03488a22850094a1e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 16334,
            "upload_time": "2023-12-05T23:06:32",
            "upload_time_iso_8601": "2023-12-05T23:06:32.623644Z",
            "url": "https://files.pythonhosted.org/packages/b5/43/f9d9e771b64a9e860f421bc438ededfeafb1ca0b7d4b962ace70ea2424ae/zensols.bibstract-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-05 23:06:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "plandes",
    "github_project": "bibstract",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "zensols.bibstract"
}
        
Elapsed time: 0.25834s