Created
May 19, 2011 09:29
-
-
Save irumiha/980475 to your computer and use it in GitHub Desktop.
Possible scalate/scuery bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.fusesource.scalate.scuery._ | |
object isitabug { | |
val testinput = | |
<html> | |
<head></head> | |
<body> | |
<div class="test"> | |
<div class="real"> | |
<a href="" class="detail"> | |
<img class="bug" src="/somewhere/image.jpg" /> | |
</a> | |
</div> | |
</div> | |
</body> | |
</html> | |
def main(args: Array[String]) { | |
val imgs = List("a","b","c") | |
object bugfinder extends Transformer { | |
$("div.test"){ node => | |
imgs.flatMap {i => | |
new Transform(node) { | |
$("a.detail").attribute("href","/some/link/") | |
$("img").attribute("class","someotherclas") | |
} | |
} | |
} | |
} | |
println(bugfinder(testinput)) | |
// expected output should contain <img> elements with class="someotherclass" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment