Menu

#62 How to register a custom formatting plugin from a bst file in pybtex

open
nobody
None
trunk
2015-03-02
2015-02-02
No

How can parse .bst in order to resgister a pybyex.style.formatting plugin?

I looked in the repository found the function parse_file from pybtex.bibtex.bst.

I think I should do something like what follows but can t seem to create a template from the output of the parse_file function.

from pybtex.style.formatting.unsrt import Style as UnsrtStyle
from pybtex.style.template import toplevel # ... and anything else needed
from pybtex.plugin import register_plugin

class MyStyleFromBst(UnsrtStyle):

def format_XXX(self, e):
    template = toplevel [
        # Do something with the bst file
    ]
    return template.format_data(e)

register_plugin('pybtex.style.formatting', 'mystyleFomBst', MyStyleFromBst)

The snippet is originally from sphinxcontrib-bibtex documentation.
https://sphinxcontrib-bibtex.readthedocs.org/en/latest/usage.html

Discussion

  • Densetsu no Ero-Sennin

    Well, you you can't register .bst files as formatting plugins. The reason is that .bst styles are hard-coded to output LaTeX markup and do not other formats. Pybtex formatting plugins have to be written in Python.

     
    • Ishmael Belghazi

      I see. I have no other choice than registering the style manually then.
      Well thanks for taking the time to answer.

       

      Last edit: Ishmael Belghazi 2015-03-02
  • Ishmael Belghazi

    I see. I have no other choice than registering the style manually then. Well thanks for taking the time to answer.

     
MongoDB Logo MongoDB