<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>{{ r.name }}</title>
    <style>
    {{{ cssInfo.data }}}
    </style>
  </head>
  <body>
    <main>
      <header>
        <h1>{{{ r.name }}}</h1>
        <div id="contact">
          {{#if r.contact.email}}<div class="email"><a href="mailto:{{{ RAW.contact.email }}}">{{ RAW.contact.email }}</a></div>{{/if}}
          {{#if r.contact.phone}}<div class="phone">{{ RAW.contact.phone }}</div>{{/if}}
          {{#if r.contact.website}}<div class="website"><a href="{{{ RAW.contact.website }}}">{{trimURL RAW.contact.website }}</a></div>{{/if}}
        </div>
      </header>


{{#if r.info.brief}}
      <section id="summary">
        {{{ r.info.brief }}}
      </section>
{{/if}}


{{#if r.skills}}
      <section id="skills">
        <header>
        <h2><span class="fa fa-code"></span> Skills</h2><hr>
        </header>
        <table>
          <thead>
            <tr>
              <th>Skill</th>
              <th>Keywords</th>
            </tr>
          </thead>
          <tbody>
            {{#each r.skills.sets}}
            <tr>
              <td style="width: 25%;">{{ name }}</td>
              <td class="keywords">{{#each skills}}{{ this }} {{/each}}</td>
            </tr>
            {{/each}}
          </tbody>
        </table>
      </section>
{{/if}}



{{#if r.employment}}
      <section id="employment">
        <header>
        <h2><span class="fa fa-building" style="vertical-align: top;"></span> Employment</h2><hr>
        </header>

        {{#each r.employment.history}}
          {{#compare @index 4 operator="<"}}
            <h3><em>{{ position }}</em>,
              {{#if url }}
              <a href="{{ url }}">{{ employer }}</a>
              {{else}}
              {{ employer }}
              {{/if}}
              <span class="tenure">{{formatDate safe.start 'YYYY-MM' }} &mdash; {{formatDate safe.end 'YYYY-MM' }}<span></h3>
            <p style="clear: both;">{{{ summary }}}</p>
            {{#if highlights}}
              <ul>
              {{#each highlights}}
                <li>{{{ this }}}</li>
              {{/each}}
              </ul>
            {{/if}}
          {{/compare}}
          {{#compare @index 4 operator=">="}}

            {{#compare @index 4 operator="=="}}
            <h3>Previously...</h3>
            <p style="clear: both;">Prior to {{ employer }}, I worked on a range of projects for companies large and small.</p>
            <ul>
            {{/compare}}

            <li>{{{ position }}}, {{{ employer }}}</li>

            {{#if @last}}
            </ul>
            {{/if}}
          {{/compare}}
        {{/each}}

      </section>
{{/if}}

{{# if r.education}}
      <section id="education">
        <header>
        <h2><span class="fa fa-mortar-board"></span> Education</h2><hr>
        </header>
        {{#each r.education.history}}
          <h3>{{{ institution }}} <span class="tenure">{{formatDate safe.start 'YYYY' }} &mdash; {{formatDate safe.end 'YYYY' }}<span></h3>
        {{/each}}

      </section>
{{/if}}

{{#if r.service}}
      <section id="volunteer">
        <header>
        <h2><span class="fa fa-child" style="vertical-align: top;"></span> Service</h2><hr>
        </header>
        {{#each r.service.history}}
          <h3><em>{{ position }}</em>,
            {{#if url}}
            <a href="{{ url }}">{{ organization }}</a>
            {{else}}
            {{ organization }}
            {{/if}}
            <span class="tenure">{{formatDate safe.start 'YYYY' }} &mdash; {{formatDate safe.end 'YYYY' }}<span></h3>
          <p style="clear: both;">{{{ summary }}}</p>
          {{#if highlights}}
            <ul>
            {{#each highlights}}
              <li>{{{ this }}}</li>
            {{/each}}
            </ul>
          {{/if}}
        {{/each}}

      </section>
{{/if}}

{{#if r.writing}}
      <section id="publications">
        <header>
        <h2><span class="fa fa-book"></span> Writing</h2><hr>
        </header>
        {{#each r.writing }}
          <h3><em>{{#if url}}<a href="{{{ url }}}">{{{ title }}}</a>{{else}}{{{ title }}}{{/if}}</em>,
            {{ publisher }} <span class="tenure">{{formatDate safe.date 'YYYY'}}</span></h3>
        {{# if summary}}{{{ summary }}}{{/if}}
        {{/each}}
      </section>
{{/if}}

{{# if r.recognition}}
      <section id="awards">
        <header>
        <h2><span class="fa fa-trophy"></span> Awards</h2><hr>
        </header>
        {{#each r.recognition}}
          <h4><span class="res-label">{{ title }}</span>, {{ from }} <span class="tenure">{{formatDate safe.date 'YYYY' }}</span></h4>
          {{ summary }}
        {{/each}}
      </section>
{{/if}}

    </main>
  </body>
</html>
