summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-11-01 14:24:55 -0700
committerLi Haoyi <haoyi@dropbox.com>2014-11-01 14:24:55 -0700
commit00746e5c8d1d731d0a0cb581f3bddadde31d0d31 (patch)
tree3303ec78cbf6185aed70cafb0215aeb1e6b2ed07
parent049b56816ab82e66f637e3f9e7fd0f356b96983d (diff)
downloadhands-on-scala-js-00746e5c8d1d731d0a0cb581f3bddadde31d0d31.tar.gz
hands-on-scala-js-00746e5c8d1d731d0a0cb581f3bddadde31d0d31.tar.bz2
hands-on-scala-js-00746e5c8d1d731d0a0cb581f3bddadde31d0d31.zip
Things compile for now, error messages seem pretty good...
-rw-r--r--book/src/main/scalatex/book/CanvasApp.scalatex2
-rw-r--r--scalatexApi/src/main/scala/scalatex/stages/Compiler.scala21
-rw-r--r--scalatexApi/src/main/scala/scalatex/stages/IndentHandler.scala2
-rw-r--r--scalatexApi/src/test/scala/scalatex/BasicTests.scala2
4 files changed, 11 insertions, 16 deletions
diff --git a/book/src/main/scalatex/book/CanvasApp.scalatex b/book/src/main/scalatex/book/CanvasApp.scalatex
index bdfa51a..2e05682 100644
--- a/book/src/main/scalatex/book/CanvasApp.scalatex
+++ b/book/src/main/scalatex/book/CanvasApp.scalatex
@@ -43,7 +43,7 @@
@p
In general, you have access to all the DOM APIs through the @hl.scala{dom} package as well as through Javascript objects such as the @hl.scala{dom.HTMLCanvasElement}. Setting the @code{onmouseXXX} callbacks is just one way of interacting with the DOM. With Scala.js, you also get a very handy autocomplete in the editor, which you can use to browse the various other APIs that are available for use:
- @img(src:="images/Dropdown.png", maxWidth:="100%")
+ @img(src:="images/Dropdown.png", maxWidth:="100%")
@p
Apart from mouse events, keyboard events, scroll events, input events, etc. are all usable from Scala.js as you'd expect
diff --git a/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala b/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala
index 84c1c09..5fdf998 100644
--- a/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala
+++ b/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala
@@ -15,32 +15,27 @@ object Compiler{
import c.universe._
def fragType = tq"scalatags.Text.all.Frag"
- def posFor(offset: Int) = {
- new OffsetPosition(
- literalPos.source,
- math.min(offset, literalPos.source.length - 1)
- ).asInstanceOf[c.universe.Position]
- }
+
def compileTree(frag: WN.TemplateTree): Tree = {
// println(frag)
object fragPos{
+ def posFor(offset: Int) = {
+ new OffsetPosition(
+ literalPos.source,
+ math.min(offset, literalPos.source.length - 1)
+ ).asInstanceOf[c.universe.Position]
+ }
private val fragPos = posFor(literalPos.point + frag.offset)
private def fragPosFor(offset: Int) = {
- val res = posFor(fragPos.point + offset)
- println(res.lineContent)
- res
+ posFor(fragPos.point + offset)
}
def at(t: Tree, offset: Int) = {
- println(t)
val res = atPos(fragPosFor(offset))(t)
- println("-")
res
}
def set(t: Tree, offset: Int) = {
- println(t)
c.internal.setPos(t, fragPosFor(offset))
- println("+")
t
}
}
diff --git a/scalatexApi/src/main/scala/scalatex/stages/IndentHandler.scala b/scalatexApi/src/main/scala/scalatex/stages/IndentHandler.scala
index 697ccc3..a39b498 100644
--- a/scalatexApi/src/main/scala/scalatex/stages/IndentHandler.scala
+++ b/scalatexApi/src/main/scala/scalatex/stages/IndentHandler.scala
@@ -88,7 +88,7 @@ object IndentHandler extends (String => String){
val newFirst =
if (!before.startsWith("@else")) before
else before.dropRight("@else".length)+ "} else"
- println(before, after, delta)
+// println(before, after, delta)
if (delta > 0 && noBraceLine(after)) newFirst + "{" + after
else if (delta <= 0 && noBraceLine(after) && after.trim != "") newFirst + "{" + after + "}" * (1 - elseCorrection)
else current
diff --git a/scalatexApi/src/test/scala/scalatex/BasicTests.scala b/scalatexApi/src/test/scala/scalatex/BasicTests.scala
index f432e51..617841e 100644
--- a/scalatexApi/src/test/scala/scalatex/BasicTests.scala
+++ b/scalatexApi/src/test/scala/scalatex/BasicTests.scala
@@ -230,7 +230,7 @@ object BasicTests extends TestSuite{
@x
}
"""),
- Internals.twDebug("""
+ tw("""
@ul
@things.map x =>
@li