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.05k stars 281 forks source link

[Question]: How to avoid having commas in renamed files? #666

Open andreifoldes opened 1 year ago

andreifoldes commented 1 year ago

Greetings,

I was wondering how to best instruct Zotfile to avoid having commas in renamed files? Additionally I think this might be useful to be included in the default behavior...

Dale-Muccignat commented 1 year ago

Had a similar issue come up with apostrophes, whenever I'd open the filepath with another program it would get mad at me.

My solution was to create a custom wildcard in Edit -> preferences -> advanced -> config editor -> wildcards.user:

{"1": {"field": "title", "operations":[{"function":"titleFormated"},{"function":"replace","regex": "(')","replacement": "","flags": "g"}]}}

This uses the usual title formatting followed by a regex to replace any ' characters with nothing. Then in the zotfile preferences you can use %1 instead of %t for the renaming rules. If you replace ' with , it should give you the desired effect. I hope that helps :)