zotfile icon indicating copy to clipboard operation
zotfile copied to clipboard

Short title with N words

Open MarioJose opened this issue 6 years ago • 3 comments

Hi, all!

Is it possible to get a short title with, for instance, 3 first words. Like shortTitle in BetterBibTex. I try a personal wildcard:

{
"1": {
"field": "title",
"regex": "((?!\\b(is|are|the|a|an|do|does|can|could|will|would|of|to|and|from)\\b)\\b\\w+\\b)",
"group": 1,
"flag": "gi",
"transform": "capitalize"
}
}

But it is not working.

I have, for instance, this reference:

McNickle G. G. & Dybzinski R. (2013) Game theory and plant ecology. Ecol. Lett. 16 , 545–555.

And I would like rename with title like this: "Game_Theory_Plant" or "GameTheoryPlant"

My rename rule is: {%a_}{%y_}{[%s]_}{%1}

All the best,

Mario

MarioJose avatar Apr 02 '18 15:04 MarioJose

Bumping this! Would love to have this, this is how Bibdesk used to do it for me and the one thing that I really miss from Zotero.

lukaskawerau avatar Aug 14 '18 09:08 lukaskawerau

As of Zotfile v5.0.16, you can use the Wildcard for BetterBibTeX citekey (%b). Not a very versatile solution, but if like me you want your citekey as the .pdf name, it's perfect!

maximelucas avatar Apr 24 '20 10:04 maximelucas

I achieved this by chaining two operations: first eliminating unwanted words and then matching the first 3 words of the remaining words.

The definition of extensions.zotfile.wildcards.user is thus:

{
	"z": {
		"field": "title",
		"operations": [{
			"function": "replace",
			"regex": "\\b(is|are|the|a|an|as|do|does|can|could|will|would|of|for|in|to|and|from|with|without)\\b",
			"replacement": "",
			"flags": "gi"
		}, {
			"function": "exec",
			"regex": "(\\b[\\w-]+\\b\\s*?){3}"
		}]
	}
}

igor-koop avatar May 25 '23 11:05 igor-koop