python - pypandoc + pandoc-citeproc to convert bib to rst -


i have .bib file references , render file restructuredtext (in other words, input file references.bib , desired file references.rst). conversion should done python script, tried use pypandoc (version 0.9.7, pandoc version 1.13.1) in combination pandoc-citeproc filter. pypandoc , pandoc installed correctly, e.g. following works

import pypandoc print(pypandoc.get_pandoc_version()) 

my first idea use kind of nocite* command in tex or md file , convert that. (adapted) example pandoc-citeproc issue tracker works when used command line:

pandoc references.tex  -o references.rst --bibliography references.bib 

but did not succeed same python pypandoc, unclear me how pass arguments, e.g. change ibid behavior or specify csl style (changing biblatex style seems have no effect).

also, not workaround .tex file. can somehow skip part?

you can use citeproc-py that. need to:

  1. create citeproc.citationsstylebibliography, passing citation style, bibtex citation source , restructuredtext formatter it;
  2. register each element bibliographic source;
  3. print bibliography.

you can find examples these steps in examples/ directory of citeproc-py, or in bibgen source code. note bibgen allows you directly include bibliography in restructuredtext document (including sphinx sources), see this example.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -