Skip to content

Commit 859aca9

Browse files
committed
Fix hiding of [+] (find issue nbr)
1 parent 43612f9 commit 859aca9

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

doc-tool/resources/_layouts/api-page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h1 class="section {% if entity.hasVisibleMembers == false %}empty{% endif %}">
9595
{% for member in entity.members %}
9696
<div id="{{ member.signature }}" class="member {% if member.isPrivate %}private{% elsif member.isProtected %}protected{% endif %}">
9797
<div class="member-title">
98-
<span class="expand-button" onclick="toggleMemberBody(this, '{{ member.signature }}');">[+]</span>
98+
<span class="expand-button {% if member.hasShortenedDocstring == false %}invisible{% endif %}" onclick="toggleMemberBody(this, '{{ member.signature }}');">[+]</span>
9999
<span class="member-annotations">
100100
{% for annot in member.annotations %}@{{ annot | split: '.' | last }} {% endfor %}
101101
</span>

doc-tool/resources/css/api-page.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ div.entity-section > div.member > div.member-title > span.expand-button:hover {
122122
user-select: none;
123123
}
124124

125+
div.entity-section > div.member > div.member-title > span.expand-button.invisible,
126+
div.entity-section > div.member > div.member-title > span.expand-button.invisible:hover {
127+
color: transparent;
128+
}
129+
125130
div.entity-section > div.member > div.member-body {
126131
margin: 5px 0 0 39px;
127132
}

doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ object JavaConverters {
5555
"comment" -> ent.comment.map(_.asJava).asJava,
5656
"superTypes" -> ent.superTypes,
5757
"hasVisibleMembers" -> ent.hasVisibleMembers,
58+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
5859
"signature" -> ent.signature
5960
) ++ extras).asJava
6061
}
@@ -74,6 +75,7 @@ object JavaConverters {
7475
"isPrivate" -> ent.isPrivate,
7576
"isProtected" -> ent.isProtected,
7677
"hasVisibleMembers" -> ent.hasVisibleMembers,
78+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
7779
"hasCompanion" -> ent.hasCompanion,
7880
"companionPath" -> ent.companionPath.asJava,
7981
"signature" -> ent.signature
@@ -95,6 +97,7 @@ object JavaConverters {
9597
"isPrivate" -> ent.isPrivate,
9698
"isProtected" -> ent.isProtected,
9799
"hasVisibleMembers" -> ent.hasVisibleMembers,
100+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
98101
"hasCompanion" -> ent.hasCompanion,
99102
"companionPath" -> ent.companionPath.asJava,
100103
"signature" -> ent.signature
@@ -115,6 +118,7 @@ object JavaConverters {
115118
"isPrivate" -> ent.isPrivate,
116119
"isProtected" -> ent.isProtected,
117120
"hasVisibleMembers" -> ent.hasVisibleMembers,
121+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
118122
"hasCompanion" -> ent.hasCompanion,
119123
"companionPath" -> ent.companionPath.asJava,
120124
"signature" -> ent.signature
@@ -134,6 +138,7 @@ object JavaConverters {
134138
"isPrivate" -> ent.isPrivate,
135139
"isProtected" -> ent.isProtected,
136140
"hasVisibleMembers" -> ent.hasVisibleMembers,
141+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
137142
"hasCompanion" -> ent.hasCompanion,
138143
"companionPath" -> ent.companionPath.asJava,
139144
"signature" -> ent.signature
@@ -152,6 +157,7 @@ object JavaConverters {
152157
"paramLists" -> ent.paramLists.map(_.asJava).asJava,
153158
"comment" -> ent.comment.map(_.asJava).asJava,
154159
"implicitlyAddedFrom" -> ent.implicitlyAddedFrom.map(_.asJava).asJava,
160+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
155161
"isPrivate" -> ent.isPrivate,
156162
"isProtected" -> ent.isProtected,
157163
"signature" -> ent.signature
@@ -168,6 +174,7 @@ object JavaConverters {
168174
"returnValue" -> ent.returnValue.asJava,
169175
"comment" -> ent.comment.map(_.asJava).asJava,
170176
"implicitlyAddedFrom" -> ent.implicitlyAddedFrom.map(_.asJava).asJava,
177+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
171178
"isPrivate" -> ent.isPrivate,
172179
"isProtected" -> ent.isProtected,
173180
"signature" -> ent.signature
@@ -183,6 +190,7 @@ object JavaConverters {
183190
"path" -> ent.path.asJava,
184191
"alias" -> ent.alias.map(_.asJava).asJava,
185192
"comment" -> ent.comment.map(_.asJava).asJava,
193+
"hasShortenedDocstring" -> ent.hasShortenedDocstring,
186194
"isPrivate" -> ent.isPrivate,
187195
"isProtected" -> ent.isProtected,
188196
"signature" -> ent.signature

doc-tool/src/dotty/tools/dottydoc/model/entities.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ trait Entity { entity =>
2121

2222
def annotations: List[String]
2323

24+
def hasShortenedDocstring: Boolean =
25+
comment.map(d => d.body.length > d.short.length).getOrElse(false)
26+
2427
def signature: String =
2528
entity.name + (entity match {
2629
case o: Object => "$"

0 commit comments

Comments
 (0)