Skip to content

Instantly share code, notes, and snippets.

@chirino
Created April 20, 2010 12:13
Show Gist options
  • Save chirino/372355 to your computer and use it in GitHub Desktop.
Save chirino/372355 to your computer and use it in GitHub Desktop.
object transformer extends Transformer {
$(".people") { node =>
val even = $(".person even").remove
val odd = $(".person odd").remove
val person_transform = new Transformer {
$(".name").contents = p.name
$(".location").contents = p.location
}
node.content_append {
var c=0
people.flatMap { p =>
c += 1
person_transform.apply(
if ( (c%2)==0 ) even else odd
)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment