Skip to content

Commit db28ab4

Browse files
author
Li Haoyi
committed
scalatex 0.1.6
1 parent 38f7f63 commit db28ab4

File tree

4 files changed

+20
-78
lines changed

4 files changed

+20
-78
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ lazy val readme = project
6060
.settings(scalatex.SbtPlugin.projectSettings:_*)
6161
.settings(
6262
scalaVersion := "2.11.4",
63-
libraryDependencies += "com.lihaoyi" %% "scalatex-site" % "0.1.5",
63+
libraryDependencies += "com.lihaoyi" %% "scalatex-site" % "0.1.6",
6464
libraryDependencies += "com.lihaoyi" %% "upickle" % "0.2.7",
6565
(resources in Compile) += (fullOptJS in (example, Compile)).value.data
6666
)

project/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.0")
22

3-
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.1.5")
3+
addSbtPlugin("com.lihaoyi" % "scalatex-sbt-plugin" % "0.1.6")
Lines changed: 8 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,10 @@
11
package readme
22

3-
import java.nio.file.{Paths, Files}
4-
5-
import scalatags.Text.all._
6-
import ammonite.ops._
7-
object Main{
8-
def main(args: Array[String]): Unit = {
9-
val ghLink = a(
10-
href:="https://github.com/scala-js/scala-js-dom",
11-
position.absolute,
12-
top:=0,right:=0,border:=0,
13-
img(
14-
src:="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67",
15-
alt:="Fork me on GitHub"
16-
)
17-
)
18-
new scalatex.site.Site{
19-
def content = Map("index.html" -> Index())
20-
override def autoResources = super.autoResources ++ Seq(
21-
root/"example-opt.js",
22-
root/'scalatex/'scrollspy/"scrollspy.js"
23-
)
24-
25-
override def bodyFrag(frag: Frag) = {
26-
Seq(
27-
ghLink,
28-
div(
29-
position.fixed,
30-
overflow.scroll,
31-
backgroundColor := "#191818",
32-
height := "100%",
33-
width := 250,
34-
left := 0,
35-
top := 0,
36-
a(href:="#menu", id:="menu-link", cls:="menu-link")(
37-
span
38-
),
39-
div(id:="menu")
40-
),
41-
div(
42-
marginLeft := 250,
43-
super.bodyFrag(frag)
44-
),
45-
script(raw(s"""
46-
scalatex.scrollspy.Controller().main(
47-
${upickle.write(sect.structure.children(0))},
48-
document.getElementById("menu"),
49-
document.getElementById("menu-link")
50-
)"""))
51-
)
52-
}
53-
override def generateHtml(outputRoot: Path) = {
54-
for((path, frag) <- content){
55-
val txt = html(
56-
head(headFrags),
57-
bodyFrag(frag)
58-
).render
59-
write.over(
60-
outputRoot/path,
61-
("<!DOCTYPE html>" + txt).getBytes
62-
)
63-
}
64-
65-
}
66-
}.renderTo(cwd/'readme/'target/'output)
67-
}
68-
}
69-
object sect extends scalatex.site.Section()
70-
object hl extends scalatex.site.Highlighter{
71-
def scala(s: String) = this.highlight(s, "scala")
72-
def suffixMappings = Map(
73-
"scala" -> "scala"
74-
)
75-
override def pathMappings = Seq(
76-
root -> "https://github.com/scala-js/scala-js-dom/tree/master"
77-
)
78-
}
3+
import scalatex.site
4+
5+
object Main extends site.Main(
6+
"https://github.com/scala-js/scala-js-dom/tree/master",
7+
ammonite.ops.cwd,
8+
ammonite.ops.cwd/'target/'site,
9+
readme.Index()
10+
)

readme/src/main/scalatex/readme/Index.scalatex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
@import ammonite.ops._
2+
@import Main._
3+
@a(
4+
href:="https://github.com/scala-js/scala-js-dom",
5+
position.absolute,
6+
top:=0,right:=0,border:=0,
7+
img(
8+
src:="https://camo.githubusercontent.com/a6677b08c955af8400f44c6298f40e7d19cc5b2d/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677261795f3664366436642e706e67",
9+
alt:="Fork me on GitHub"
10+
)
11+
)
212
@def pair(example: String,
313
frags: Seq[scalatags.Text.TypedTag[String]],
414
autorun: Boolean = false) = {

0 commit comments

Comments
 (0)