dgroup/lazylead

View on GitHub
lib/messages/svn_diff_attachment.erb

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
<head>
  <style>
    /* CSS styles taken from https://github.com/yegor256/tacit */
    pre, code, kbd, samp, var, output {
      font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
      font-size: 14.4px
    }

    pre code {
      background: none;
      border: 0;
      line-height: 29.7px;
      padding: 0
    }

    code, kbd {
      background: #daf1e0;
      border-radius: 3.6px;
      color: #2a6f3b;
      display: inline-block;
      line-height: 18px;
      padding: 3.6px 6.3px 2.7px
    }

    a {
      color: #275a90;
      text-decoration: none
    }

    a:hover {
      text-decoration: underline
    }

    * {
      border: 0;
      border-collapse: separate;
      border-spacing: 0;
      box-sizing: border-box;
      margin: 0;
      max-width: 100%;
      padding: 0;
      vertical-align: baseline;
      font-family: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
      font-size: 13px;
      font-stretch: normal;
      font-style: normal;
      font-weight: 400;
      line-height: 29.7px
    }

    html, body {
      width: 100%
    }

    html {
      height: 100%
    }

    body {
      background: #fff;
      color: #1a1919;
      padding: 36px
    }

    .commit, .table-of-contents {
      min-width: 100%;
      border-radius: 3.5px;
      overflow: hidden;
      display: inline-block;
      line-height: 15px;
      font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
      border: 1px solid #BCC6CC;
    }

    .commit *, .table-of-contents * {
      padding-left: 4px;
      font-size: 8px;
      line-height: 15px;
    }

    .table-of-contents {
      border: none;
    }
  </style>
  <title>SVN log</title>
</head>
<body>
<p>Hi,</p>
<p>Commit(s) since <code><%= since_rev %></code> revision in <a href="<%= svn_url %>"><%= svn_url %></a>:</p>
<div id="table-of-contents" class="table-of-contents">
  <ul>
    <% commits.each do |commit| %>
      <li><a href="#<%= commit.rev %>"><%= commit.rev %></a> by <%= commit.author %> at <%= commit.time %></li>
    <% end %>
  </ul>
</div>
<% commits.each do |commit| %>
  <div class="commit">
    <% commit.lines.each_with_index do |line, index| %>
      <% if index.zero? %>
        <p style="background: gainsboro;" id="<%= commit.rev %>"><a href="<%= commit_url %><%= commit.rev %>"><%= commit.rev %></a> by <a href="<%= user %><%= commit.author %>"><%= commit.author %></a> at <span style="color: #275a90;"><%= commit.time %></span>
          <a href="#table-of-contents">&#8593;</a>
        </p>
      <% else %>
        <% if line.start_with?("+++") || line.start_with?("---") %>
          <p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
        <% elsif line.start_with?("+") %>
          <p style="<%= "background: darkseagreen;" %>"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
        <% elsif line.start_with?("-") %>
          <p style="<%= "background: lightsalmon;" %>"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
        <% else %>
          <p style="background: gainsboro;"><%= line.gsub(/[<>]/, '<' => '&lt;', '>' => '&gt;') %></p>
        <% end %>
      <% end %>
    <% end %>
  </div>
  <br/>
<% end %>
<p>Posted by
  <a href="https://github.com/dgroup/lazylead">lazylead v<%= version %></a>.
</p>
</body>
</html>