Skip to content

Commit 5192eac

Browse files
authored
Merge pull request #2518 from dotty-staging/topic/dottydoc-scaladays-2k17-3
[scaladays] dottydoc fixups 3
2 parents f3b462a + 7dca432 commit 5192eac

File tree

11 files changed

+84
-29
lines changed

11 files changed

+84
-29
lines changed

doc-tool/resources/_includes/toolbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% include "scala-logo.svg" %}
44
</a>
55
<div id="project-details">
6-
<h1 id="project-name">{{ site.project }} Documentation</h1>
6+
<h1 id="project-name"><a href="{{ site.baseurl }}/docs/">{{ site.project }} Documentation</a></h1>
77
<h2 id="project-version">{{ site.version }}</h2>
88
</div>
99

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
{% include "sidebar" %}
1414

1515
<div id="content-body" class="doc-page-body">
16+
<a id="edit-on-github" href="{{ site.projectUrl }}/edit/master/{{ site.root }}/{{ page.url }}">
17+
Edit this page on GitHub
18+
</a>
1619
<h1 id="doc-page-title">{{ page.title }}</h1>
1720
<hr/>
1821
<div id="doc-page-container">

doc-tool/resources/_layouts/search.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,18 @@ <h1>Member Results</h1>
147147
var paramLists = !member.paramLists ? "" : (
148148
member.paramLists
149149
.map(renderParamList)
150-
.reduce(concatenateStrings, "")
150+
.reduce(concatenateStrings, "") + ': '
151+
);
152+
153+
var returnValue = !member.returnValue ? "" : (
154+
member.returnValue
151155
);
152156

153157
div.innerHTML =
154158
'<div class="member-kind">'+ member.kind +'</div>' +
155159
'<div class="member-name">'+ member.name +'</div>' +
156-
'<div class="member-param-lists">' + paramLists + ':</div>' +
157-
'<div class="member-return">'+ member.returnValue +'</div>'
160+
'<div class="member-param-lists">' + paramLists + '</div>' +
161+
'<div class="member-return">'+ returnValue +'</div>'
158162

159163
li.appendChild(div);
160164
};

doc-tool/resources/css/dottydoc.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700);
2+
@import url(https://fonts.googleapis.com/css?family=Titillium+Web:200,300,400,600);
23
@import url(https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700);
34

45
html, body {
@@ -34,6 +35,24 @@ div#content-wrapper div#content-body {
3435
transition: all .25s ease-out;
3536
}
3637

38+
div#content-body > a#edit-on-github {
39+
border-left: 1px solid #fff;
40+
position: absolute;
41+
top: 47px;
42+
padding-left: 10px;
43+
right: 250px;
44+
font-size: 14px;
45+
color: #373a3c;
46+
font-family: "Titillium Web", sans-serif;
47+
text-transform: uppercase;
48+
}
49+
50+
div#content-body > a#edit-on-github:hover,
51+
div#content-body > a#edit-on-github:focus {
52+
text-decoration: none;
53+
border-left: 1px solid #0fa00f;
54+
}
55+
3756
div#content-wrapper button#menu-toggle {
3857
background: rgba(244, 243, 244, 0.4) none;
3958
border: 1px solid transparent;

doc-tool/resources/css/search.css

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,27 @@ div.results li.entity-result-li:hover {
127127
}
128128

129129
div.results li.entity-result-li > div.member-result {
130+
overflow: hidden;
130131
padding-top: 3px;
131132
display: block;
132-
width: 100%;
133-
min-height: 30px;
133+
width: calc(100% - 105px);
134+
margin-bottom: 10px;
134135
transition: all 0.2s ease;
135136
margin-left: 105px;
136137
}
137138

139+
div.results li.entity-result-li:hover > div.member-result {
140+
width: calc(100% - 65px);
141+
}
142+
143+
div.results li.entity-result-li.with-companion:hover > div.member-result {
144+
width: calc(100% - 23px);
145+
}
146+
147+
div.results li.entity-result-li:not(.with-companion) > div.member-result {
148+
margin-left: 65px;
149+
}
150+
138151
div.results li.entity-result-li:hover > div.member-result {
139152
margin-left: 23px;
140153
}
@@ -144,8 +157,11 @@ div.results li.entity-result-li > div.member-result > div.member-kind {
144157
font-weight: 400;
145158
}
146159

160+
div.results li.entity-result-li > div.member-result > div.member-param-lists {
161+
margin-right: 5px;
162+
}
163+
147164
div.results li.entity-result-li > div.member-result > div.member-return {
148-
margin-left: 5px;
149165
font-weight: 400;
150166
white-space: nowrap;
151167
}

doc-tool/resources/css/toolbar.css

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,31 @@ div#toolbar > div#project-details:before {
4848
}
4949

5050
div#toolbar > div#project-details > h1#project-name {
51-
font-size: 20px;
52-
font-weight: 300;
53-
margin-bottom: 3px;
51+
font-size: 20px;
52+
font-weight: 300;
53+
margin-bottom: 3px;
54+
}
55+
56+
div#toolbar > div#project-details > h1#project-name > a {
57+
color: #fff;
58+
}
59+
60+
div#toolbar > div#project-details > h1#project-name > a:hover,
61+
div#toolbar > div#project-details > h1#project-name > a:focus {
62+
text-decoration: none;
63+
color: rgba(255, 255, 255, 0.8);
5464
}
5565

5666
div#toolbar > div#project-details > h2#project-version {
57-
font-size: 12px;
58-
font-weight: 200;
59-
margin-left: 1px;
67+
font-size: 12px;
68+
font-weight: 200;
69+
margin-left: 1px;
6070
}
6171

6272
div#toolbar > a#github-link {
63-
color: #fff;
64-
position: absolute;
65-
top: 7px;
66-
right: 15px;
67-
font-size: 40px;
73+
color: #fff;
74+
position: absolute;
75+
top: 7px;
76+
right: 15px;
77+
font-size: 40px;
6878
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object references {
5151
if (args.isEmpty)
5252
"() => " + ret.showReference
5353
else if (args.tail.isEmpty)
54-
args.head + " => " + ret.showReference
54+
args.head.showReference + " => " + ret.showReference
5555
else
5656
args.mkString("(", ",", s") => ${ret.showReference}")
5757

doc-tool/src/dotty/tools/dottydoc/staticsite/DefaultParams.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ case class DefaultParams(
3939
"posts" -> site.posts.map(_.toMap),
4040
"project" -> site.projectTitle,
4141
"version" -> site.projectVersion,
42-
"projectUrl" -> site.projectUrl
42+
"projectUrl" -> site.projectUrl,
43+
"root" -> site.root
4344
).asJava,
4445

4546
"sidebar" -> sidebar.titles.asJava
@@ -55,7 +56,7 @@ case class DefaultParams(
5556

5657
def withPosts(posts: Array[BlogPost]): DefaultParams =
5758
copy(site = SiteInfo(
58-
site.baseurl, site.projectTitle, site.projectVersion, site.projectUrl, posts))
59+
site.baseurl, site.projectTitle, site.projectVersion, site.projectUrl, posts, site.root))
5960

6061
def withUrl(url: String): DefaultParams =
6162
copy(page = PageInfo(url))
@@ -74,7 +75,8 @@ case class SiteInfo(
7475
projectTitle: String,
7576
projectVersion: String,
7677
projectUrl: String,
77-
posts: Array[BlogPost]
78+
posts: Array[BlogPost],
79+
root: String
7880
)
7981

8082
case class Sidebar(titles: List[Title])

doc-tool/src/dotty/tools/dottydoc/staticsite/Site.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ case class Site(
172172

173173
DefaultParams(
174174
docs, docsFlattened, documentation, PageInfo(pathFromRoot),
175-
SiteInfo(baseUrl, projectTitle, projectVersion, projectUrl, Array()),
175+
SiteInfo(
176+
baseUrl, projectTitle, projectVersion, projectUrl, Array(),
177+
root.toString
178+
),
176179
sidebar
177180
)
178181
}
@@ -290,7 +293,7 @@ case class Site(
290293
* // given that root is: /some/root
291294
* ```
292295
*/
293-
def stripRoot(f: JFile): String = {
296+
def stripRoot(f: JFile, root: JFile = root): String = {
294297
val rootLen = root.getAbsolutePath.length + 1
295298
f.getAbsolutePath.drop(rootLen)
296299
}

doc-tool/test/dotty/tools/dottydoc/staticsite/SiteTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class SiteTests extends DottyDocTest with SourceFileOps {
7878
}
7979

8080
@Test def siteStructure = {
81-
val assets = site.staticAssets.map(site.stripRoot).toSet
82-
val compd = site.compilableFiles.map(site.stripRoot).toSet
81+
val assets = site.staticAssets.map(site.stripRoot(_)).toSet
82+
val compd = site.compilableFiles.map(site.stripRoot(_)).toSet
8383

8484
val expectedAssets = Set(
8585
"css/toolbar.css",

docs/sidebar.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
sidebar:
22
- title: Blog
33
url: blog/index.html
4-
- title: Docs
5-
url: docs/index.html
64
- title: Usage
75
subsection:
86
- title: cbt-projects
@@ -54,4 +52,4 @@ sidebar:
5452
- title: Resources
5553
subsection:
5654
- title: Talks
57-
url: docs/resources/talks.html
55+
url: docs/resources/talks.html

0 commit comments

Comments
 (0)