I think you'll need a container for that, unfortunately. You might be able to do something
dirty like this:
def snippetMethod(ns: NodeSeq): NodeSeq = {
var primaryTemplate: NodeSeq = _
var secondaryTemplate: NodeSeq = _
(".primary-row" #> { row: NodeSeq => primaryTemplate = row; NodeSeq.Empty } &
".secondary-row" #> { row: NodeSeq => secondaryTemplate = row; NodeSeq.Empty }).apply(ns)
"table *" #> musicStuff.map { ...
Seq(
(".primary-row" #> ...).apply(primaryTemplate),
(".secondary-row" #> ...).apply(secondaryTemplate)
)
}
}
Preeeeeeeetty gnarly. If you know the primary and secondary row are the only children
of, say, the table, you can also:
"table *" #> { ns: NodeSeq => ns match {
val rows = table.child
musicStuff.map { …
(".primary-row" #> ... &
".secondary-row" #> ...).apply(rows)
}
case other => other
} }
Little less annoying, significantly safer, still nasty. CSS selector transforms are pretty
specifically designed to deal with single elements at a time, unfortunately.
Thanks,
Antonio