Zotfile features

edited November 22, 2020
Hi,
here are two questions or suggestions to customize the way Zotfile extract annotations from pdf files.
*) For the quotations (highlighted text, etc.) : how about to use the blockquote element so that, let's say Writer, automatically paste the content as quoted?
*) For the refences key: could we choose to use the Better Bibtex keys instead of the citelink name year?
  • Thank you. This allows to use the citekey to rename the file. I've found some discussions that helps. But I still can't manage to add the citekey in the note created by extracting the annotations. It's still the initial format (author, year : page). I couldn' find any change in the advanced configuration to get that. I guess that it is the "cite" variable that needs to be changed. Maybe some indications in the 226 line of zotfile/chrome/content/zotfile/pdfAnnotations.js ?
    Maybe using the "wildcards"?
  • That I can't say, not my area of expertise.
  • edited November 27, 2020
    Hey, this has bugged me for a while now. I have tried editing the pdfAnnotations.js stored in the folder zotfile/chrome/content/zotfile (of the zotfile@columbia.edu.xpi file in :\Users\...\AppData\Roaming\Zotero\Zotero\Profiles\...\extensions).

    Replacing '%a %y' in line 226 with '%b' didn't change anything.

    Edit 2: Okay I figured out why it had no effect, I had to reinstall the altered .xpi via the add ons menu instead of just editing the xpi. It seems to work now, although the code is not pretty:

    On line 226 I have:

    cite = this.getPref("pdfExtraction.NoteFullCite") ? this.Wildcards.replaceWildcard(item, "%b").replace(/_(?!.*_)/," and ").replace(/_/g,", ") : "p. ",

    An on line 258:

    var link = '[@' + cite + ', ' + page + ']',

    Which produces annotation output in the form of "[@blume2020, 3]".
  • how about to use the blockquote element
    Try adding <blockquote> </blockquote> to the relevant ZotFile preference.
    could we choose to use the Better Bibtex keys
    I guess this currently requires editing the ZotFile code.

    See also this discussion: https://forums.zotero.org/discussion/83077/extract-annotations-gives-just-one-way-in-text-citation-style
  • edited November 29, 2020
    Great Chris!

    To use the blockquote :

    go the the advanced config panel and change the html element for:
    extensions.zotfile.pdfExtraction.formatAnnotationHighlight
    extensions.zotfile.pdfExtraction.formatAnnotationUnderline
    Then change :
    "p" and "/p" to "blockquote" and "/blockquote"

    (tip found there : https://forum.zettlr.com/discussion/94/zotero-as-zettelkasten)
  • Chris, just one more thing, in the purpose to give a little help to someone (not me) able to code and submit this feature on github.
    If I understand, it requires to:
    *) change "in the code" the line 258: var link = '[@' + cite + ', ' + page + ']',
    *) change "in the code" the line 226 : cite = """what we get from the configuration file or editor"""?
    *) add in the configuration editor en entry about "cite" (your "cite = this.getPref("pdfExtraction.NoteFullCite") ? this.Wildcards.replaceWildcard(item, "%b").replace(/_(?!.*_)/," and ").replace(/_/g,", ") : "p. ","


    Is that correct?
  • edited March 2, 2021
    Sorry, I missed your reply until now.

    I'm not quite sure what you are asking for. The code I posted above is pretty messy and changes two variables ('cite' and 'link') in a way that kills their original purpose in order to function as citekey-outputs for easier use in markdown/pandora-citeproc integrations.

    I think your original reply was spot on: the main problem lies not so much with 'cite' but that we can't use the wildcards (e.g. %b for citekey) when changing the extraction format in the config editor (extensions.zotfile.pdfExtraction.formatAnnotationHighlight, etc.). Going through 'cite' and the xpi file is just a workaround because %b as a wildcard doesn't work in the config editor for some reason.

    So I see three options:

    a) either allow 'cite' to be defined through config editor (probably requires something like what you wrote above, except I'm unsure about line 258 because that currently erases the link to PDF page and instead adds an '@' plus square brackets ('[]') <- This would be the most complicated way, I guess.

    b) or allow the %b wildcard (and respectively %a and %y and so on) to be used in config editor values for pdfExtraction.format... <- This would likely be easiest to use but I'm not sure if its doable because as I recall from trying last time, none of the single letter wildcards work in config variables?

    c) for this specific problem: add a 'citekey' wildcard that works similar to 'cite' or 'page', i.e. is defined in the xpi but can be used in the config editor <- probably easiest to code/implement?
Sign In or Register to comment.