PandocCiter icon indicating copy to clipboard operation
PandocCiter copied to clipboard

restructuredtext implementation?

Open Nadano opened this issue 5 years ago • 3 comments

After struggling with markdown for complex documents I decided to try restructuredtext (with sphinx) and I'm liking it a lot. Sadly, no citation helper exist for this language yet.

I was wondering how difficult it would be to make your extension work with it. If in not wrong the differences in implementation with markdown are quite small: instead of @, rst require :cite: and rather than having the bibtex file declared in the yaml header, rst declares it at the bibliography insertion point .. bibliography:: refs.bib

More information please refer to: https://sphinxcontrib-bibtex.readthedocs.io/en/latest/quickstart.html

Do you believe it would be possible to implement it easily?

Nadano avatar Nov 20 '19 11:11 Nadano

I gave it a quick shot by modifying a few lines (commit: 4ce4aa4e274731271fb2eaec185fdbbe4e79011e) and, although not perfect, it did seem to work.

You can try it out by cloning the sphinx branch and then building it locally. Alternatively, this zip file pandocciter-0.4.2.zip contains the vsix file. Someone else has already written a nice guide on how to install from vsix.

Note: The reStructuredText extension should also be installed beforehand.

notZaki avatar Nov 20 '19 15:11 notZaki

What is not perfect? works great on my machine! the only thing I can think of is to add the ` after the reference, but apart from that it works flawlessly

Nadano avatar Nov 20 '19 19:11 Nadano

The issues I noticed were:

  • The ` after the reference triggers the citation suggestions which have to be shooed away by hitting escape
  • I'm not familiar with sphinx, but I'm assuming that multiple citations are inserted by :cite:`ref1, ref2` so it would be nice if another set of suggestions were shown after the comma
  • Based on some quick reading it seems that multiple bib files are inserted on separate lines. Currently, the extension only looks for the first bibliography insertion point.

Anyways, I'm glad you found it useful. However, since I don't use restructured text, I probably won't support it in any official version of PandocCiter. But anyone is free to use this as a starting point and develop it further.

If you want to keep using the above version then I would suggest changing the name/details in package.json and rebuilding it (or I can share a new vsix with a different name), because otherwise it might get over-written by a future version of PandocCiter.

notZaki avatar Nov 20 '19 22:11 notZaki

Looks like this was completed (?) based on the referenced issue above, so closing this. Hope it worked out!

notZaki avatar Jun 07 '23 22:06 notZaki