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

feat: [activity] support quoted word as action message #309

Merged
merged 1 commit into from
Aug 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading