mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-14 22:09:29 +02:00
Merge branch 'develop' of https://github.com/mermaid-js/mermaid into 6637-add-new-participant-types-to-sequence-diagrams
This commit is contained in:
5
.changeset/red-zebras-happen.md
Normal file
5
.changeset/red-zebras-happen.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'mermaid': patch
|
||||
---
|
||||
|
||||
fix: Allow equals sign in sequenceDiagram labels
|
@@ -38,6 +38,7 @@
|
||||
"actor" { this.begin('ID'); return 'participant_actor'; }
|
||||
"create" return 'create';
|
||||
"destroy" { this.begin('ID'); return 'destroy'; }
|
||||
<ID>[^<\->\->:\n,;]+?([\-]*[^<\->\->:\n,;]+?)*?(?=((?!\n)\s)+"as"(?!\n)\s|[#\n;]|$) { yytext = yytext.trim(); this.begin('ALIAS'); return 'ACTOR'; }
|
||||
<ALIAS>"as" { this.popState(); this.popState(); this.begin('LINE'); return 'AS'; }
|
||||
<ALIAS>(?:) { this.popState(); this.popState(); return 'NEWLINE'; }
|
||||
"loop" { this.begin('LINE'); return 'loop'; }
|
||||
@@ -77,7 +78,7 @@ accDescr\s*"{"\s* { this.begin("acc_descr_multili
|
||||
"off" return 'off';
|
||||
"," return ',';
|
||||
";" return 'NEWLINE';
|
||||
[^\+\<->\->:\n,;]+((?!(\-x|\-\-x|\-\)|\-\-\)))[\-]*[^\+\<->\->:\n,;]+)* { yytext = yytext.trim(); return 'ACTOR'; }
|
||||
[^+<\->\->:\n,;]+((?!(\-x|\-\-x|\-\)|\-\-\)))[\-]*[^\+<\->\->:\n,;]+)* { yytext = yytext.trim(); return 'ACTOR'; }
|
||||
"->>" return 'SOLID_ARROW';
|
||||
"<<->>" return 'BIDIRECTIONAL_SOLID_ARROW';
|
||||
"-->>" return 'DOTTED_ARROW';
|
||||
|
@@ -350,6 +350,26 @@ Bob-->Alice-in-Wonderland:I am good thanks!`);
|
||||
expect(messages[1].from).toBe('Bob');
|
||||
});
|
||||
|
||||
it('should handle equals in participant names', async () => {
|
||||
const diagram = await Diagram.fromText(`
|
||||
sequenceDiagram
|
||||
participant Alice=Wonderland
|
||||
participant Bob
|
||||
Alice=Wonderland->Bob:Hello Bob, how are - you?
|
||||
Bob-->Alice=Wonderland:I am good thanks!`);
|
||||
|
||||
const actors = diagram.db.getActors();
|
||||
expect([...actors.keys()]).toEqual(['Alice=Wonderland', 'Bob']);
|
||||
expect(actors.get('Alice=Wonderland').description).toBe('Alice=Wonderland');
|
||||
expect(actors.get('Bob').description).toBe('Bob');
|
||||
|
||||
const messages = diagram.db.getMessages();
|
||||
|
||||
expect(messages.length).toBe(2);
|
||||
expect(messages[0].from).toBe('Alice=Wonderland');
|
||||
expect(messages[1].from).toBe('Bob');
|
||||
});
|
||||
|
||||
it('should alias participants', async () => {
|
||||
const diagram = await Diagram.fromText(`
|
||||
sequenceDiagram
|
||||
|
Reference in New Issue
Block a user