title: How can I toggle a table column using mustache?
body: <p>Suppose I have an order listing. The order is made up of order-items and
  items may have a specified material or not. The order is rendered as a
  table and the column for material should only be shown if (at least) one
  of the items has it. In other words, an empty "material" column should
  not be shown.</p>
  
  <p>Here is an example template:</p>
  
  <p>(pardon my HTML. I didn't go looking that up.)</p>
  
  <pre><code>&lt;table&gt;
    &lt;th&gt;name&lt;/th&gt;
    &lt;th&gt;quantity&lt;/th&gt;
    &lt;th&gt;made of&lt;/th&gt;
    {{#items}}
      &lt;tr&gt;
        &lt;td&gt;{{name}}&lt;/td&gt;
        &lt;td&gt;{{qty}}&lt;/td&gt;
        &lt;td&gt;{{material}}&lt;/td&gt;
      &lt;/tr&gt;
    {{/items}}
  &lt;/table&gt;
  </code></pre>
  
  <p>Suppose Wile E. Coyote is trying to catch Road Runner and orders some TNT and
  rope:</p>
  
  <pre><code>{
    "customer" : "Wile E. Coyote",
    "items" :
    [
      { "name" : "TNT", "qty" : 2 },
      { "name" : "rope", "qty" : 10, "material" : "nylon" }
    ]
  }
  </code></pre>
  
  <p>The output is as follows:</p>
  
  <pre><code>&lt;table&gt;
    &lt;th&gt;name&lt;/th&gt;
    &lt;th&gt;quantity&lt;/th&gt;
    &lt;th&gt;made of&lt;/th&gt;
    &lt;tr&gt;
      &lt;td&gt;TNT&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;rope&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;nylon&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>But if he orders an anvil instead of a rope:</p>
  
  <pre><code>{
    "customer" : "Wile E. Coyote",
    "items" :
    [
      { "name" : "TNT", "qty" : 2 },
      { "name" : "anvil", "qty" : 1 }
    ]
  }
  </code></pre>
  
  <p>an ugly empty "made of" column will be rendered:</p>
  
  <pre><code>&lt;table&gt;
    &lt;th&gt;name&lt;/th&gt;
    &lt;th&gt;quantity&lt;/th&gt;
    &lt;th&gt;material&lt;/th&gt;
    &lt;tr&gt;
      &lt;td&gt;TNT&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;anvil&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>How can I modify my template to get this instead?</p>
  
  <pre><code>&lt;table&gt;
    &lt;th&gt;name&lt;/th&gt;
    &lt;th&gt;quantity&lt;/th&gt;
    &lt;tr&gt;
      &lt;td&gt;TNT&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;anvil&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I also control the JSON and can modify that too. But I would prefer
  not to.</p>