Fix for classDiagram-v2 support for generics using '~' & method emphasis

This commit is contained in:
Ashish Jain 2021-08-19 18:00:49 +02:00
parent 46a3d10e8a
commit 0276a67417
1 changed files with 17 additions and 3 deletions

View File

@ -672,7 +672,10 @@ const class_box = (parent, node) => {
}
const classAttributes = [];
node.classData.members.forEach((str) => {
const parsedText = parseMember(str).displayText;
let parsedText = parseMember(str).displayText;
if (getConfig().flowchart.htmlLabels) {
parsedText = parsedText.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
const lbl = labelContainer
.node()
.appendChild(createLabel(parsedText, node.labelStyle, true, true));
@ -695,10 +698,21 @@ const class_box = (parent, node) => {
const classMethods = [];
node.classData.methods.forEach((str) => {
const parsedText = parseMember(str).displayText;
const parsedInfo = parseMember(str);
let displayText =parsedInfo.displayText;
if (getConfig().flowchart.htmlLabels) {
displayText = displayText.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
const lbl = labelContainer
.node()
.appendChild(createLabel(parsedText, node.labelStyle, true, true));
.appendChild(
createLabel(
displayText,
parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle,
true,
true
)
);
let bbox = lbl.getBBox();
if (evaluate(getConfig().flowchart.htmlLabels)) {
const div = lbl.children[0];