jlegewie / zotfile

Zotero plugin to manage your attachments: automatically rename, move, and attach PDFs (or other files) to Zotero items, sync PDFs from your Zotero library to your (mobile) PDF reader (e.g. an iPad, Android tablet, etc.), and extract PDF annotations.
4.06k stars 282 forks source link

renaming-rules: return empty result for certain itemType #334

Open laclaro opened 6 years ago

laclaro commented 6 years ago

Hi,

I would like to separate theses ("itemType":"thesis") from a certain institution from the rest of my theses files.

I cannot get it working, using the rulesets at http://zotfile.com/index.html#renaming-rules.

I can identify my entry by the fields "place" or "school". The example below does match the desired theses and in those cases provides "specialtheses-directory" but in all non-matching cases, it gives the unmodified "place" field. Is there any possibility to achieve if then else, say "no match = empty result"?


{
  "1": {
    "default": "",
    "thesis": {
      **"default": "", <- would solve the problem **
      "field": "place",
      "operations": [
        {
          "function": "replace",
          "regex": "mycity",
          "replacement": "specialtheses-directory",
          "flags": "i"
        }
      ]
    }
  }
}

Henning

laclaro commented 6 years ago

any suggestion?

jlegewie commented 6 years ago

Please use the Zotero Forum for support questions. Not sure whether someone will respond there but this repository is for development issues.

laclaro commented 6 years ago

It is a development request. Please add the possibility to return an empty value as default for a certain itemType as sketched above. Thank you.

Best,

Henning

jlegewie commented 6 years ago

Got it. Sorry for the mix up. Reopening. Note that there is very very little active development right now though.