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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

nightroman
Copy link

@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
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
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.

2 participants