Skip to content
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

Escape labels in UmlDotGraphStyle #597

Merged
merged 2 commits into from
Dec 23, 2024
Merged

Conversation

nightroman
Copy link
Contributor

@nightroman nightroman commented Aug 4, 2024

UmlDotGraph does not escape special characters like " and \ in state,
trigger, description labels. As a result, the generated DOT is invalid when
such labels exist.

This is not a big deal perhaps when labels are carefully selected in order to
work around this issue. But state machines may be dynamically created from
data/strings not originally designed with Stateless and this issue in mind.

This PR includes:

  • new method UmlDotGraphStyle.EscapeLabel
  • UmlDotGraphStyle uses this method when required
  • added the new test SimpleTransitionWithEscaping, similar to SimpleTransition but using problematic labels
  • removed the test SimpleTransitionUML because it seems to be completely identical to SimpleTransition
  • reworked the existing test SpacedUmlWithSubstate so that it uses problematic states, triggers, descriptions

P.S. I hit this issue with real use cases on making state machines in PowerShell for using with FarNet.Stateless.

@nightroman
Copy link
Contributor Author

Any feedback please? If it's not being addressed, I'd rather close the PR than have it in my TODO list...

@crozone crozone self-assigned this Oct 3, 2024
@crozone
Copy link
Collaborator

crozone commented Oct 3, 2024

Hi @nightroman, just getting around to reviewing this, thanks for the bump. It might take a day or two.

@crozone crozone requested a review from mclift October 6, 2024 23:58
@nightroman
Copy link
Contributor Author

bump

@mclift
Copy link
Member

mclift commented Dec 23, 2024

Thanks for this, @nightroman.

@mclift mclift merged commit a128944 into dotnet-state-machine:dev Dec 23, 2024
1 check passed
@nightroman
Copy link
Contributor Author

@mclift Thank you, looking forward to the NuGet package update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants