Skip to content
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 · 14 comments
Open

option to change cite-format #175

jlegewie opened this issue Apr 1, 2015 · 14 comments

Comments

@jlegewie
Copy link
Owner

@jlegewie 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
Copy link

@boegh 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
Copy link
Owner Author

@jlegewie jlegewie commented Apr 1, 2015

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

@jlegewie
Copy link
Owner Author

@jlegewie 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
Copy link

@notehound 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

@notehound
Copy link

@notehound notehound commented Mar 4, 2020

Customised APA version of Zotfile 5.0.16 attached.

  1. Uninstall Zotfile
  2. Download attached file and rename file extension from zip to xpi and install as a Zotero Add-on
  3. Change "Automatic Updates" for this customised Zotfile version to "off"
    zotfile-5.0.16_APA.zip
@Schmedu
Copy link

@Schmedu Schmedu commented May 1, 2020

Hey @notehound thanks for your replies! Could you please exaggerate how to change the line to have a scannable cite?

Thanks in advance

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

@Mugurlu28
Copy link

@Mugurlu28 Mugurlu28 commented May 13, 2020

Hello
How can i rename file extension from zip to xpi? Thanks.

@Mugurlu28
Copy link

@Mugurlu28 Mugurlu28 commented May 13, 2020

Hello
scannable cite version does not work. Can you help me about that?

@notehound
Copy link

@notehound notehound commented Jun 15, 2020

Apologies for my late responses to posts last month.
@Schmedu
To extract to scannable cite format using zotfile-5.0.16 change pdfAnnotations.js lines as follows:

replace line 217 (optional for clarity):
str_title = this.ZFgetString('extraction.noteTitle'),
with:
str_title = this.ZFgetString('extraction.noteTitle') + " Scannable Cite ",

replace line 226:
cite = this.getPref("pdfExtraction.NoteFullCite") ? this.Wildcards.replaceWildcard(item, "%a %y:").replace(/_(?!.*_)/," and ").replace(/_/g,", ") : "p. ",
with:
cite = " | " + this.Wildcards.replaceWildcard(item, "%a, %y").replace(/_(?!.*_)/," & ").replace(/_/g,", ") + " |p. ",

insert above line 257:
// link
with:
page = page + "| |zu:" + lib + ":" + item.key;

I have already done this in the attached zip file.

@Mugurlu28 - To rename the file from .zip tp .xpi you need to make the file extensions visible in File Explorer (Windows) or Finder (Mac). The file attached here is customised from the latest version of Zotfile which means it will now work with the current version of Zotero.

zotfile-5.0.16.fx scannableCite.zip

@Mugurlu28
Copy link

@Mugurlu28 Mugurlu28 commented Jun 16, 2020

Hello notehound
Thank you very much. But it does not work in word document. Can you please give me your email address?

@notehound
Copy link

@notehound notehound commented Jun 16, 2020

Hi @Mugurlu28

Scannable Cite does not work with Word.

See:
https://zotero-odf-scan.github.io/zotero-odf-scan/

"RTF/ODF-Scan requires Zotero, LibreOffice and Zotero's LibreOffice plugin."

@Mugurlu28
Copy link

@Mugurlu28 Mugurlu28 commented Jun 16, 2020

Is there a way to make it work with Word?

@notehound
Copy link

@notehound notehound commented Jun 16, 2020

@Schmedu @Mugurlu28

Apologies - one last tweak to get annotations in Scannable Cite format:

  1. Go to Zotero>Edit>Preferences>Advanced>Config Editor
  2. search for "extensions.zotfile.pdfExtraction.formatAnnotationHighlight"
  3. Change <p>"%(content)" (%(cite))</p> to
    <p>"%(content)" {%(cite)}</p>
@notehound
Copy link

@notehound notehound commented Jun 16, 2020

Is there a way to make it work with Word?

You can add scannable citations in word but you must save your Word doc as odt then open the file in Libre Office. You then use the RTF/ODF-Scan for Zotero add-on in Libre Office to generate in-text citations and bibliography in your chosen format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.