forked from harrah/browse
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
48 lines (35 loc) · 2.08 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Browsable Scala source code in HTML with:
- syntax highlighting
- types/applied implicits in tooltips
- references/definition highlighted on mouseover
- links to definition
See http://harrah.github.com/browse/samples/index.html for samples.
Still in development. Bugs are features and features are accidental.
To build with sbt (see http://code.google.com/p/simple-build-tool/wiki/Setup for setup instructions):
$ sbt "+update" "+package"
This produces a compiler plugin in target/.
Usage
Add the following options to your compile command for your project:
-Xplugin:<path-to-sxr>/sxr-0.2.6.jar
-P:sxr:base-directory:<src-dir>
If you are using sbt, make your project definition extend AutoCompilerPlugins, add sxr as a plugin, and configure the plugin:
class YourProject(info: ProjectInfo) extends DefaultProject(info) with AutoCompilerPlugins
{
val sxr = compilerPlugin("org.scala-tools.sxr" %% "sxr" % "0.2.6")
override def compileOptions =
CompileOption("-P:sxr:base-directory:" + mainScalaSourcePath.absolutePath) ::
super.compileOptions.toList
}
You will get a directory <classes-output>.sxr that mirrors the directory structure of your sources relative
to the specified base directory with one HTML file for each source file. You can make simple
changes to the syntax highlighting in the style.css file in the root output directory. The linked.js
file implements the highlighting of refererences, among other things.
Other options include specifying the output format and linking to other sxr sources.
To link to other sxr sources (produced with sxr 0.2.5 or later), follow these two steps.
1) put the URLs of the other sxr sources in a file, say 'sxr.links'. The URLs should point to the base directories, not to 'index.html' or any specific file.
2) Specify the location of this file in the 'link-file' sxr option. For example:
override def compileOptions = super.compileOptions ++ sxrOptions
def sxrOptions =
compileOptions( "-P:sxr:base-directory:" + mainScalaSourcePath.absolutePath,
"-P:sxr:link-file:" + linkFile.absolutePath)
def linkFile = path("sxr.links")