Skip to content

[scaladays] dottydoc fixups 3 #2518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc-tool/resources/_includes/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% include "scala-logo.svg" %}
</a>
<div id="project-details">
<h1 id="project-name">{{ site.project }} Documentation</h1>
<h1 id="project-name"><a href="{{ site.baseurl }}/docs/">{{ site.project }} Documentation</a></h1>
<h2 id="project-version">{{ site.version }}</h2>
</div>

Expand Down
3 changes: 3 additions & 0 deletions doc-tool/resources/_layouts/doc-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
{% include "sidebar" %}

<div id="content-body" class="doc-page-body">
<a id="edit-on-github" href="{{ site.projectUrl }}/edit/master/{{ site.root }}/{{ page.url }}">
Edit this page on GitHub
</a>
<h1 id="doc-page-title">{{ page.title }}</h1>
<hr/>
<div id="doc-page-container">
Expand Down
10 changes: 7 additions & 3 deletions doc-tool/resources/_layouts/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,18 @@ <h1>Member Results</h1>
var paramLists = !member.paramLists ? "" : (
member.paramLists
.map(renderParamList)
.reduce(concatenateStrings, "")
.reduce(concatenateStrings, "") + ': '
);

var returnValue = !member.returnValue ? "" : (
member.returnValue
);

div.innerHTML =
'<div class="member-kind">'+ member.kind +'</div>' +
'<div class="member-name">'+ member.name +'</div>' +
'<div class="member-param-lists">' + paramLists + ':</div>' +
'<div class="member-return">'+ member.returnValue +'</div>'
'<div class="member-param-lists">' + paramLists + '</div>' +
'<div class="member-return">'+ returnValue +'</div>'

li.appendChild(div);
};
Expand Down
19 changes: 19 additions & 0 deletions doc-tool/resources/css/dottydoc.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700);
@import url(https://fonts.googleapis.com/css?family=Titillium+Web:200,300,400,600);
@import url(https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700);

html, body {
Expand Down Expand Up @@ -34,6 +35,24 @@ div#content-wrapper div#content-body {
transition: all .25s ease-out;
}

div#content-body > a#edit-on-github {
border-left: 1px solid #fff;
position: absolute;
top: 47px;
padding-left: 10px;
right: 250px;
font-size: 14px;
color: #373a3c;
font-family: "Titillium Web", sans-serif;
text-transform: uppercase;
}

div#content-body > a#edit-on-github:hover,
div#content-body > a#edit-on-github:focus {
text-decoration: none;
border-left: 1px solid #0fa00f;
}

div#content-wrapper button#menu-toggle {
background: rgba(244, 243, 244, 0.4) none;
border: 1px solid transparent;
Expand Down
22 changes: 19 additions & 3 deletions doc-tool/resources/css/search.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,27 @@ div.results li.entity-result-li:hover {
}

div.results li.entity-result-li > div.member-result {
overflow: hidden;
padding-top: 3px;
display: block;
width: 100%;
min-height: 30px;
width: calc(100% - 105px);
margin-bottom: 10px;
transition: all 0.2s ease;
margin-left: 105px;
}

div.results li.entity-result-li:hover > div.member-result {
width: calc(100% - 65px);
}

div.results li.entity-result-li.with-companion:hover > div.member-result {
width: calc(100% - 23px);
}

div.results li.entity-result-li:not(.with-companion) > div.member-result {
margin-left: 65px;
}

div.results li.entity-result-li:hover > div.member-result {
margin-left: 23px;
}
Expand All @@ -144,8 +157,11 @@ div.results li.entity-result-li > div.member-result > div.member-kind {
font-weight: 400;
}

div.results li.entity-result-li > div.member-result > div.member-param-lists {
margin-right: 5px;
}

div.results li.entity-result-li > div.member-result > div.member-return {
margin-left: 5px;
font-weight: 400;
white-space: nowrap;
}
Expand Down
32 changes: 21 additions & 11 deletions doc-tool/resources/css/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,31 @@ div#toolbar > div#project-details:before {
}

div#toolbar > div#project-details > h1#project-name {
font-size: 20px;
font-weight: 300;
margin-bottom: 3px;
font-size: 20px;
font-weight: 300;
margin-bottom: 3px;
}

div#toolbar > div#project-details > h1#project-name > a {
color: #fff;
}

div#toolbar > div#project-details > h1#project-name > a:hover,
div#toolbar > div#project-details > h1#project-name > a:focus {
text-decoration: none;
color: rgba(255, 255, 255, 0.8);
}

div#toolbar > div#project-details > h2#project-version {
font-size: 12px;
font-weight: 200;
margin-left: 1px;
font-size: 12px;
font-weight: 200;
margin-left: 1px;
}

div#toolbar > a#github-link {
color: #fff;
position: absolute;
top: 7px;
right: 15px;
font-size: 40px;
color: #fff;
position: absolute;
top: 7px;
right: 15px;
font-size: 40px;
}
2 changes: 1 addition & 1 deletion doc-tool/src/dotty/tools/dottydoc/model/references.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ object references {
if (args.isEmpty)
"() => " + ret.showReference
else if (args.tail.isEmpty)
args.head + " => " + ret.showReference
args.head.showReference + " => " + ret.showReference
else
args.mkString("(", ",", s") => ${ret.showReference}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ case class DefaultParams(
"posts" -> site.posts.map(_.toMap),
"project" -> site.projectTitle,
"version" -> site.projectVersion,
"projectUrl" -> site.projectUrl
"projectUrl" -> site.projectUrl,
"root" -> site.root
).asJava,

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

def withPosts(posts: Array[BlogPost]): DefaultParams =
copy(site = SiteInfo(
site.baseurl, site.projectTitle, site.projectVersion, site.projectUrl, posts))
site.baseurl, site.projectTitle, site.projectVersion, site.projectUrl, posts, site.root))

def withUrl(url: String): DefaultParams =
copy(page = PageInfo(url))
Expand All @@ -74,7 +75,8 @@ case class SiteInfo(
projectTitle: String,
projectVersion: String,
projectUrl: String,
posts: Array[BlogPost]
posts: Array[BlogPost],
root: String
)

case class Sidebar(titles: List[Title])
Expand Down
7 changes: 5 additions & 2 deletions doc-tool/src/dotty/tools/dottydoc/staticsite/Site.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ case class Site(

DefaultParams(
docs, docsFlattened, documentation, PageInfo(pathFromRoot),
SiteInfo(baseUrl, projectTitle, projectVersion, projectUrl, Array()),
SiteInfo(
baseUrl, projectTitle, projectVersion, projectUrl, Array(),
root.toString
),
sidebar
)
}
Expand Down Expand Up @@ -290,7 +293,7 @@ case class Site(
* // given that root is: /some/root
* ```
*/
def stripRoot(f: JFile): String = {
def stripRoot(f: JFile, root: JFile = root): String = {
val rootLen = root.getAbsolutePath.length + 1
f.getAbsolutePath.drop(rootLen)
}
Expand Down
4 changes: 2 additions & 2 deletions doc-tool/test/dotty/tools/dottydoc/staticsite/SiteTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ class SiteTests extends DottyDocTest with SourceFileOps {
}

@Test def siteStructure = {
val assets = site.staticAssets.map(site.stripRoot).toSet
val compd = site.compilableFiles.map(site.stripRoot).toSet
val assets = site.staticAssets.map(site.stripRoot(_)).toSet
val compd = site.compilableFiles.map(site.stripRoot(_)).toSet

val expectedAssets = Set(
"css/toolbar.css",
Expand Down
4 changes: 1 addition & 3 deletions docs/sidebar.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
sidebar:
- title: Blog
url: blog/index.html
- title: Docs
url: docs/index.html
- title: Usage
subsection:
- title: cbt-projects
Expand Down Expand Up @@ -54,4 +52,4 @@ sidebar:
- title: Resources
subsection:
- title: Talks
url: docs/resources/talks.html
url: docs/resources/talks.html