Cleanup
This commit is contained in:
parent
fdd7af9089
commit
ed56e4858a
|
@ -2,6 +2,13 @@ import { log } from '../../logger';
|
||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import * as configApi from '../../config';
|
import * as configApi from '../../config';
|
||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
|
import {
|
||||||
|
setTitle,
|
||||||
|
getTitle,
|
||||||
|
getAccDescription,
|
||||||
|
setAccDescription,
|
||||||
|
clear as commonClear,
|
||||||
|
} from '../../commonDb';
|
||||||
|
|
||||||
let entities = {};
|
let entities = {};
|
||||||
let relationships = [];
|
let relationships = [];
|
||||||
|
@ -68,29 +75,11 @@ const addRelationship = function (entA, rolA, entB, rSpec) {
|
||||||
|
|
||||||
const getRelationships = () => relationships;
|
const getRelationships = () => relationships;
|
||||||
|
|
||||||
// Keep this - TODO: revisit...allow the diagram to have a title
|
|
||||||
const setTitle = function (txt) {
|
|
||||||
let sanitizedText = common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
title = sanitizedText;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getTitle = function () {
|
|
||||||
return title;
|
|
||||||
};
|
|
||||||
|
|
||||||
const setAccDescription = function (txt) {
|
|
||||||
let sanitizedText = common.sanitizeText(txt, configApi.getConfig());
|
|
||||||
description = sanitizedText;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getAccDescription = function () {
|
|
||||||
return description;
|
|
||||||
};
|
|
||||||
|
|
||||||
const clear = function () {
|
const clear = function () {
|
||||||
entities = {};
|
entities = {};
|
||||||
relationships = [];
|
relationships = [];
|
||||||
title = '';
|
title = '';
|
||||||
|
commonClear();
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -5,6 +5,13 @@ import * as configApi from '../../config';
|
||||||
import utils from '../../utils';
|
import utils from '../../utils';
|
||||||
import mermaidAPI from '../../mermaidAPI';
|
import mermaidAPI from '../../mermaidAPI';
|
||||||
import common from '../common/common';
|
import common from '../common/common';
|
||||||
|
import {
|
||||||
|
setTitle,
|
||||||
|
getTitle,
|
||||||
|
getAccDescription,
|
||||||
|
setAccDescription,
|
||||||
|
clear as commonClear,
|
||||||
|
} from '../../commonDb';
|
||||||
|
|
||||||
let dateFormat = '';
|
let dateFormat = '';
|
||||||
let axisFormat = '';
|
let axisFormat = '';
|
||||||
|
@ -52,6 +59,7 @@ export const clear = function () {
|
||||||
topAxis = false;
|
topAxis = false;
|
||||||
lastOrder = 0;
|
lastOrder = 0;
|
||||||
links = {};
|
links = {};
|
||||||
|
commonClear();
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setAxisFormat = function (txt) {
|
export const setAxisFormat = function (txt) {
|
||||||
|
@ -113,22 +121,6 @@ export const getLinks = function () {
|
||||||
return links;
|
return links;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setTitle = function (txt) {
|
|
||||||
title = sanitizeText(txt);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getTitle = function () {
|
|
||||||
return title;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const setAccDescription = function (txt) {
|
|
||||||
accDescription = sanitizeText(txt);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getAccDescription = function () {
|
|
||||||
return accDescription;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const addSection = function (txt) {
|
export const addSection = function (txt) {
|
||||||
currentSection = txt;
|
currentSection = txt;
|
||||||
sections.push(txt);
|
sections.push(txt);
|
||||||
|
|
|
@ -175,7 +175,7 @@ describe('when parsing a gantt diagram it', function () {
|
||||||
it('should allow for a accessibility title and multiline description (accDescr)', function () {
|
it('should allow for a accessibility title and multiline description (accDescr)', function () {
|
||||||
const expectedTitle = 'Gantt Diagram';
|
const expectedTitle = 'Gantt Diagram';
|
||||||
const expectedAccDescription = `Tasks for Q4 row1
|
const expectedAccDescription = `Tasks for Q4 row1
|
||||||
row2`;
|
row2`;
|
||||||
const ganttString = `gantt
|
const ganttString = `gantt
|
||||||
accTitle: ${expectedTitle}
|
accTitle: ${expectedTitle}
|
||||||
accDescr {
|
accDescr {
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('state diagram, ', function () {
|
||||||
});
|
});
|
||||||
it('simple with accDescription', function () {
|
it('simple with accDescription', function () {
|
||||||
const str = `stateDiagram-v2\n
|
const str = `stateDiagram-v2\n
|
||||||
accDescription a simple description of the diagram
|
accDescr: a simple description of the diagram
|
||||||
State1 : this is another string
|
State1 : this is another string
|
||||||
[*] --> State1
|
[*] --> State1
|
||||||
State1 --> [*]
|
State1 --> [*]
|
||||||
|
@ -41,7 +41,7 @@ describe('state diagram, ', function () {
|
||||||
});
|
});
|
||||||
it('simple with title', function () {
|
it('simple with title', function () {
|
||||||
const str = `stateDiagram-v2\n
|
const str = `stateDiagram-v2\n
|
||||||
title a simple title of the diagram
|
accTitle: a simple title of the diagram
|
||||||
State1 : this is another string
|
State1 : this is another string
|
||||||
[*] --> State1
|
[*] --> State1
|
||||||
State1 --> [*]
|
State1 --> [*]
|
||||||
|
|
Loading…
Reference in New Issue