From 688dc0bd667aa2ee816d5ce6fcc1391afde9f3cb Mon Sep 17 00:00:00 2001 From: Varunram Date: Sat, 20 May 2017 23:50:17 +0530 Subject: [PATCH 1/3] Prelimary Fix for #2211:add expand/collapse all to sections of dottydoc --- doc-tool/resources/_layouts/api-page.html | 22 +++++++++++++------ doc-tool/resources/css/api-page.css | 21 ++++++++++++++++++ .../dotty/tools/dottydoc/model/entities.scala | 2 +- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/doc-tool/resources/_layouts/api-page.html b/doc-tool/resources/_layouts/api-page.html index fb2d466b43b1..d52dec11e3fa 100644 --- a/doc-tool/resources/_layouts/api-page.html +++ b/doc-tool/resources/_layouts/api-page.html @@ -67,6 +67,7 @@ {% endif %}

+ [-] Constructors

@@ -97,6 +98,7 @@

+ [-] Members

@@ -169,21 +171,27 @@

-
- {{ member.comment.short }} -
{{ member.comment.body }}
diff --git a/doc-tool/resources/css/api-page.css b/doc-tool/resources/css/api-page.css index 48a3162bbcc1..16def6b5978d 100644 --- a/doc-tool/resources/css/api-page.css +++ b/doc-tool/resources/css/api-page.css @@ -66,6 +66,23 @@ h1.section { margin: 30px 0; } +h1.section > span.expand-button { + color: rgba(167, 161, 161, 0.5); + font-family: "Source Code Pro", sans-serif; + font-size: 25px; +} + +h1.section > span.expand-button:hover { + color: rgb(167, 161, 161); + cursor: pointer; + user-select: none; +} + +h1.section > span.expand-button.invisible, +h1.section > span.expand-button.invisible:hover { + color: transparent; +} + .empty { display: none; } @@ -142,3 +159,7 @@ div.entity-section > div.member > div.member-body > div.member-body-long { div.entity-section > div.member > div.member-body > div.member-body-long.toggled { display: block; } + +div.entity-section.toggled{ + display: none; +} diff --git a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala index d0f1a82c7cab..384870e53e49 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala @@ -22,7 +22,7 @@ trait Entity { entity => def annotations: List[String] def hasShortenedDocstring: Boolean = - comment.map(d => d.body.length > d.short.length).getOrElse(false) + comment.map(d => d.body.length > 0).getOrElse(false) def signature: String = entity.name + (entity match { From b364502618466c81a5c0645f751ad2367743e184 Mon Sep 17 00:00:00 2001 From: Varunram Date: Sun, 21 May 2017 12:58:52 +0530 Subject: [PATCH 2/3] Remove all instances of comment.short from dottydoc codebase --- doc-tool/resources/_layouts/api-page.html | 16 ++-- .../resources/_layouts/main.html.original | 75 +++++++++++++++++++ doc-tool/resources/_layouts/rand.sh | 4 + doc-tool/resources/css/api-page.css | 18 ++--- .../tools/dottydoc/model/JavaConverters.scala | 1 - .../dotty/tools/dottydoc/model/entities.scala | 3 - doc-tool/test/JavaConverterTest.scala | 1 - 7 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 doc-tool/resources/_layouts/main.html.original create mode 100644 doc-tool/resources/_layouts/rand.sh diff --git a/doc-tool/resources/_layouts/api-page.html b/doc-tool/resources/_layouts/api-page.html index d52dec11e3fa..484f7ae58b8b 100644 --- a/doc-tool/resources/_layouts/api-page.html +++ b/doc-tool/resources/_layouts/api-page.html @@ -67,7 +67,7 @@ {% endif %}

- [-] + [-] Constructors

@@ -98,7 +98,7 @@

- [-] + [-] Members

@@ -106,7 +106,7 @@

{% for member in entity.members %}
- [+] + [+] {% for annot in member.annotations %}@{{ annot | split: '.' | last }} {% endfor %} @@ -177,14 +177,8 @@

+ + + + {% for js in page.extraJS %} + + {% endfor %} + + + +\n +\n +\n diff --git a/doc-tool/resources/_layouts/rand.sh b/doc-tool/resources/_layouts/rand.sh new file mode 100644 index 000000000000..378de257bbfa --- /dev/null +++ b/doc-tool/resources/_layouts/rand.sh @@ -0,0 +1,4 @@ +currdate=$(date "+%Y-%m-%d\ %H:%M:%S") +currDateComment="" +sed -i '.original' "1s/^/$currDateComment\\ +/" main.html diff --git a/doc-tool/resources/css/api-page.css b/doc-tool/resources/css/api-page.css index 16def6b5978d..3c24ef281049 100644 --- a/doc-tool/resources/css/api-page.css +++ b/doc-tool/resources/css/api-page.css @@ -66,20 +66,20 @@ h1.section { margin: 30px 0; } -h1.section > span.expand-button { +h1.section > span.expand-button.visible { color: rgba(167, 161, 161, 0.5); font-family: "Source Code Pro", sans-serif; font-size: 25px; } -h1.section > span.expand-button:hover { +h1.section > span.expand-button.visible:hover { color: rgb(167, 161, 161); cursor: pointer; user-select: none; } -h1.section > span.expand-button.invisible, -h1.section > span.expand-button.invisible:hover { +h1.section > span.expand-button, +h1.section > span.expand-button.hover { color: transparent; } @@ -129,18 +129,18 @@ div.entity-section > div.member > div.member-title span.no-right { margin-right: -11px; } -div.entity-section > div.member > div.member-title > span.expand-button { +div.entity-section > div.member > div.member-title > span.expand-button.visible { color: rgba(167, 161, 161, 0.5); } -div.entity-section > div.member > div.member-title > span.expand-button:hover { +div.entity-section > div.member > div.member-title > span.expand-button.visible:hover { color: rgb(167, 161, 161); cursor: pointer; user-select: none; } -div.entity-section > div.member > div.member-title > span.expand-button.invisible, -div.entity-section > div.member > div.member-title > span.expand-button.invisible:hover { +div.entity-section > div.member > div.member-title > span.expand-button, +div.entity-section > div.member > div.member-title > span.expand-button:hover { color: transparent; } @@ -160,6 +160,6 @@ div.entity-section > div.member > div.member-body > div.member-body-long.toggled display: block; } -div.entity-section.toggled{ +div.entity-section.toggled { display: none; } diff --git a/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala b/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala index 91a964393738..dfb6e35df7b1 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/JavaConverters.scala @@ -151,7 +151,6 @@ object JavaConverters { "path" -> ent.path.asJava, "children" -> ent.children.map(_.asJava()).asJava, "comment" -> ent.comment.map(_.asJava).asJava, - "hasShortenedDocstring" -> ent.hasShortenedDocstring, "signature" -> ent.signature ) val members = ent match { diff --git a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala index 384870e53e49..cede5f48f8cf 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala @@ -21,9 +21,6 @@ trait Entity { entity => def annotations: List[String] - def hasShortenedDocstring: Boolean = - comment.map(d => d.body.length > 0).getOrElse(false) - def signature: String = entity.name + (entity match { case o: Object => "$" diff --git a/doc-tool/test/JavaConverterTest.scala b/doc-tool/test/JavaConverterTest.scala index f9046a8918d0..502488e32c72 100644 --- a/doc-tool/test/JavaConverterTest.scala +++ b/doc-tool/test/JavaConverterTest.scala @@ -230,7 +230,6 @@ class JavaConverterTest { assertEquals(expected.kind, actual.get("kind")) assertSameSeq(expected.annotations, actual.get("annotations")) assertSameSeq(expected.path, actual.get("path")) - assertEquals(expected.hasShortenedDocstring, actual.get("hasShortenedDocstring")) // Only test if a comment is present expected.comment match { case Some(c) => assertNotEquals(null, actual.get("comment")) From a911201ecf49792df753207c70103c4ceaef8196 Mon Sep 17 00:00:00 2001 From: Varunram Date: Sun, 21 May 2017 13:02:58 +0530 Subject: [PATCH 3/3] Remove backup file --- .../resources/_layouts/main.html.original | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 doc-tool/resources/_layouts/main.html.original diff --git a/doc-tool/resources/_layouts/main.html.original b/doc-tool/resources/_layouts/main.html.original deleted file mode 100644 index 85fe110f41b3..000000000000 --- a/doc-tool/resources/_layouts/main.html.original +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - {{ page.title }} - - - - - - - - - - - - {% for css in page.extraCSS %} - - {% endfor %} - - - - {{ content }} - - - - - - {% for js in page.extraJS %} - - {% endfor %} - - - -\n -\n -\n