Skip to content

Commit 8963e5f

Browse files
authored
Merge pull request #10320 from romanowski/scala3doc/dotty-doc-parity
Add missing features to scala3doc to match dotty docs
2 parents 1ce60bc + 312517d commit 8963e5f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+343
-169
lines changed

project/Build.scala

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,10 +1455,11 @@ object Build {
14551455

14561456
def asScala3doc: Project = {
14571457
def generateDocumentation(targets: String, name: String, outDir: String, params: String = "") = Def.taskDyn {
1458-
val sourcesAndRevision = "-s github://lampepfl/dotty --revision master"
1458+
val projectVersion = version.value
1459+
val sourcesAndRevision = s"-s github://lampepfl/dotty --projectVersion $projectVersion"
14591460
run.in(Compile).toTask(
1460-
s""" -d output/$outDir -t $targets -n "$name" $sourcesAndRevision $params"""
1461-
)
1461+
s""" -d scala3doc/output/$outDir -t $targets -n "$name" $sourcesAndRevision $params"""
1462+
)
14621463
}
14631464

14641465
def joinProducts(products: Seq[java.io.File]): String =
@@ -1491,8 +1492,14 @@ object Build {
14911492
Compile / mainClass := Some("dotty.dokka.Main"),
14921493
// There is a bug in dokka that prevents parallel tests withing the same jvm
14931494
fork.in(test) := true,
1495+
baseDirectory.in(run) := baseDirectory.in(ThisBuild).value,
14941496
generateSelfDocumentation := Def.taskDyn {
1495-
generateDocumentation(classDirectory.in(Compile).value.getAbsolutePath, "scala3doc", "self", "-p documentation")
1497+
val revision = VersionUtil.gitHash
1498+
generateDocumentation(
1499+
classDirectory.in(Compile).value.getAbsolutePath,
1500+
"scala3doc", "self",
1501+
s"-p scala3doc/documentation --projectLogo scala3doc/documentation/logo.svg --revision $revision",
1502+
)
14961503
}.value,
14971504
generateScala3Documentation := Def.taskDyn {
14981505
val dottyJars: Seq[java.io.File] = Seq(
@@ -1506,10 +1513,10 @@ object Build {
15061513
val roots = joinProducts(dottyJars)
15071514

15081515
if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
1509-
else generateDocumentation(roots, "Scala 3", "scala3", "-p scala3-docs")
1516+
else generateDocumentation(roots, "Scala 3", "scala3", "-p scala3doc/scala3-docs --projectLogo scala3doc/scala3-docs/logo.svg --revision master")
15101517
}.value,
15111518
generateTestcasesDocumentation := Def.taskDyn {
1512-
generateDocumentation(Build.testcasesOutputDir.in(Test).value, "Scala3doc testcases", "testcases")
1519+
generateDocumentation(Build.testcasesOutputDir.in(Test).value, "Scala3doc testcases", "testcases", "--revision master")
15131520
}.value,
15141521
buildInfoKeys in Test := Seq[BuildInfoKey](
15151522
Build.testcasesOutputDir.in(Test),
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package tests.links
2+
3+
object AnObject:
4+
def method(a: Int): Int
5+
= 123 + a
6+
val field =
7+
123
8+
9+
/**
10+
* Broken link, that should result a warning not break compilation
11+
* [[tests.links.AnObject]]
12+
13+
*/
14+
class LinksTest:
15+
def verifyIfLinksTestIsGenerated(b: Int): Int
16+
= 123
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Design of scala3doc
2+
3+
**BEWARE this is not complete documentation yet but rather a draft mainly to test linking from static site to code**
4+
5+
## Interface
6+
7+
Scala3doc is intednted to be use with sbt as well as from commend line or from other buildtools. The main entry point to processing is [Main](dotty.dokka.Main$) class with [[dotty.dokka.Main$.main]].

scala3doc/documentation/logo.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

scala3doc/resources/dotty_res/styles/scalastyle.css

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,33 @@ th {
129129
#paneSearch {
130130
display: none;
131131
}
132-
#logo {
133-
background-size: contain;
134-
background-repeat: no-repeat;
135-
background-image: url(../images/dotty-logo-white.svg);
136-
background-origin: content-box;
137-
padding: 8px 0 8px 16px;
138-
height: 42px;
132+
#logo>span {
133+
display: inline-block;
134+
padding: 8px 8px 8px 8px;
135+
vertical-align: middle;
136+
}
137+
138+
#logo img {
139+
max-height: 54px;
140+
max-width: 54px;
139141
cursor: pointer;
140142
}
141-
#logo::after {
143+
144+
#logo .projectName {
142145
color: var(--leftbar-fg);
143-
font-size: 22px;
144-
content: "Scala3doc";
145-
margin-left: 42px;
146-
line-height: 42px;
146+
font-size: 28px;
147+
font-weight: bold;
147148
}
149+
150+
#logo .projectVersion {
151+
color: var(--leftbar-fg);
152+
font-size: 12px;
153+
}
154+
155+
.scala3doc_logo {
156+
width: 116px;
157+
}
158+
148159
.sideMenuPart {
149160
padding-left: 1em;
150161
}

scala3doc/resources/dotty_res/styles/search-bar.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.search-content {
33
padding: 0;
44
margin: var(--content-padding);
5-
position: absolute;
5+
position: fixed;
66
top: 0;
77
right: 0;
88
z-index: 5;

scala3doc/scala3-docs/_layouts/doc-page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<header>
66
<h1>{{ page.title }}</h1>
77
<div class="byline">
8-
<a href="{{ site.projectUrl }}/edit/master/{{ site.root }}/{{ page.url }}">
8+
<a href="{{ urls.editSource }}">
99
<i class="far fa-edit"></i>
1010
Edit this page on GitHub
1111
</a>

0 commit comments

Comments
 (0)