yoavram / markx

Markdown editor for scientific writing. Batteries included.
Other
319 stars 41 forks source link

Citation features #7

Open yoavram opened 11 years ago

yoavram commented 11 years ago

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:

houshuang commented 11 years ago

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.

yoavram commented 11 years ago

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 commented 11 years ago

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.

lsaravia commented 11 years ago

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

yoavram commented 11 years ago
  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 commented 11 years ago

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

lsaravia commented 11 years ago

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.

yoavram commented 11 years ago

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....

lsaravia commented 11 years ago

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

yoavram commented 11 years ago

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.

lsaravia commented 11 years ago

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

yoavram commented 11 years ago

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

More details:

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 commented 11 years ago

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:

/cc @houshuang

yoavram commented 11 years ago

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