What the heck is going on behind the scenes with ZotFile

I am having great difficulty understanding the instructions for User-defined Wildcards on ZotFile.com. They are very terse and I get the feeling the author is assuming an entire body of knowledge that I do not have. Is there some place else where I can go to get the background knowledge to understand what all those JSON elements are doing? Are they being passed to some standard JavaScript function that is well documented somewhere? In my searching, I have found other examples of zotfile.wildcards.user configurations (here: https://gist.github.com/jmiserez/e39753f3a31aa36bf00b0234c6fc6b53 and here http://felix11h.github.io/blog/zotero-zotfile-configof) that include keywords/commands/elements that are not even mentioned in the instructions at ZotFile.com. This tells me that ZotFile is using some standardized system or function but the author has just assumed we would all know what that system or function is.

I have no clue what that system or function is!

Can someone please enlighten me?
  • Zotfile wildcards are defined using JSON syntax (the nested curly brackets {} code you see in the examples you linked to).

    In the syntax, you first specify the name of the wildcard (e.g., on the zotfile.com page, it specifies the user-defined wildcards %1, %2, %3, and %4). You then say how that wildcard should be translated into item metadata.

    The first example on the page is the easiest—just give a Zotero field that should be used for all items (e.g., publicationTitle).

    The second example shows how to specify a different field for each item type—list the item types with a corresponding field for each, and be sure to include a "default" entry for item types not listed.

    The third example shows that you can use Regular Expressions for more complex operations (e.g., extracting part of a field, replacing part of a field with other text). Regular expressions are a somewhat complicated programming concept. You can learn more about them and practice using them here: http://regex101.com/

    The fourth example shows that you can combine 2 and 3 into one wildcard—using a different regular expression for different item types.
  • Thank you. However, this does not tell me much more than what is on ZotFile.com. I see that it is JSON. And I see that regular expressions can be used as PART of one of these sets of commands. But JSON is nothing more than a format for storing data. I need to know what all those commands mean. How are they put together to accomplish a task? That JSON is passed TO something. What is it passed to and how is that thing processing the commands in the JSON?

    Thanks.
  • You enter the JSON in the zotfile.wildcards.user preference in Zotero's config editor (Advanced pane of prefernces). Then, when you use one of your custom wildcards in your renaming rules (Zotfile preferences), Zotfile looks for the wildcard to be defined in the specified JSON. The JSON is structured so that it gives the name of the wildcard (e.g., 1 or 4 or w, etc.), then says what field to look up. You need to specify the variable names for Zotero fields (field names and and item types are listed here https://aurimasv.github.io/z2csl/typeMap.xml). You can either specify fields either for all item type (example 1) or by specifying functions for different types (example 2).

    If you want to know more, I recommend digging into the renaming code in Zotfile at https://github.com/jlegewie/zotfile and the Zotero developer documentation (https://www.zotero.org/support/dev/start).
  • edited January 24, 2018
    Deleted
  • edited January 24, 2018
    It's not mean, it's just really a resource question. The ZotFile developer put this in because he thought some people would find it useful. Some people do find it useful. It's clearly labeled as technical&advanced and bwiernik has given you a whole bunch of relevant pointers apart from the links to the code that should get you started, even though it may mean some trial & error. We just don't have the capacity to provide detailed step-by-steps on this type of thing.

    The alternative would be to just not offer them, which I hope you'd agree would be worse.

    So you can either try to play with the wildcards, figure out what you can, and then ask specific questions which we'll try to answer, or you can just use Zotero's or ZotFile's regular renaming features the way 99% of users do happily. What you can't do is demand that people spend their time walking you through advanced&technical config and then be offended when they don't.

    Edit: I just had a look at the Wildcard documentation on zotfile.com and while it's indeed relatively terse, once you follow the links, every single element I can see, including in the examples you link to is, in fact, defined.
This discussion has been closed.