Allow tags in name template regexp. #404
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the way name templates handle tags. Previously, if a tag was used in a name template when it was compared against the formatted subject or session name it would fail e.g.
project.make_folders("rawdata", "sub-001_@DATE@")
with the name templatesub-\d\d\d_@DATE@
will fail as it will comparesub-001_date-<some_date>
tosub-\d\d\d_@DATE@
. The solution here is to also pre-format the name templates to their regexp equivalent e.g.sub-\d\d\d_@DATE@
->sub-\d\d\d_date-\d\d\d\d\d\d\d\d
.This reason this is implemented as it is very useful to use convenience tags in the name template as when autofilling the names in the TUI, if you could click to suggest next subject you would get
sub-001_@DATE@
which you can immediately click to create the folder. Previously, youd have to usedate-\d\d\d\d\d\d\d\d
in the name template and the auto-fill would besub-001_date-\d\d\d\d\d\d\d\d
which you would have to manually replace with@DATE@.
Checklist: