mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 23:09:49 +02:00
WIP: Adding support for more shapes
This commit is contained in:
@@ -67,6 +67,10 @@ terminal ROUNDED_STR_QUOTES: /\(\"([\s\S]*?)\"\)/;
|
|||||||
terminal ROUNDED_STR: /\(([\s\S]*?)\)/;
|
terminal ROUNDED_STR: /\(([\s\S]*?)\)/;
|
||||||
terminal SQUARE_STR_QUOTES: /\[\"([\s\S]*?)\"\]/;
|
terminal SQUARE_STR_QUOTES: /\[\"([\s\S]*?)\"\]/;
|
||||||
terminal SQUARE_STR: /\[([\s\S]*?)\]/;
|
terminal SQUARE_STR: /\[([\s\S]*?)\]/;
|
||||||
|
terminal BANG_STR_QUOTES: /\[\"([\s\S]*?)\"\]/;
|
||||||
|
terminal BANG_STR: /\[([\s\S]*?)\]/;
|
||||||
|
terminal CLOUD_STR_QUOTES: /\)\"([\s\S]*?)\"\(/;
|
||||||
|
terminal CLOUD_STR: /\)([\s\S]*?)\(/;
|
||||||
// terminal CIRCLE_STR: /(?!\(\()[\s\S]+?(?!\(\()/;
|
// terminal CIRCLE_STR: /(?!\(\()[\s\S]+?(?!\(\()/;
|
||||||
terminal ID: /[a-zA-Z0-9_\-\.\/]+/;
|
terminal ID: /[a-zA-Z0-9_\-\.\/]+/;
|
||||||
terminal STRING: /"[^"]*"|'[^']*'/;
|
terminal STRING: /"[^"]*"|'[^']*'/;
|
||||||
|
@@ -19,6 +19,14 @@ export class MindmapValueConverter extends AbstractMermaidValueConverter {
|
|||||||
return input.replace('[', '').replace(']', '').trim();
|
return input.replace('[', '').replace(']', '').trim();
|
||||||
} else if (rule.name === 'SQUARE_STR_QUOTES') {
|
} else if (rule.name === 'SQUARE_STR_QUOTES') {
|
||||||
return input.replace('["', '').replace('"]', '').trim();
|
return input.replace('["', '').replace('"]', '').trim();
|
||||||
|
} else if (rule.name === 'BANG_STR') {
|
||||||
|
return input.replace('))', '').replace('((', '').trim();
|
||||||
|
} else if (rule.name === 'BANG_STR_QUOTES') {
|
||||||
|
return input.replace('))"', '').replace('"((', '').trim();
|
||||||
|
} else if (rule.name === 'CLOUD_STR') {
|
||||||
|
return input.replace(')', '').replace('(', '').trim();
|
||||||
|
} else if (rule.name === 'CLOUD_STR_QUOTES') {
|
||||||
|
return input.replace(')"', '').replace('"(', '').trim();
|
||||||
} else if (rule.name === 'ARCH_TEXT_ICON') {
|
} else if (rule.name === 'ARCH_TEXT_ICON') {
|
||||||
return input.replace(/["()]/g, '');
|
return input.replace(/["()]/g, '');
|
||||||
} else if (rule.name === 'ARCH_TITLE') {
|
} else if (rule.name === 'ARCH_TITLE') {
|
||||||
|
@@ -174,7 +174,7 @@ describe('Nodes (ported from mindmap.spec.ts)', () => {
|
|||||||
expect(childNode.desc).toBe('child1');
|
expect(childNode.desc).toBe('child1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('MMP-9 should handle an id and type for a node definition', () => {
|
it.only('MMP-9 should handle an id and type for a node definition', () => {
|
||||||
const result = parse('mindmap\nroot\n theId(child1)');
|
const result = parse('mindmap\nroot\n theId(child1)');
|
||||||
expect(result.lexerErrors).toHaveLength(0);
|
expect(result.lexerErrors).toHaveLength(0);
|
||||||
expect(result.parserErrors).toHaveLength(0);
|
expect(result.parserErrors).toHaveLength(0);
|
||||||
@@ -196,6 +196,7 @@ describe('Nodes (ported from mindmap.spec.ts)', () => {
|
|||||||
|
|
||||||
it('MMP-11 multiple types (cloud)', () => {
|
it('MMP-11 multiple types (cloud)', () => {
|
||||||
const result = parse('mindmap\nroot)the root(');
|
const result = parse('mindmap\nroot)the root(');
|
||||||
|
console.debug('RESULT:', result.parserErrors);
|
||||||
expect(result.lexerErrors).toHaveLength(0);
|
expect(result.lexerErrors).toHaveLength(0);
|
||||||
expect(result.parserErrors).toHaveLength(0);
|
expect(result.parserErrors).toHaveLength(0);
|
||||||
const rootNode = result.value.MindmapRows[0].item as OtherComplex;
|
const rootNode = result.value.MindmapRows[0].item as OtherComplex;
|
||||||
|
Reference in New Issue
Block a user