biblib-simple


Namebiblib-simple JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/colour-science/biblib
SummarySimple, correct BibTeX parser and algorithms
upload_time2022-10-29 22:17:29
maintainer
docs_urlNone
authorAustin Clements
requires_python
license
keywords bibtex tex
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Biblib
------

This repository was forked from [Austin Clements
repository](https://github.com/aclements/biblib) to create
a [PyPi package](https://pypi.org/project/biblib-simple/).

Biblib provides a simple, standalone Python3 package for parsing
BibTeX bibliographic databases, as well as algorithms for manipulating
BibTeX entries in BibTeX-y ways.

There are a lot of BibTeX parsers out there.  Most of them are
complete nonsense based on some imaginary grammar made up by the
module's author that is almost, but not quite, entirely unlike
BibTeX's actual grammar.  *BibTeX has a grammar*.  It's even pretty
simple, though it's probably not what you think it is.  The hardest
part of BibTeX's grammar is that it's only written down in one place:
the BibTeX source code.

Biblib's parser is derived directly from the WEB source code for
BibTeX and hence (barring bugs in translation) should be fully
compatible with BibTeX's own parser.


Features
--------

* BibTeX-compatible `.bib` file parser

* BibTeX-compatible name parser for fields like `author`

* Crossref resolution

* BibTeX-compatible title casing

* Translator for common TeX markup (like accents) to Unicode (which
  can, in turn, be used in HTML and other formats).


Installation
------------

Since biblib has no external dependencies or C modules, you can use
biblib in your project by simply unpacking it under your source tree
and adding

    sys.path.append('biblib')

before importing it.

Biblib can also be installed system-wide with

    python3 setup.py install


Examples
--------

There are a few simple examples of biblib's use in `examples/`.  To
run these dircetly from the source tree, use, for example

    PYTHONPATH=$PWD ./examples/bibparse test.bib


Recognized grammar
------------------

For reference, the `.bib` parser implements a grammar equivalent to
the following PEG.  All literals are matched case-*insensitively*.

    bib_db = comment (command_or_entry comment)*

    comment = [^@]*

    ws = [ \t\n]*

    ident = ![0-9] (![ \t"#%'(),={}] [\x20-\x7f])+

    command_or_entry = '@' ws (comment / preamble / string / entry)

    comment = 'comment'

    preamble = 'preamble' ws ( '{' ws preamble_body ws '}'
                             / '(' ws preamble_body ws ')' )

    preamble_body = value

    string = 'string' ws ( '{' ws string_body ws '}'
                         / '(' ws string_body ws ')' )

    string_body = ident ws '=' ws value

    entry = ident ws ( '{' ws key ws entry_body? ws '}'
                     / '(' ws key_paren ws entry_body? ws ')' )

    key = [^, \t}\n]*

    key_paren = [^, \t\n]*

    entry_body = (',' ws ident ws '=' ws value ws)* ','?

    value = piece (ws '#' ws piece)*

    piece
        = [0-9]+
        / '{' balanced* '}'
        / '"' (!'"' balanced)* '"'
        / ident

    balanced
        = '{' balanced* '}'
        / [^{}]

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/colour-science/biblib",
    "name": "biblib-simple",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "bibtex,tex",
    "author": "Austin Clements",
    "author_email": "colour-science@googlegroups.com",
    "download_url": "https://files.pythonhosted.org/packages/45/61/5a4b61f7cc095f7690a7e01f4c4670ecb23e619c0359826179fee4c3686f/biblib-simple-0.1.2.tar.gz",
    "platform": null,
    "description": "Biblib\n------\n\nThis repository was forked from [Austin Clements\nrepository](https://github.com/aclements/biblib) to create\na [PyPi package](https://pypi.org/project/biblib-simple/).\n\nBiblib provides a simple, standalone Python3 package for parsing\nBibTeX bibliographic databases, as well as algorithms for manipulating\nBibTeX entries in BibTeX-y ways.\n\nThere are a lot of BibTeX parsers out there.  Most of them are\ncomplete nonsense based on some imaginary grammar made up by the\nmodule's author that is almost, but not quite, entirely unlike\nBibTeX's actual grammar.  *BibTeX has a grammar*.  It's even pretty\nsimple, though it's probably not what you think it is.  The hardest\npart of BibTeX's grammar is that it's only written down in one place:\nthe BibTeX source code.\n\nBiblib's parser is derived directly from the WEB source code for\nBibTeX and hence (barring bugs in translation) should be fully\ncompatible with BibTeX's own parser.\n\n\nFeatures\n--------\n\n* BibTeX-compatible `.bib` file parser\n\n* BibTeX-compatible name parser for fields like `author`\n\n* Crossref resolution\n\n* BibTeX-compatible title casing\n\n* Translator for common TeX markup (like accents) to Unicode (which\n  can, in turn, be used in HTML and other formats).\n\n\nInstallation\n------------\n\nSince biblib has no external dependencies or C modules, you can use\nbiblib in your project by simply unpacking it under your source tree\nand adding\n\n    sys.path.append('biblib')\n\nbefore importing it.\n\nBiblib can also be installed system-wide with\n\n    python3 setup.py install\n\n\nExamples\n--------\n\nThere are a few simple examples of biblib's use in `examples/`.  To\nrun these dircetly from the source tree, use, for example\n\n    PYTHONPATH=$PWD ./examples/bibparse test.bib\n\n\nRecognized grammar\n------------------\n\nFor reference, the `.bib` parser implements a grammar equivalent to\nthe following PEG.  All literals are matched case-*insensitively*.\n\n    bib_db = comment (command_or_entry comment)*\n\n    comment = [^@]*\n\n    ws = [ \\t\\n]*\n\n    ident = ![0-9] (![ \\t\"#%'(),={}] [\\x20-\\x7f])+\n\n    command_or_entry = '@' ws (comment / preamble / string / entry)\n\n    comment = 'comment'\n\n    preamble = 'preamble' ws ( '{' ws preamble_body ws '}'\n                             / '(' ws preamble_body ws ')' )\n\n    preamble_body = value\n\n    string = 'string' ws ( '{' ws string_body ws '}'\n                         / '(' ws string_body ws ')' )\n\n    string_body = ident ws '=' ws value\n\n    entry = ident ws ( '{' ws key ws entry_body? ws '}'\n                     / '(' ws key_paren ws entry_body? ws ')' )\n\n    key = [^, \\t}\\n]*\n\n    key_paren = [^, \\t\\n]*\n\n    entry_body = (',' ws ident ws '=' ws value ws)* ','?\n\n    value = piece (ws '#' ws piece)*\n\n    piece\n        = [0-9]+\n        / '{' balanced* '}'\n        / '\"' (!'\"' balanced)* '\"'\n        / ident\n\n    balanced\n        = '{' balanced* '}'\n        / [^{}]\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Simple, correct BibTeX parser and algorithms",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/colour-science/biblib"
    },
    "split_keywords": [
        "bibtex",
        "tex"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45615a4b61f7cc095f7690a7e01f4c4670ecb23e619c0359826179fee4c3686f",
                "md5": "837891eb8e9137310865ca022d71f404",
                "sha256": "8264275fe4429971c7218c5085c2d651f7ec222ededaa7d3d40aaedc91fd1a37"
            },
            "downloads": -1,
            "filename": "biblib-simple-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "837891eb8e9137310865ca022d71f404",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 19758,
            "upload_time": "2022-10-29T22:17:29",
            "upload_time_iso_8601": "2022-10-29T22:17:29.248037Z",
            "url": "https://files.pythonhosted.org/packages/45/61/5a4b61f7cc095f7690a7e01f4c4670ecb23e619c0359826179fee4c3686f/biblib-simple-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-10-29 22:17:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "colour-science",
    "github_project": "biblib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "biblib-simple"
}
        
Elapsed time: 0.09803s