Skip to content

Commit

Permalink
Merge d79f946 into b0c58a9
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreywolf committed Apr 23, 2023
2 parents b0c58a9 + d79f946 commit 9a1c81a
Show file tree
Hide file tree
Showing 9 changed files with 950 additions and 880 deletions.
2 changes: 1 addition & 1 deletion cypress/integration/rendering/classDiagram.spec.js
Expand Up @@ -286,7 +286,7 @@ describe('Class diagram', () => {
cy.get('svg');
});

it('15: should render a simple class diagram with css classes applied two multiple classes', () => {
it('15: should render a simple class diagram with css classes applied to multiple classes', () => {
imgSnapshotTest(
`
classDiagram
Expand Down
10 changes: 5 additions & 5 deletions docs/syntax/classDiagram.md
Expand Up @@ -128,7 +128,7 @@ classDiagram
Vehicle <|-- Car
```

Naming convention: a class name should be composed only of alphanumeric characters (including unicode), and underscores.
Naming convention: a class name should be composed only of alphanumeric characters (including unicode), underscores, and dashes (-).

### Class labels

Expand Down Expand Up @@ -283,12 +283,12 @@ To describe the visibility (or encapsulation) of an attribute or method/function
- `#` Protected
- `~` Package/Internal

> _note_ you can also include additional _classifiers_ to a method definition by adding the following notation to the _end_ of the method, i.e.: after the `()`:
> _note_ you can also include additional _classifiers_ to a method definition by adding the following notation to the _end_ of the method, i.e.: after the `()` or after the return type:
>
> - `*` Abstract e.g.: `someAbstractMethod()*`
> - `$` Static e.g.: `someStaticMethod()$`
> - `*` Abstract e.g.: `someAbstractMethod()*` or `someAbstractMethod() int*`
> - `$` Static e.g.: `someStaticMethod()$` or `someStaticMethod() String$`
> _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the end of its name:
> _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the very end:
>
> - `$` Static e.g.: `String someField$`
Expand Down
5 changes: 4 additions & 1 deletion packages/mermaid/src/diagrams/class/classDb.ts
Expand Up @@ -106,6 +106,7 @@ export const clear = function () {
export const getClass = function (id: string) {
return classes[id];
};

export const getClasses = function () {
return classes;
};
Expand Down Expand Up @@ -170,9 +171,10 @@ export const addMember = function (className: string, member: string) {
const memberString = member.trim();

if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
// Remove leading and trailing brackets
// its an annotation
theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2)));
} else if (memberString.indexOf(')') > 0) {
//its a method
theClass.methods.push(sanitizeText(memberString));
} else if (memberString) {
theClass.members.push(sanitizeText(memberString));
Expand Down Expand Up @@ -234,6 +236,7 @@ const setTooltip = function (ids: string, tooltip?: string) {
}
});
};

export const getTooltip = function (id: string) {
return classes[id].tooltip;
};
Expand Down

0 comments on commit 9a1c81a

Please sign in to comment.