New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to change cite-format #175

Open
jlegewie opened this Issue Apr 1, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@jlegewie
Owner

jlegewie commented Apr 1, 2015

Is there a way to change the cite-format, when using the 'Extract Annotations' feature?

I have found the option to do some adjustments in extensions.zotfile.pdfExtraction.formatAnnotationNote, but the %(cite) variable does not seem to be configurable?

Right now it comes out as "%(author) %(year):%(page)" and I would like it to be "%(author), %(year), p. %(page)" instead (APA-style) (exampled with fictitious variables, but I hope it makes sense).

I.e. "Clegg et al, 2005, p. 150" instead of "Clegg et al 2005:150".

But I seem to have hit a wall, so any pointers or hints, would be greatly appreciated.

@jlegewie jlegewie added the enhancement label Apr 1, 2015

@boegh

This comment has been minimized.

Show comment
Hide comment
@boegh

boegh Apr 1, 2015

Sorry for not adding the issue directly on Github (I wasn't aware it was a request), and for forgetting to ask the following on the Zotero Forum, but I was wondering if this was the same as/related to #95 ?

boegh commented Apr 1, 2015

Sorry for not adding the issue directly on Github (I wasn't aware it was a request), and for forgetting to ask the following on the Zotero Forum, but I was wondering if this was the same as/related to #95 ?

@jlegewie

This comment has been minimized.

Show comment
Hide comment
@jlegewie

jlegewie Apr 1, 2015

Owner

Yes, you are right. I closed the other one.

Owner

jlegewie commented Apr 1, 2015

Yes, you are right. I closed the other one.

@jlegewie

This comment has been minimized.

Show comment
Hide comment
@jlegewie

jlegewie May 10, 2015

Owner

Just some notes if anyone wants to look into this.

Currently, the cite key is hard coded on line https://github.com/jlegewie/zotfile/blob/master/chrome/content/zotfile/zotfile.js#L3743
zz.replaceWildcard(item, "%a %y:").replace(/_(?!.*_)/," and ").replace(/_/g,", ") is the relevant part. It first uses the replaceWildcard function and then formats the author string with and and ,.

Also add option to format the cite key as plain-text scannable citations "scannable citations".

Owner

jlegewie commented May 10, 2015

Just some notes if anyone wants to look into this.

Currently, the cite key is hard coded on line https://github.com/jlegewie/zotfile/blob/master/chrome/content/zotfile/zotfile.js#L3743
zz.replaceWildcard(item, "%a %y:").replace(/_(?!.*_)/," and ").replace(/_/g,", ") is the relevant part. It first uses the replaceWildcard function and then formats the author string with and and ,.

Also add option to format the cite key as plain-text scannable citations "scannable citations".

@notehound

This comment has been minimized.

Show comment
Hide comment
@notehound

notehound Jan 27, 2017

For Zotfile 5.0.6 the following changes can be applied to line 223 in pdfAnnotations.js

The line cited by Joscha (above) is slightly different in Zotfile 5:
cite = this.getPref("pdfExtraction.NoteFullCite") ? this.Wildcards.replaceWildcard(item, "%a %y:").replace(/(?!.*)/," and ").replace(/_/g,", ") : "p. ",

To get extracted annotations with a more specific citation style, replace that line as follows:

// APA:
cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " APA FullCite ", this.Wildcards.replaceWildcard(item, "%a, %y").replace(/_(?!.*_)/," & ").replace(/_/g,", ") + ", p. ") : (str_title += " APA PageCite ","p. "),
// or Harvard:
cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " Harvard FullCite ", this.Wildcards.replaceWildcard(item, "%a, %y").replace(/_(?!.*_)/," and ").replace(/_/g,", ") + ", p. ") : (str_title += " Harvard PageCite ","p. "),
// or MLA:
cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " MLA FullCite ", this.Wildcards.replaceWildcard(item, "%a").replace(/_(?!.*_)/," and ").replace(/_/g,", ") + " ") : (str_title += " MLA PageCite ",""),
// etc.

Modify yourself or use xpi files in attached zip file based on Zotfile version 5.0.6 - a customised "Scannable Cite" version is also included in the zip file.
zotfile-5.0.6-fx-customised.zip

notehound commented Jan 27, 2017

For Zotfile 5.0.6 the following changes can be applied to line 223 in pdfAnnotations.js

The line cited by Joscha (above) is slightly different in Zotfile 5:
cite = this.getPref("pdfExtraction.NoteFullCite") ? this.Wildcards.replaceWildcard(item, "%a %y:").replace(/(?!.*)/," and ").replace(/_/g,", ") : "p. ",

To get extracted annotations with a more specific citation style, replace that line as follows:

// APA:
cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " APA FullCite ", this.Wildcards.replaceWildcard(item, "%a, %y").replace(/_(?!.*_)/," & ").replace(/_/g,", ") + ", p. ") : (str_title += " APA PageCite ","p. "),
// or Harvard:
cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " Harvard FullCite ", this.Wildcards.replaceWildcard(item, "%a, %y").replace(/_(?!.*_)/," and ").replace(/_/g,", ") + ", p. ") : (str_title += " Harvard PageCite ","p. "),
// or MLA:
cite = this.getPref("pdfExtraction.NoteFullCite") ? (str_title += " MLA FullCite ", this.Wildcards.replaceWildcard(item, "%a").replace(/_(?!.*_)/," and ").replace(/_/g,", ") + " ") : (str_title += " MLA PageCite ",""),
// etc.

Modify yourself or use xpi files in attached zip file based on Zotfile version 5.0.6 - a customised "Scannable Cite" version is also included in the zip file.
zotfile-5.0.6-fx-customised.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment