# APA7 Style for Pybtex
*This is a fork of [naeka's pybtex-apa-style](https://github.com/naeka/pybtex-apa-style), which targeted APA6*.
This plugin provides [APA7](https://apastyle.apa.org/) style for Pybtex.
[Pybtex](https://pybtex.org/) provides Python support for interacting with bibTeX
bibliography data. Style plugins provide support for formatting bibliographies,
similar to the role that `csl` files play for LaTeX.
## Installation
```shell
$ pip install pybtex pybtex-apa7-style
```
## Usage
Pybtex uses [Python's plugin system](https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/).
To use APA7, load it as a plugin as shown in the example below.
```python3
from pybtex.plugin import find_plugin
from pybtex.database import parse_file
APA = find_plugin('pybtex.style.formatting', 'apa7')()
HTML = find_plugin('pybtex.backends', 'html')()
def bib_to_apa7_html(bibfile):
bibliography = parse_file(bibfile, 'bibtex')
formatted_bib = APA.format_bibliography(bibliography)
return "<br>".join(entry.text.render(HTML) for entry in formatted_bib)
```
## Contributing
This is a work in progres; APA style is not fully-specified and has endless edge cases.
I would be delighted to receive examples of bibTeX entries which are not formatted correctly
in APA.
If you clone [this project's repository](https://github.com/cproctor/pybtex-apa7-style), you
can add bibTeX exemplars in `tests/examples` and then run `python tests/test_visual_results.py`.
Open `tests/results.html` to see the resulting APA-formatted HTML.
Raw data
{
"_id": null,
"home_page": "https://github.com/cproctor/pybtex-apa7-style",
"name": "pybtex-apa7-style",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Chris Proctor",
"author_email": "github.com@accounts.chrisproctor.net",
"download_url": "https://files.pythonhosted.org/packages/99/14/ff157a3499e71af9f69f04da6891d86716539e087786cf40eeb0e481c0af/pybtex-apa7-style-0.1.3.tar.gz",
"platform": null,
"description": "# APA7 Style for Pybtex\n\n*This is a fork of [naeka's pybtex-apa-style](https://github.com/naeka/pybtex-apa-style), which targeted APA6*.\n\nThis plugin provides [APA7](https://apastyle.apa.org/) style for Pybtex.\n\n[Pybtex](https://pybtex.org/) provides Python support for interacting with bibTeX\nbibliography data. Style plugins provide support for formatting bibliographies,\nsimilar to the role that `csl` files play for LaTeX.\n\n## Installation\n\n```shell\n$ pip install pybtex pybtex-apa7-style\n```\n\n## Usage\n\nPybtex uses [Python's plugin system](https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/).\nTo use APA7, load it as a plugin as shown in the example below.\n\n```python3\nfrom pybtex.plugin import find_plugin\nfrom pybtex.database import parse_file\nAPA = find_plugin('pybtex.style.formatting', 'apa7')()\nHTML = find_plugin('pybtex.backends', 'html')()\n\ndef bib_to_apa7_html(bibfile):\n bibliography = parse_file(bibfile, 'bibtex')\n formatted_bib = APA.format_bibliography(bibliography)\n return \"<br>\".join(entry.text.render(HTML) for entry in formatted_bib)\n```\n\n## Contributing\n\nThis is a work in progres; APA style is not fully-specified and has endless edge cases. \nI would be delighted to receive examples of bibTeX entries which are not formatted correctly\nin APA. \n\nIf you clone [this project's repository](https://github.com/cproctor/pybtex-apa7-style), you\ncan add bibTeX exemplars in `tests/examples` and then run `python tests/test_visual_results.py`.\nOpen `tests/results.html` to see the resulting APA-formatted HTML.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Provides APA7 style for Pybtex",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/cproctor/pybtex-apa7-style",
"Repository": "https://github.com/cproctor/pybtex-apa7-style"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2913b73e95d5e78db8d67ad7afe3192680a87a7b77e3f8f12eeb0988bed24c53",
"md5": "37e5e3b8a693c8fc9c0d6c9f086281a3",
"sha256": "0420a0baf957644c22bf4f7866e83a635e38cd72e3f29794bcf6c0a576709e06"
},
"downloads": -1,
"filename": "pybtex_apa7_style-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "37e5e3b8a693c8fc9c0d6c9f086281a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 7487,
"upload_time": "2022-08-19T02:25:44",
"upload_time_iso_8601": "2022-08-19T02:25:44.696156Z",
"url": "https://files.pythonhosted.org/packages/29/13/b73e95d5e78db8d67ad7afe3192680a87a7b77e3f8f12eeb0988bed24c53/pybtex_apa7_style-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9914ff157a3499e71af9f69f04da6891d86716539e087786cf40eeb0e481c0af",
"md5": "7694019ad01e4790808506fbc4e43d47",
"sha256": "f383a05a99081bbc3b83f58c2d8ce4effb1f32149f7409b4f7bc52f55d74d3fe"
},
"downloads": -1,
"filename": "pybtex-apa7-style-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "7694019ad01e4790808506fbc4e43d47",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 7208,
"upload_time": "2022-08-19T02:25:43",
"upload_time_iso_8601": "2022-08-19T02:25:43.108268Z",
"url": "https://files.pythonhosted.org/packages/99/14/ff157a3499e71af9f69f04da6891d86716539e087786cf40eeb0e481c0af/pybtex-apa7-style-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-08-19 02:25:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cproctor",
"github_project": "pybtex-apa7-style",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pybtex-apa7-style"
}