chrisgrieser / alfred-bibtex-citation-picker

Citation picker & lightweight reference manager for BibTeX files, via Alfred.
MIT License
137 stars 8 forks source link

Enable option to generate MMD citations #8

Closed karkraeg closed 2 years ago

karkraeg commented 2 years ago

Feature Requested

Would it be possible to add an option to generate citations like [#Helms2008] instead [@Helms2008] and [25][#Helms2008] instead [@Helms2008, p. 25] - see https://fletcher.github.io/MultiMarkdown-6/syntax/citation.html ?

Thanks!

Relevant Screenshot

No response

Checklist

karkraeg commented 2 years ago

If you could point me to where I could adjust this for me that would be great ✌️

chrisgrieser commented 2 years ago

Hi, the part responsible for the citation format is unfortunately implemented mostly in Alfred itself instead of a proper code file (cause it requires looping through Alfred modals itself for multiple citations).

This isn't impossible to change, but at least a bit inflexible and therefore more time-intensive to change. (Which is also why I haven't implemented #1 yet.) It's the teal-blue part if you want to give it a try yourself.

Pasted image 2022-05-17 17 12 46
karkraeg commented 2 years ago

I think it’s the way the bibtex data is written into the buffer.json? If I manually change to "arg": "#AhlersJacke2016", it gets pasted the way I want

karkraeg commented 2 years ago

Yeah, you need to change https://github.com/chrisgrieser/alfred-bibtex-citation-picker/blob/96570c651b04b8cc9e5d83ca25ff28a3078df848/scripts/buffer_writer.js#L177 to "arg": "#" + citekey, then delete the buffer.json in /Users/YOURUSER/Library/Application Support/Alfred/Workflow Data/de.chris-grieser.alfred-bibtex-citation-picker/buffer.json and then customize this setting:

image
chrisgrieser commented 2 years ago

yep, that's pretty much it. If I find the time, I'll implement a setting for this (and Latex in #1), but for now, I have a bunch of deadlines....

chrisgrieser commented 2 years ago

ok, I've implemented customization options in release 9.0.0.

Pasted image 2022-05-19 19 56 20

I am not really familiar with the MMD citation syntax, but would these variables suffice to make MMD citations work?

karkraeg commented 2 years ago

cool! normal citations work, but citations with page now look like [#Helms2008, p. 625] where it should be [625][#Helms2008]

chrisgrieser commented 2 years ago

boy, having page numbers before the citekey is really weird. Lemme look how to switch the order, as well.

chrisgrieser commented 2 years ago

okay, these two settings have been added to version 9.1.0. Have a look whether they are sufficient for MMD citations? image

karkraeg commented 2 years ago

Using this options it woks, thanks!

grafik

chrisgrieser commented 2 years ago

are you sure? Like, in the post before, you mentioned that in MMD, the page number comes before the citekey, and in the screenshot you are sharing, you left _format_page_before_citekey as false 😝

karkraeg commented 2 years ago

yeah, that seems to be a bug πŸ™ˆ or rather I did try it this way and then it worked:

https://user-images.githubusercontent.com/8436596/169474442-73e8a1cb-ad61-48b4-94f6-9bec177044a2.mov

chrisgrieser commented 2 years ago

oops, yes, I mixed up true and false on my side πŸ™ˆ

chrisgrieser commented 2 years ago

should be fixed.

chrisgrieser commented 2 years ago

thanks for your input. One can now conveniently change the citation format via scp πŸ™‚

Pasted image 2022-05-20 12 02 32 Pasted image 2022-05-20 12 02 54
karkraeg commented 2 years ago

Thats nice!