Skip to content

Instantly share code, notes, and snippets.

@jstrachan
Created March 25, 2010 14:40
Show Gist options
  • Select an option

  • Save jstrachan/343619 to your computer and use it in GitHub Desktop.

Select an option

Save jstrachan/343619 to your computer and use it in GitHub Desktop.
def generate(fragments: List[PageFragment]):Unit = {
val (imports, others) = fragments.partition(isImportStatement)
imports.foreach{ generate(_) }
others.foreach{ generate(_) }
}
def isImportStatement(fragment: PageFragment) = fragment match {
case s: ScriptletFragment if (s.code.trim.startsWith("import ")) => true
case _ => false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment