-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Offer truncation of file names during file renaming #3915
Comments
Hi, the format is now the same as for the bibtex key generator: |
Yes, I want like this: |
Maybe relevant https://github.com/JabRef/help.jabref.org/issues/179. |
Note that it currently seems to be impossible to truncate the result. If that is the only additional requirement to our formerly known "label patterns" (now "Bibtex Key Patterns"), we maybe should offer a configuration option for that. |
Is this included in version 5.x? |
It doesn't seem like that. You're welcome to submit a pull request 😇 |
I can take a look at this issue. Would these steps make sense as a solution?
|
@k3KAW8Pnf7mkmdSMPHz27 The cleanup rename/moving takes two pattern, the fileDirPattern for naming the (sub)directory and the filenamePattern. Both use the same syntax as the ones for the bibtexkeypattern. I think I would decouple the cases here.
What's now missing is a TruncateModifier, which acts like the modifiers here: In the end the filenamepattern could look like this: |
@Siedlerchr, I'll get started on truncate, but I am not sure I understand what the use case is. I thought, perhaps erroneously, that pramitbiswas wanted to truncate the full filename (excluding the extension). Everything from here on is under the assumption that the use case is to truncate the full filename. I can think of three approaches,
|
I would also go with the The stacked pattern is a nice idea. I may warn you, however, that the code surrounding the pattern parser is really ugly / inflexible. So this might be hard to implement. |
@tobiasdiez, I'd guess the consensus is that I can have a look at the pattern parser while I am at it and see if I would enjoy/be able to change it. If that is the case, should I add a feature request and suggest myself to solve it later? Meanwhile, perhaps using the regex and only [bibtexkey] as a filepattern works as a temporary "fix" for @pramitbiswas. |
Good! There is no need to open a feature request. If you fell like implementing it, please go ahead and open a PR! |
First of all, thank you very much for taking the issue forward. Suppose for this bib entry
I saw the description in PR, I think it will solve the issue for me. The solution to the mentioned problem is |
@pramitbiswas you get a "java.nio.file.FileSystemException: " ... "File name too long" error message from JabRef when the problem occurs? (That is what happens when I am trying to recreate the error on a FAT drive which is quite limited in path length) |
Normally jabref auto truncates long file names. There is at least a method in FileUtil class |
I can't reproduce the error on what my system calls DOS_FAT_32 after applying the auto truncate to directory names (limiting them to a length of 255). |
Documentation for [JabRef issue 3915](JabRef/jabref#3915).
For reference: The PR where the system was changed is #3238. |
Thanks to @k3KAW8Pnf7mkmdSMPHz27 this is now implemented in the latest development version. Could you please check the build from http://builds.jabref.org/master/. Thanks! Please remember to make a backup of your library before trying-out this version. |
Previously I used
\bibtexkey\begin{title} - \format[Replace("(.{90}).*,$1", RemoveBrackets]{\title}\end{title}
for renaming pdf files when cleaning. But this does not work currently.Found this link.
i.e.,
[bibtexkey] - [title]
. But how to truncate the filename up to certain length(number) (say90
or100
).Basically, I want to replace the 1st expression to make things work, but not able to do it.
The text was updated successfully, but these errors were encountered: