Skip to content

Commit

Permalink
fix(model): Display name of element in __html__ heading
Browse files Browse the repository at this point in the history
In the `__html__` representation, which is used for Jupyter, the name of
the type of the element was displayed in the heading at the top.

While the type is relatively uninteresting for the user, especially
because the xtype is displayed right after it, the user-specified name
of the element was only shown as part of the full list of attributes.

This commit replaces the type name in the heading with the user-given
name if available.
  • Loading branch information
MoritzWeber0 authored and Wuestengecko committed Jul 19, 2023
1 parent 59aea21 commit 99793ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion capellambse/model/common/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def __html__(self) -> markupsafe.Markup:
fragments.append("<h1>Model element")
else:
fragments.append("<h1>")
fragments.append(escape(type(self).__name__))
fragments.append(escape(self.name or type(self).__name__))
fragments.append(' <span style="font-size: 70%;">(')
fragments.append(escape(self.xtype))
fragments.append(")</span>")
Expand Down

0 comments on commit 99793ef

Please sign in to comment.