Skip to content

Migrate remaning commigs from scala3doc repo #10148

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 19 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from 16 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
8 changes: 6 additions & 2 deletions scala3doc-testcases/src/tests/tests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ package tests
*
* And yet another: [[example.level2.Documentation]].
*
* This is my friend: [[tests\.B\]]].
* This is my friend: [[tests.B]].
*
* And this is his companion: [[tests.B$ link to the companion]].
*
* And this is a link that failed to resolve [[absent]].
*
* And this is a link that failed to parse [[#]].
*
* @author Gal Anonim
* @version 1.0.0
* @result A class doesn't actually have a result.
Expand Down Expand Up @@ -172,7 +176,7 @@ class Methods:
*
* Even though this line should be separated from previous one.
*
* @throws scala.Error Throws errors.
* @throws java.lang.Error Throws errors.
* @example
* ```
* (m : Methods).generic2(d(), e()): B
Expand Down
27 changes: 21 additions & 6 deletions scala3doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ We're aiming to support all the features Scaladoc did, plus new and exciting one
- displaying project and API documentation together on one site!
- and more!

**Yes, this page was generated using scala3doc**

## Running the project

Use the following commands to generate documentation for this project and for Dotty, respectively:
Expand All @@ -29,13 +31,26 @@ cd output
python3 -m http.server 8080
```

And afterwards point your browser to `http://localhost:8080/self` or
`http://localhost:8080/stdLib` for this project and for Dotty documentation
And afterwards point your browser to <http://localhost:8080/self> or
<http://localhost:8080/stdLib> for this project and for Dotty documentation
respectively.

It's not strictly necessary to go through an HTTP server, but because of CORS
the documentation won't work completely if you don't.

## CLI Documentation

CLI command for running our tool is in form: `sbt main -n <name> -o <output> -t <tasty-files> -cp <classpath> -s { <sources> } -d <documentation> ` where:
- `<name>`: name of module in generated documentation
- `<output>`: location where documentation should be created
- `<tasty-files>`: is list of dirs or jars that contains tasty files that should be documented
- `<classpath>`: classpath that was used to generate tasty files
- `<sources>`: links to source files of module that are used to link symbols on pages to their source file. They need to be supplied in form:
`local_dir=remote_dir#line_suffix` e.g. `src/main/scala=https://github.com/lampepfl/scala3doc/tree/master/src/main/scala#L`
- `<documentation>`: directory of static documentation that you would like to render with API documentation. This feature is provided by dokka-site plugin:
- [GitHub](https://github.com/VirtusLab/dokka-site)
- [Documentation](https://virtuslab.github.io/dokka-site/index.html)

## Developing

At least two of our contributors use [Metals](https://scalameta.org/metals/) to
Expand All @@ -44,16 +59,16 @@ work on the project.
For every PR, we build documentation for Scala3doc and Dotty. For example, for
PR 123 you can find them at:

+ https://scala3doc.s3.eu-central-1.amazonaws.com/pr-123/self/main/index.html
+ https://scala3doc.s3.eu-central-1.amazonaws.com/pr-123/stdLib/main/index.html
+ <https://scala3doc.s3.eu-central-1.amazonaws.com/pr-123/self/main/index.html>
+ <https://scala3doc.s3.eu-central-1.amazonaws.com/pr-123/stdLib/main/index.html>

Note that these correspond to the contents of `output` directory - that's
precisely what they are.

You can also find the result of building the same sites for latest `master` at:

+ https://scala3doc.s3.eu-central-1.amazonaws.com/pr-master/self/main/index.html
+ https://scala3doc.s3.eu-central-1.amazonaws.com/pr-master/stdLib/main/index.html
+ <https://scala3doc.s3.eu-central-1.amazonaws.com/pr-master/self/main/index.html>
+ <https://scala3doc.s3.eu-central-1.amazonaws.com/pr-master/stdLib/main/index.html>

### Testing

Expand Down
27 changes: 0 additions & 27 deletions scala3doc/documentation/index.md

This file was deleted.

1 change: 1 addition & 0 deletions scala3doc/documentation/index.md
21 changes: 13 additions & 8 deletions scala3doc/resources/dotty_res/scripts/diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ $("#inheritance-diagram").ready(function() {

// Set up zoom support
var zoom = d3.zoom()
.on("zoom", function({transform}) {
inner.attr("transform", transform);
});
.on("zoom", function({transform}) {
inner.attr("transform", transform);
});
svg.call(zoom);

var render = new dagreD3.render();
var g = graphlibDot.read(dotNode.text);
g.graph().rankDir = 'BT';
g.nodes().forEach(function (v) {
g.setNode(v, {
labelType: "html",
label: g.node(v).label,
style: g.node(v).style
});
g.setNode(v, {
labelType: "html",
label: g.node(v).label,
style: g.node(v).style
});
});
g.edges().forEach(function(v) {
g.setEdge(v, {
arrowhead: "vee"
});
});
render(inner, g);
}
Expand Down
12 changes: 9 additions & 3 deletions scala3doc/resources/dotty_res/scripts/ux.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
window.addEventListener("DOMContentLoaded", () => {
var e = document.getElementById("leftToggler");
if (e) {
e.onclick = function () {
var toggler = document.getElementById("leftToggler");
if (toggler) {
toggler.onclick = function () {
document.getElementById("leftColumn").classList.toggle("open");
};
}
var logo = document.getElementById("logo");
if (logo) {
logo.onclick = function() {
window.location = pathToRoot; // global variable pathToRoot is created by the html renderer
};
}
hljs.registerLanguage("scala", highlightDotty);
hljs.registerAliases(["dotty", "scala3"], "scala");
hljs.initHighlighting();
Expand Down
27 changes: 18 additions & 9 deletions scala3doc/resources/dotty_res/styles/diagram.css
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
.node {
stroke: #333;
stroke-width: 2.5px;
fill: white;
stroke: #333;
stroke-width: 2.5px;
fill: white;
}

.edgeLabel {
fill: white;
fill: white;
}

.edgePath {
stroke: #333;
stroke-width: 1.5px;
fill: none;
stroke: #333;
stroke-width: 1.5px;
fill: #333;
}

#graph {
width: 100%;
height: 80%;
width: 100%;
height: 80%;
}

.diagram-class a {
text-decoration: underline;
color: #FFF;
}

.diagram-class span[data-unresolved-link] {
color: #FFF;
}
Loading