mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-02-04 07:13:25 +08:00
Fix svgDraw return types
Co-authored-by: FlorianWoelki <FlorianWoelki@gmx.de>
This commit is contained in:
parent
39980322bd
commit
15b160c553
@ -345,10 +345,9 @@ const buildMethodDisplay = function (parsedText) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const buildLegacyDisplay = function (text) {
|
const buildLegacyDisplay = function (text) {
|
||||||
// if for some reason we dont have any match, use old format to parse text
|
// if for some reason we don't have any match, use old format to parse text
|
||||||
let displayText = '';
|
let displayText = '';
|
||||||
let cssStyle = '';
|
let cssStyle = '';
|
||||||
let memberText = '';
|
|
||||||
let returnType = '';
|
let returnType = '';
|
||||||
let methodStart = text.indexOf('(');
|
let methodStart = text.indexOf('(');
|
||||||
let methodEnd = text.indexOf(')');
|
let methodEnd = text.indexOf(')');
|
||||||
@ -368,26 +367,27 @@ const buildLegacyDisplay = function (text) {
|
|||||||
methodName = text.substring(1, methodStart).trim();
|
methodName = text.substring(1, methodStart).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
let parameters = text.substring(methodStart + 1, methodEnd);
|
const parameters = text.substring(methodStart + 1, methodEnd);
|
||||||
let classifier = text.substring(methodEnd + 1, 1);
|
const classifier = text.substring(methodEnd + 1, methodEnd + 2);
|
||||||
cssStyle = parseClassifier(classifier);
|
cssStyle = parseClassifier(classifier);
|
||||||
|
|
||||||
displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
|
displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
|
||||||
|
|
||||||
if (methodEnd < memberText.length) {
|
if (methodEnd <= text.length) {
|
||||||
returnType = text.substring(methodEnd + 2).trim();
|
returnType = text.substring(methodEnd + 2).trim();
|
||||||
if (returnType !== '') {
|
if (returnType !== '') {
|
||||||
returnType = ' : ' + parseGenericTypes(returnType);
|
returnType = ' : ' + parseGenericTypes(returnType);
|
||||||
|
displayText += returnType;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// finally - if all else fails, just send the text back as written (other than parsing for generic types)
|
||||||
|
displayText = parseGenericTypes(text);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// finally - if all else fails, just send the text back as written (other than parsing for generic types)
|
|
||||||
displayText = parseGenericTypes(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
displayText: displayText,
|
displayText,
|
||||||
cssStyle: cssStyle,
|
cssStyle,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user