-
Notifications
You must be signed in to change notification settings - Fork 22
Added support for custom tags in template input with regex conversion #501
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
base: main
Are you sure you want to change the base?
Added support for custom tags in template input with regex conversion #501
Conversation
…, bugs need to be fixed
Hello @JoeZiminski, I have a small doubt can you please help me. I encountered an error when setting the template validation to If it is indeed a bug, I’d be happy to address it in this PR itself. Looking forward to your guidance on this! |
Hi @sumana-2705, just FYI @JoeZiminski is away, so it may be some time until someone can get back to you. |
Yeah, no problem @adamltyson! I’m aware that @JoeZiminski is currently away. I just opened the PR so that he can review the implementation when he returns. Thank you for your time! 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(main comments below)
@@ -1179,6 +1179,21 @@ def get_name_templates(self) -> Dict: | |||
settings = self._load_persistent_settings() | |||
return settings["name_templates"] | |||
|
|||
def convert_custom_tags_to_regex(self, template: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function can be moved for format.py
Hi @sumana-2705 thanks for this! This is really good, a clean implementation and intuitive for users. I'm trying to think if any small improvements can be made (e.g. a tag less verbose than For merging, this would require update to docs and tests. Feel free to work on the tests, this would be something simple just to check the conversion is happening as desired, from stored name templates. Because this is happening at the level of the python API it is not necessary to explicitly test the TUI. Good question, in this case the error is a bit subtle. The problem is that the names must be made of key-value pairs separated by underscores, and keys cannot be integer. So for the name |
I think I agree. We can't just add loads of buttons for every possible option. |
Thanks for your review @JoeZiminski I will work on it. |
Description
What is this PR
Why is this PR needed?
This PR adds support for custom tags in template inputs following the first suggested option in the issue (#351), allowing users to define and use predefined placeholders (
<ANY_DIGIT>
,<ANY_STRING>
andANY_CHAR
) that automatically convert into corresponding regex patterns. This improves flexibility when defining naming conventions.What does this PR do?
convert_custom_tags_to_regex
function to replace custom tags with regex patterns.set_name_templates
to ensure correct transformation of input values.References
closes #351
How has this PR been tested?
Tested Locally
CustomTagsToRegex.mp4
Is this a breaking change?
No
Does this PR require an update to the documentation?
Yes, documentation need to be updated when this addition works fine.
Checklist: