deanishe / zothero

Rapidly search and cite Zotero entries from Alfred
MIT License
480 stars 31 forks source link

How to make ⌘↩ (copy citation) and ⌥↩ (copy bibliography) use different citation styles? #40

Open SquareBottle opened 4 years ago

SquareBottle commented 4 years ago

I'd like to have ⌘↩ (copy citation) use the RTF Scan citation style, and ⌥↩ (copy bibliography) use the Chicago note citation style. However, it seems like I can only make them both use one or the other.

The configuration instructions explain how to change the default, but don't explain how to make them use different defaults. The two methods in the configuration instructions both do the same thing: set the default style. But the default is always set for both, so they always produce the same text.

Would you please explain how to make the default style for ⌘↩ different from the default for ⌥↩?

SquareBottle commented 4 years ago

~Nevermind. This is in the instructions. It's at the bottom in the All Settings section.~

~I suggest mentioning this information in the Citation Styles section. That's where I expected it to be, so others might expect the same. At the very least, I think it'd be useful to tell readers to go to the All Settings section for the info.~

SquareBottle commented 4 years ago

Bahh! That doesn't solve it! Specifically, changing the variable in the workflow (as per the instructions from the All Settings section) changes both!

On the bright side, I have a better understanding of things now. Only one citation style may be used, and that variable is where it's set. Each citation style has a citation format and a bibliography format. Note that citation styles are not the same thing as citation formats. (This can get confusing since the terminology doesn't seem to be used consistently by Zotero, ZotHero, or anyone as far as I can tell.)

So, in order to have the desired behavior, a new feature would need to be added in the form of a new variable. The idea is to go from the functionality conveyed by this:

Variable Meaning
ATTACHMENTS_DIR Path to your Zotero attachments. Read from Zotero's config by default.
CITE_STYLE Citation style copied by ⌘↩ and ⌥↩
LOCALE Locale for citations. Default: en-US (US English).
ZOTERO_DIR Path to your Zotero data. Read from Zotero's config by default.
COPY_CITEKEY_MOD Set to copy Better BibTeX citekey instead of CSL citation/bibliography.

To something like this:

Variable Meaning
ATTACHMENTS_DIR Path to your Zotero attachments. Read from Zotero's config by default.
CITE_STYLE Citation style copied by ⌘↩ and ⌥↩. When BIB_STYLE is not blank, this variable will instead only control what is copied by ⌥↩.
BIB_STYLE When this isn't blank, it will take control of what is copied by ⌘↩.
LOCALE Locale for citations. Default: en-US (US English).
ZOTERO_DIR Path to your Zotero data. Read from Zotero's config by default.
COPY_CITEKEY_MOD Set to copy Better BibTeX citekey instead of CSL citation/bibliography.

This functionality would be handy for people like me who want to use the RTF Scan citation format for writing papers and Chicago (notes) bibliography format when writing for the web.

Thank you for considering.

deanishe commented 4 years ago

Note that citation styles are not the same thing as citation formats. (This can get confusing since the terminology doesn't seem to be used consistently by Zotero, ZotHero, or anyone as far as I can tell.)

Yeah. I really know nothing about this whole business of citing stuff. I only wrote the workflow because the existing one was borked and abandoned, and a lot of Alfred users needed a sensible replacement. I'm still hoping someone who knows and cares about this kind of thing will step in and take over maintaining it.

a new feature would need to be added in the form of a new variable

It's nowhere near as simple as just adding a new variable, I'm afraid. The general architecture of the workflow assumes one CSL style. It would require a lot of work to implement different ones for citations and bibliographies.

SquareBottle commented 4 years ago

Yeah. I really know nothing about this whole business of citing stuff. I only wrote the workflow because the existing one was borked and abandoned, and a lot of Alfred users needed a sensible replacement. I'm still hoping someone who knows and cares about this kind of thing will step in and take over maintaining it.

You're a saint for taking over until somebody more familiar with citation comes along!

It's nowhere near as simple as just adding a new variable, I'm afraid. The general architecture of the workflow assumes one CSL style. It would require a lot of work to implement different ones for citations and bibliographies.

Hmmmmm... Would it be easier to add a second citation style then?

Forgive me if this is too simplistic, I'm not a programmer at all. But what if you copy all the code related to the CITE_STYLE variable, paste it in a new code file, and use find-and-replace to change every instance of CITE_STYLE to BIB_STYLE?

Even if it works the way I'm imagining it in my head, it probably wouldn't do 100% of what needs to be done. For example, you'd need to tell the other ZotHero code files to incorporate the new one and assign new keyboard shortcuts (perhaps simply adding the shift key). But hey, if it gets you 90% of the way toward a solution, then that's pretty good right?

Assuming I'm off by a mile, what do you think would be the easiest way to deliver the functionality I described?

deanishe commented 4 years ago

Would it be easier to add a second citation style then?

That's basically exactly what you're asking for.

Even if it works the way I'm imagining it in my head

It doesn't. It's a lot more complicated than just duplicating some code and running find-and-replace on it.

what do you think would be the easiest way to deliver the functionality I described?

Significant sections of the workflow need rewriting to handle multiple styles at the same time, instead of just one.

SquareBottle commented 4 years ago

Ahh, alright. Sorry.

deanishe commented 4 years ago

I'll have a think about it, and add it if it's not too much effort.

But tbh, I can't really be arsed spending much time on this workflow, and it's really low priority because I personally have zero use for it.

I've tagged this issue as "help wanted". Perhaps someone else is interested in adding the feature.

SquareBottle commented 4 years ago

Thanks for thinking about how you'd do it. Even if you don't, I appreciate the consideration – especially since you're already babysitting the entire project until somebody more interested comes along.

For what it's worth, I'll try to bring up your situation in forums where people are likely to be interested. It's not related to the feature request at hand, but just as a thought: if it's easy, maybe you could have a message appear on updates that says something like, "The update was successful. Also, the original maintainer has been gone for a while, and I've been handling things because there were so many requests. But I don't actually use this myself, and my intention was only to keep the ship afloat until a more interested captain comes along. If you use ZotHero and have the programming knowledge to help, then please come forward!" (In your own words, of course.)

Anyway, thanks again for everything.

deanishe commented 4 years ago

For what it's worth, I'll try to bring up your situation in forums where people are likely to be interested.

Thanks. I'm sure the workflow would benefit from a maintainer that actively uses it.

masteranza commented 3 years ago

Thanks. I'm sure the workflow would benefit from a maintainer that actively uses it.

@deanishe indeed. Would you mind sharing build script for this workflow?