I'd like to see reStructuredText as an export option. Do you think pybtex could be used as bibliographic tool for Docutils (http://docutils.sf.net)?
I'm working on a bibtex sphinx extension and I've created a doctree backend for pybtex:
https://bitbucket.org/mtroffaes/sphinx-contrib/src/tip/bibtex/sphinxcontrib/bibtex/backends/doctree.py
I had to patch the pybtex source to allow backends with non-string rendering. Will try to attach it...
Seems like I can't attach a file. Anyway, the patch is trivial, let me paste it here.
=== modified file 'pybtex/backends/__init__.py' --- pybtex/backends/__init__.py 2011-03-03 14:15:55 +0000 +++ pybtex/backends/__init__.py 2011-03-24 15:31:24 +0000 @@ -48,6 +48,10 @@
raise NotImplementedError
+ def render_sequence(self, text): + """Render a sequence of rendered text objects.""" + return "".join(text) + def write_entry(self, label, key, text): raise NotImplementedError
=== modified file 'pybtex/richtext.py' --- pybtex/richtext.py 2011-01-06 18:14:02 +0000 +++ pybtex/richtext.py 2011-03-24 15:30:30 +0000 @@ -125,7 +125,7 @@ text.append(backend.format_text(item)) else: text.append(item.render(backend)) - return "".join(text) + return backend.render_sequence(text)
def enumerate(self): for n, child in enumerate(self):
Doctree fork now maintained here:
https://code.launchpad.net/~matthias-troffaes/+junk/pybtex
Ticket moved from /p/pybtex/feature-requests/4/
Can't be converted:
Guess it's time to close this bug. :) We have https://pypi.python.org/pypi/sphinxcontrib-bibtex now.
I'm working on a bibtex sphinx extension and I've created a doctree backend for pybtex:
https://bitbucket.org/mtroffaes/sphinx-contrib/src/tip/bibtex/sphinxcontrib/bibtex/backends/doctree.py
I had to patch the pybtex source to allow backends with non-string rendering. Will try to attach it...
Seems like I can't attach a file. Anyway, the patch is trivial, let me paste it here.
=== modified file 'pybtex/backends/__init__.py'
--- pybtex/backends/__init__.py 2011-03-03 14:15:55 +0000
+++ pybtex/backends/__init__.py 2011-03-24 15:31:24 +0000
@@ -48,6 +48,10 @@
raise NotImplementedError
+ def render_sequence(self, text):
+ """Render a sequence of rendered text objects."""
+ return "".join(text)
+
def write_entry(self, label, key, text):
raise NotImplementedError
=== modified file 'pybtex/richtext.py'
--- pybtex/richtext.py 2011-01-06 18:14:02 +0000
+++ pybtex/richtext.py 2011-03-24 15:30:30 +0000
@@ -125,7 +125,7 @@
text.append(backend.format_text(item))
else:
text.append(item.render(backend))
- return "".join(text)
+ return backend.render_sequence(text)
def enumerate(self):
for n, child in enumerate(self):
Doctree fork now maintained here:
https://code.launchpad.net/~matthias-troffaes/+junk/pybtex
Ticket moved from /p/pybtex/feature-requests/4/
Can't be converted:
Guess it's time to close this bug. :) We have https://pypi.python.org/pypi/sphinxcontrib-bibtex now.