markx icon indicating copy to clipboard operation
markx copied to clipboard

Citation features

Open yoavram opened this issue 12 years ago • 14 comments

Currently the citation feature is the conversion of BibTeX citation keys - [@Drake1998] - in the text to a bibliography below the preview pane. This feature is activated by a Citations button.

Additional citations features:

  • [ ] Conversion of the keys in the editor panel to citations in the preview panel. For example, converting [@Drake1998] to (Drake et al., 1998).
  • [ ] Tooltip on the converted citations in the preview panel showing the full citation.
  • [ ] Citation Style Language support, possibly via citeproc-js.
  • [ ] Warning message when a citation key was not found - above the preview panel? by highlighting the unconverted key in the preview pane? highlighting the key in the editor?

yoavram avatar Dec 20 '12 12:12 yoavram

Awesome project, I'll be watching this with great interest. I built a propotype of an open scholarly workflow, based on BibTeX, Skim, Chrome and DokuWiki. The citekey is the key to the whole system, PDFs are renamed accordingly, wiki pages generated, and I can use them to cite papers like [@this] both in the wiki, in my WP blog (using a plugin), etc. (I also do the full citation on hover, etc stuff).

I tried connecting my bibliography through config.py, and inserting a citation, but nothing seemed to happen. I guess it's supposed to appear below the preview pane? The ideal would definitively be to have it rendered immediately in the preview pane, as a full citation, with tooltips (not essential but nice), and possible rendering of source list either automatically at the bottom, or below #Sources.

houshuang avatar Jan 31 '13 19:01 houshuang

Thanks, I'm glad to hear you like it! The citations are displayed below the preview pane but only after you click the citations button in the toolbar.

With time (or if you'd like you could fork and pull-request) we will add a post-conversion hook to the PageDown editor/converter (like the ones that already exist in markx.js) that will do this automatically. Also, I hope to bypass bibtex.js and do it with some other tool that will allow more flexibility in terms of what to do with the citation, so that I can parse them, add links, tooltips... Maybe query zotero or mendeley... We'll be glad to here more ideas and comments!

yoavram avatar Feb 01 '13 19:02 yoavram

With the latest commit we changed our bibtex js library to javascript bibtex parser which allows to parse bibtex file using javascript in the client side. This will allow the implementation of features discussed above.

yoavram avatar Feb 17 '13 19:02 yoavram

I have been testing citations and they don't appear neither after loading bibliography nor after updating bibliography

lsaravia avatar Feb 23 '13 03:02 lsaravia

  1. After loading a bibliography, Markx should open an on page alert box that says:

    BibTeX file loaded with X entires X being the number of citations loaded. Is X>0 in your case? If it is, can I see the bibliography file you are using?

  2. Do you have citation keys in the document ([@AuthorYear] format)? I'm guessing you do and you're using the HELP.md, but just to make sure I tested on Chrome and FF18 and it works, that's why I'm asking these questsion.

yoavram avatar Feb 23 '13 06:02 yoavram

I've added new items in the citations menu to allow you to check which references are loaded into markx at any given time. See new commit 04737ad2ab42707a42717ec9d23973e002563212

yoavram avatar Feb 23 '13 13:02 yoavram

  1. I don't see the on page alert
  2. Yes the pandoc format. They are not rendered in the preview, and no bibliography showed.
  3. The two new citations menu items work perfectly.

lsaravia avatar Feb 23 '13 19:02 lsaravia

I don't understand, the new citation menu items work, that is you get a list of citations and a list of references in the uploaded library, but you don't get the alert and you don't get preview of citations? Are there any errors in the JS console? I tested again on FF 18 and I see the alert and citations are parsed nicely....

yoavram avatar Feb 23 '13 19:02 yoavram

Yes that is exactly what happen and is the same in chromium

The error in the console is:

Fecha y hora: 23/02/13 22:25:44 Error: ReferenceError: url is not defined Archivo de origen: http://markx.herokuapp.com/static/js/BibTex.js Línea: 1859

lsaravia avatar Feb 24 '13 01:02 lsaravia

OK I see now, you gave it a citation that doesn't have a URL and this exposed a bug. :+1: Good work! I committed a fix in 018462b88ffb54c42b61410396fa9099405fc0c0. If there are further errors please also upload the bib file you are using to somewhere I can have a look - I know there are some problems with bib files that have non-ascii codes.

yoavram avatar Feb 24 '13 07:02 yoavram

branch codemirror a93c32a

Ok There is no error in the javaconsole but citations are not rendered like before.

here is the bib file:

https://gist.github.com/lsaravia/5024182

And now I can't generate the pandoc pdf

Uncaught ReferenceError: codeMirrorEditor is not defined markx.js:232 getEditor markx.js:232 _save markx.js:441 (anonymous function) underscore-min.js:5 (anonymous function) localhost:592 v.event.dispatch jquery.min.js:2 o.handle.u jquery.min.js:2

lsaravia avatar Feb 24 '13 15:02 lsaravia

TL;DR - I think both issues are fixed, check the latest commit.

More details:

  • As far as the javascript error - my bad, I fixed it now in d1ee339.
  • As for the no citations - when I load it Markx opens a blue alert box that says:

Note: BibTeX file loaded with 87 entires

  • When I chose the view the reference library I get the list of the citations (bad formatting, I know, this is the default and I'll make it nicer some day). Of course no citations yet - haven't used them.
  • Adding [@Rosenzweig1995] to the text and clicking update citations - nothing happens.
  • Running _.find(bibtex.data, function(x) {return x.cite == citationKey}).title in the console I get what I should - "Species Diversity in Space and Time". So the bug is where I add new citations to the citationList.
  • Looked in updateCitations - I think I found the problem, I'm loading the editor textarea instead of going via codemirror. Fixing.
  • Refreshing Markx, writing the citation key [@Rosenzweig1995] in the editor, loading the reference file you gave me - it works.

Commited to 33fb8a0bcb55e250e9c66e9b5032837860a4a424. Also fixed the word count in a later commit,

yoavram avatar Feb 24 '13 18:02 yoavram

The discussion has evolved from feature ideas and requests to bug reports. Hopefully the bug reports are done and we can go back to feature ideas:

  • [ ] Conversion of the keys in the editor panel to citations in the preview panel. For example, converting [@Drake1998] to (Drake et al., 1998). Maybe with a hyperlink the the citation URL.
  • [ ] Tooltip on the converted citations in the preview panel showing the full citation.
  • [ ] Citation Style Language support, possibly via citeproc-js.
  • [ ] Warning message when a citation key was not found - above the preview panel? by highlighting the unconverted key in the preview pane? highlighting the key in the editor?
  • [ ] A button in the edit bar to add the reference skeleton [@ ] (from #19)

/cc @houshuang

yoavram avatar Feb 26 '13 01:02 yoavram

An example of how to format citations with citeproc-js is available here/

yoavram avatar Feb 26 '13 01:02 yoavram