Demo entry 6783569

Groovy script

   

Submitted by anonymous on Feb 16, 2019 at 15:34
Language: Groovy. Code size: 772 Bytes.

final map = { name, value, description ->
  tr {
    td(name) newLine()
    td {
      yield(value != null ? value : "-")
    }
    td {
      yield description
    }
  }
}

yieldUnescaped '<!DOCTYPE html>' newLine()
html(lang:'en') {
  head {
    meta(charset:"utf-8") newLine()
    meta(name:"viewport", content:"width=device-width, initial-scale=1.0") newLine()

    title("My site")
  }
  newLine()

  body {
    h1("Post template")

    table {
      tr {
        th("Property") newLine()
        th("Value") newLine()
        th("Description") newLine()
      }
      row('foo', foo, 'Some property')
      row('bar', bar, 'Another property')
      tags.each { final tag ->
        row('Tag', tag, 'A tag')
      }
    }
  }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).