-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add dottydoc #1453
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
Add dottydoc #1453
Conversation
This is an impressive contribution. Congratulations! There have always been two things about scaladoc that I thought could be improved. I wonder if you could comment on whether they can be potentially addressed in dottydoc.
|
Thank you @xeno-by, much appreciated.
It is not something that has been taken into consideration thus far - but it is definitely something worth investing in further down the line. Furthermore, I do believe it is possible to preserve the index and mutate it between runs - the API could be made to handle this in some convenient way that works well with the build tools.
My first reaction is that this could/should be solved using TASTY - but I'm not currently 100% confident in what has been included in the spec (i.e - does TASTY serialize comments attached to their corresponding entity?). An other alternative would perhaps be to define some form of lookup using the scaladex - but perhaps the tools are better kept separate. |
The problem is changes are not local but ripple out -- e.g. adding a new class means its superclasses get another subclass listed on their pages. |
It might be useful to think about this in terms of a compiler + linker. The compiler extracts information from a single .scala file into a corresponding output file (perhaps attributes in the .class file?). References to external data should be expressed symbolically. This could be resolved by a linker (that generates the entire site). The linker itself could be incremental in manner of ScalaJS's linker (ie: "I know that I need to rebuild this section of the page in all superclasses"). The "linker" might even be implemented as Javascript in the view itself. |
/rebuild |
This commit adds return values to defs and vals - but does not provide a link to these. This is to be continued
…serializing to json
To access `DocBase`: `ctx.docbase.docstring(...)`
…mplate for html docs
2ad1877
to
556c48e
Compare
* The tool can also generate JSON from the created index using "indexToJson" | ||
* or directly using "createJsonIndex" | ||
*/ | ||
trait Dottydoc extends DocDriver { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you have both Dottydoc.java
and Dottydoc.scala
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to have a Java interface for when the time comes that releases are compiled with dotty. As such, tools compiled with dotty should be able to use the Scala interface, while incompatible projects (such as sbt on 2.10) will still be able to use the Java interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, should this interface be part of dotty-interfaces
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with that as long as it's on the same classpath available to the bridge as dotty 😄
Let me know and I'll make it happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, let's keep it as is for now
556c48e
to
0b69be6
Compare
Any objection to merge this now? |
Dottydoc - GSoC
In all ways and means dottydoc is a compiler. It uses the dotty frontend phase to do parsing and typing - after this the documentation phases take over. Similarly to dotty, dottydoc uses fused phases as a way of transforming the documentation AST.
The new scaladoc alias dottydoc is comprised of two parts: a documentation hook and a front end hook.
There are still a few missing features to dottydoc - and this PR was opened now due to the GSoC project coming to an end as well as the limitations of the CI (100 commits - will it pass the tests!?).
The missing parts are currently AFAIK:
Scaladoc has a long history, and as such features may have been overlooked, the missing parts as listed will be implemented in the coming weeks together with any missing features reported and vital.
Architecture
Because dotty needs to bootstrap, we cannot have the client UI be part of the repository if we want to use external scala dependencies. This obstacle became an incentive to do something better - and the idea of third party templates was born. Currently dottydoc supports a specific frontend format which enables users to replace the frontend if they so choose (maybe they don't like the defaults, maybe they can do better - diversity is good).
To build your own frontend this is what you'll need:
The templating engine supported is currently mustache
The template will be given an instance of
Entity
for each top-level object (traits, objects, classes, packages). Entity has the following signature:The template is then used to create a collection of static HTML pages à la the old scaladoc. Each template is also given the path to
assets
(directory) andindex
(javascript file). As such it is quite easy to build your own template. Example:The
Index
object will look like this after the template has been written:There is of course already a default front end in place
dottydoc-client
. This one will be used by default by sbt. This project is available here: https://github.com/lampepfl/dottydoc-clientTo view the documentation rendered by the 100th commit in this PR: https://dl.dropboxusercontent.com/u/358427/gsoc-dottydoc/docs/scala/Option.html
There are parts in dottydoc that have been developed for the previous scaladoc and adapted to dottydoc most prominently by @odersky, @VladUreche @manojo - thank you for your hard work.
There is still a ton to do and I will make a small list here of things I plan to work on, and that I'd be happy to receive help on.
The great aftermath of the dottydoc PR
@usecase
@group