PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/scalate-wikitext/src/main/scala/org/fusesource/scalate/wikitext/ExpressionTag.scala

http://github.com/scalate/scalate
Scala | 18 lines | 12 code | 3 blank | 3 comment | 3 complexity | 294409f4b436d1bde985d154fde19f11 MD5 | raw file
 1package org.fusesource.scalate.wikitext
 2
 3/**
 4 * A confluence tag for a generic expression
 5 */
 6case class ExpressionTag(
 7  tag: String,
 8  fn: () => AnyRef) extends AbstractConfluenceTagSupport(tag) {
 9
10  def setOption(key: String, value: String) =
11    Blocks.unknownAttribute(key, value)
12
13  def doTag() = {
14    val result = fn()
15    val text = if (result == null) "" else result.toString
16    builder.characters(text)
17  }
18}