Skip to content

Commit

Permalink
feat: [activity] support quoted word as action message (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
hikerpig authored Aug 3, 2024
1 parent 4363601 commit 0b31164
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .changeset/flat-plants-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@pintora/diagrams': patch
'@pintora/cli': patch
'@pintora/standalone': patch
---

feat: [activity] support quoted word as action message
Original file line number Diff line number Diff line change
Expand Up @@ -712,4 +712,14 @@ repeatwhile (data available) is (yes) not (no)
const ir = db.getDiagramIR()
expect(ir.title).toEqual('Hello')
})

it('can parse quoted word in action', () => {
const example = stripStartEmptyLines(`
activityDiagram
:"for (var i = 0; i <= n; i++)";
`)
parse(example)
const ir = db.getDiagramIR()
expect(ir.steps[0].value.message).toEqual('for (var i = 0; i <= n; i++)')
})
})
11 changes: 9 additions & 2 deletions packages/pintora-diagrams/src/activity/parser/activityDiagram.ne
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,16 @@ oneLineAction ->
%}

multilineText ->
(%VALID_TEXT|%WS|%NL):* {%
%QUOTED_WORD {%
function(d) {
// console.log('[multiline text]', d)
const ele = d[0]
return getQuotedWord(ele)
}
%}
| (%VALID_TEXT|%WS|%NL):* {%
function(d) {
const ele = d[0]
// console.log('[multiline text]', ele)
const v = d[0].map(l => {
return l.map(o => tv(o))
}).join('')
Expand Down

0 comments on commit 0b31164

Please sign in to comment.