Skip to content

Commit

Permalink
Merge branch 'develop' into feature/4401_creating_langium_parser_gitG…
Browse files Browse the repository at this point in the history
…raph
  • Loading branch information
Austin-Fulbright authored Aug 20, 2024
2 parents b93691b + 04c29e2 commit 4ec0dcf
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 11 deletions.
1 change: 1 addition & 0 deletions docs/ecosystem/integrations-community.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ To add an integration to this list, see the [Integrations - create page](./integ
- [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator)
- [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts)
- [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)
- [MonsterWriter](https://www.monsterwriter.com/)
- [Joplin](https://joplinapp.org)
- [LiveBook](https://livebook.dev)
- [Tuleap](https://docs.tuleap.org/user-guide/writing-in-tuleap.html#graphs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { line, select } from 'd3';
import { layout as dagreLayout } from 'dagre-d3-es/src/dagre/index.js';
import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';
import { getConfig } from '../../diagram-api/diagramAPI.js';
import { log } from '../../logger.js';
import { configureSvgSize } from '../../setupGraphViewbox.js';
import common from '../common/common.js';
import markers from './requirementMarkers.js';
import { getConfig } from '../../diagram-api/diagramAPI.js';

let conf = {};
let relCnt = 0;
Expand Down
8 changes: 4 additions & 4 deletions packages/mermaid/src/diagrams/timeline/parser/timeline.jison
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
\#[^\n]* /* skip comments */

"timeline" return 'timeline';
"title"\s[^#\n;]+ return 'title';
"title"\s[^\n]+ return 'title';
accTitle\s*":"\s* { this.begin("acc_title");return 'acc_title'; }
<acc_title>(?!\n|;|#)*[^\n]* { this.popState(); return "acc_title_value"; }
accDescr\s*":"\s* { this.begin("acc_descr");return 'acc_descr'; }
<acc_descr>(?!\n|;|#)*[^\n]* { this.popState(); return "acc_descr_value"; }
accDescr\s*"{"\s* { this.begin("acc_descr_multiline");}
<acc_descr_multiline>[\}] { this.popState(); }
<acc_descr_multiline>[^\}]* return "acc_descr_multiline_value";
"section"\s[^#:\n;]+ return 'section';
"section"\s[^:\n]+ return 'section';

// event starting with "==>" keyword
":"\s[^#:\n;]+ return 'event';
[^#:\n;]+ return 'period';
":"\s[^:\n]+ return 'event';
[^#:\n]+ return 'period';


<<EOF>> return 'EOF';
Expand Down
50 changes: 44 additions & 6 deletions packages/mermaid/src/diagrams/timeline/timeline.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { setLogLevel } from '../../diagram-api/diagramAPI.js';
import * as commonDb from '../common/commonDb.js';
import { parser as timeline } from './parser/timeline.jison';
import * as timelineDB from './timelineDb.js';
import { setLogLevel } from '../../diagram-api/diagramAPI.js';

describe('when parsing a timeline ', function () {
beforeEach(function () {
Expand All @@ -9,15 +10,15 @@ describe('when parsing a timeline ', function () {
setLogLevel('trace');
});
describe('Timeline', function () {
it('TL-1 should handle a simple section definition abc-123', function () {
it('should handle a simple section definition abc-123', function () {
let str = `timeline
section abc-123`;

timeline.parse(str);
expect(timelineDB.getSections()).to.deep.equal(['abc-123']);
});

it('TL-2 should handle a simple section and only two tasks', function () {
it('should handle a simple section and only two tasks', function () {
let str = `timeline
section abc-123
task1
Expand All @@ -29,7 +30,7 @@ describe('when parsing a timeline ', function () {
});
});

it('TL-3 should handle a two section and two coressponding tasks', function () {
it('should handle a two section and two coressponding tasks', function () {
let str = `timeline
section abc-123
task1
Expand All @@ -50,7 +51,7 @@ describe('when parsing a timeline ', function () {
});
});

it('TL-4 should handle a section, and task and its events', function () {
it('should handle a section, and task and its events', function () {
let str = `timeline
section abc-123
task1: event1
Expand All @@ -74,7 +75,7 @@ describe('when parsing a timeline ', function () {
});
});

it('TL-5 should handle a section, and task and its multi line events', function () {
it('should handle a section, and task and its multi line events', function () {
let str = `timeline
section abc-123
task1: event1
Expand All @@ -98,5 +99,42 @@ describe('when parsing a timeline ', function () {
}
});
});

it('should handle a title, section, task, and events with semicolons', function () {
let str = `timeline
title ;my;title;
section ;a;bc-123;
;ta;sk1;: ;ev;ent1; : ;ev;ent2; : ;ev;ent3;
`;
timeline.parse(str);
expect(commonDb.getDiagramTitle()).equal(';my;title;');
expect(timelineDB.getSections()).to.deep.equal([';a;bc-123;']);
expect(timelineDB.getTasks()[0].events).toMatchInlineSnapshot(`
[
";ev;ent1; ",
";ev;ent2; ",
";ev;ent3;",
]
`);
});

it('should handle a title, section, task, and events with hashtags', function () {
let str = `timeline
title #my#title#
section #a#bc-123#
task1: #ev#ent1# : #ev#ent2# : #ev#ent3#
`;
timeline.parse(str);
expect(commonDb.getDiagramTitle()).equal('#my#title#');
expect(timelineDB.getSections()).to.deep.equal(['#a#bc-123#']);
expect(timelineDB.getTasks()[0].task).equal('task1');
expect(timelineDB.getTasks()[0].events).toMatchInlineSnapshot(`
[
"#ev#ent1# ",
"#ev#ent2# ",
"#ev#ent3#",
]
`);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ To add an integration to this list, see the [Integrations - create page](./integ
- [SVG diagram generator](https://github.com/SimonKenyonShepard/mermaidjs-github-svg-generator)
- [GitLab](https://docs.gitlab.com/ee/user/markdown.html#diagrams-and-flowcharts)
- [Mermaid Plugin for JetBrains IDEs](https://plugins.jetbrains.com/plugin/20146-mermaid)
- [MonsterWriter](https://www.monsterwriter.com/)
- [Joplin](https://joplinapp.org)
- [LiveBook](https://livebook.dev)
- [Tuleap](https://docs.tuleap.org/user-guide/writing-in-tuleap.html#graphs)
Expand Down

0 comments on commit 4ec0dcf

Please sign in to comment.