Repository navigation
feat: Add method to map regex patterns to descriptive names - #2036
Conversation
Added a `getDrawValue` method that translates regex patterns (e.g., `\b`, `\d`, etc.) into descriptive names (e.g., `WordBoundary`, `Digit`). This improves readability and provides a clear mapping for regex special characters.
|
Thanks for this PR. Here are some open questions...
There are only open questions... Regards, |
|
Thank you for the effort and thought put into this PR. The proposal to translate regex patterns into descriptive names is indeed an interesting idea. That being said, I fully agree with the points raised by Th:
I would love to hear everyone's thoughts on these suggestions and how we can collectively plan the next steps for this feature. Thanks again for this valuable contribution, and I appreciate the open discussion. |
…onfigure useDescriptiveNames field - Added a configuration for the useDescriptiveNames field, allowing escaped regular expressions for matching. - Improved internationalization handling to enhance multi-language support flexibility.
|
@The-Lum @arnaudroques
Thanks |
|
Hello @shunlibest, @arnaudroques, Good enhancement. 👍
Beware of how to pass parameter to plantuml:
Open to debate... |
|
Yes, it might be time to standardize all of this. Regarding What would you think about introducing a new directive at the preprocessor level? For example: !option language cn
!option useDescriptiveNames true
!option mode compact This could lead to something like: @startregex
!option language cn
!option useDescriptiveNames true
\b\B
@endregex From an implementation standpoint, these What do you think? P.S.: A big thank you to @shunlibest for kickstarting the i18n efforts. We’ll likely apply the same principles to Gantt diagrams... The TODO list keeps growing! 😊 |
|
Hi @arnaudroques,
Good things 👍 Then:
That seems good. But [always] a new open question:
[I know, I'm demanding] Like for style:
Regards, |
|
To keep things simple for now, all options will be global. This means that a directive like: would apply to all diagram types (e.g., Gantt, Regex, Timing, etc.) uniformly. While local or scoped options could certainly be valuable, we'll focus first on establishing a global system. This keeps the implementation straightforward and ensures consistency across all diagrams. Of course, as the system evolves, we can revisit the idea of scoped configurations. |
|
Hi, That seems good for a first beginning. 👍 Regards, |
|
@shunlibest, thank you once again for your valuable contribution! In the latest snapshot, we've made a slight syntax adjustment as shown below: We'd love to hear your thoughts! Any feedback or suggestions are welcome. PS: The next step will be to apply a similar approach to Gantt diagrams. |
|
I have reviewed your PR.I think your changes are wonderful and great. You've refactored a lot of code, which I'm not capable of doing. This change, establish a unified standard, it is very important. In the future, more experimental features can be added. More people can participate in plantUML, and plantUML will become more and more powerful. Finally, for this useDescriptiveNames feature, I think it can be turned on by default after some time. Thanks. |
| @@ -0,0 +1,9 @@ | |||
| ebnf.wordBoundary=WordBoundary | |||
There was a problem hiding this comment.
Hello @shunlibest, @arnaudroques
After new analysing...
-
Why not to change
ebnftoregexmore accurate on this side.
Because even if the code in on the EBNF side the usage is only for REGEX diagram... -
Do you agree with this change?
Regards,
Th.
|
Hello @shunlibest, @arnaudroques Here are some tests. @startregex
!option language de
!option useDescriptiveNames true
\d?\D+\w*\W{1,2}|\s.\S
@endregexBut not on range: ❌ @startregex
!option language de
!option useDescriptiveNames true
\d\w|[\d\w0-9Z](\d|\w|[0-9]|Z)
@endregex
Link to #1929 I can also update the doc. with this new feature (of descriptive names on REGEX diagram)... |




Added a
getDrawValuemethod that translates regex patterns (e.g.,\b,\d, etc.) into descriptive names (e.g.,WordBoundary,Digit). This improves readability and provides a clear mapping for regex special characters.