<commit_before><!DOCTYPE html>
<meta charset="utf-8">
<title>Slowparse Error Reporting Specification</title>
<style>
html, body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: small;
}

body {
  width: 800px;
  margin: 0 auto 1em auto;
}

div.report > h2:before {
  content: "ERROR TYPE: ";
  color: gray;
}

.test.failed div.report > h2:before {
  content: 'FATAL ERROR';
  color: black;
}

pre, div.js {
  font-family: Menlo, Monaco, "Lucida Console", monospace;
}

div.console {
  background: black;
  padding: 10px;
}

div.js {
  color: lightgreen;
}

div.js > div {
  display: pre;
}

div.js > div:before {
  content: '> ';
  color: gray;
}

pre.result {
  color: lightgray;
}

pre.html {
  background: #f0f0f0;
  color: black;
  padding: 10px;
}

.color-1 {
  background: pink;
}

.color-2 {
  background: black;
  color: white;
}

.error em {
  font-style: inherit;
}

a {
  color: inherit;
}

.test.failed, .test.failed .html {
  background: firebrick;
}

.test.failed div.console {
  background: darkred;
}
</style>
<h1>Slowparse Error Reporting Specification</h1>
<p>All of the following documentation is generated on-the-fly,
  in your browser, by Slowparse. If something looks amiss, run the actual 
  output against the expected results at the <a href="../test/">test sute</a>;
  if errors are reported, please feel free to
  <a href="https://github.com/toolness/slowparse/issues">file a bug</a>.</p>
<p>You can also consult the <a href=".">live demo</a> to see this error
  reporting used in an interactive widget.</p>
<div id="templates" style="display: none">
  <div class="report">
    <h2></h2>
    <h3>Example</h3>
    <pre class="html"></pre>
    <div class="error"></div>
    <h3>JavaScript Code</h3>
    <div class="console">
      <div class="js">
        <div>Slowparse.findError({{HTML}});</div>
      </div>
      <pre class="result"></pre>
    </div>
  </div>
  <div class="error-msgs"></div>
</div>
<div class="test">
  <script type="text/x-bad-html">
    <p>hi</i>
  </script>
  <script type="application/json">
  {
    "type": "MISMATCHED_CLOSE_TAG",
    "openTag": {
      "name": "p",
      "start": 0,
      "end": 3
    },
    "closeTag": {
      "name": "i",
      "start": 5,
      "end": 8
    }
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    hello <em>there
  </script>
  <script type="application/json">
  {
    "type": "UNCLOSED_TAG",
    "openTag": {
      "name": "em",
      "start": 6,
      "end": 10
    }
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    <-lol>
  </script>
  <script type="application/json">
  {
    "type": "INVALID_TAG_NAME",
    "openTag": {
      "name": "",
      "start": 0,
      "end": 1
    }
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    <a class=foo bar>
  </script>
  <script type="application/json">
  {
    "type": "UNQUOTED_ATTR_VALUE",
    "start": 9
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    hello <em class="foo>there</em>
  </script>
  <script type="application/json">
  {
    "type": "UNTERMINATED_ATTR_VALUE",
    "openTag": {
      "name": "em",
      "start": 6
    },
    "attribute": {
      "name": {
        "value": "class",
        "start": 10,
        "end": 15
      },
      "value": {
        "start": 16
      }
    }
  }
  </script>
</div>
<script src="jquery.min.js"></script>
<script src="underscore.min.js"></script><commit_msg>added a 'notes' section for the UNQUOTED_ATTR_VALUE error.<commit_after><!DOCTYPE html>
<meta charset="utf-8">
<title>Slowparse Error Reporting Specification</title>
<style>
html, body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: small;
}

body {
  width: 800px;
  margin: 0 auto 1em auto;
}

div.report > h2:before {
  content: "ERROR TYPE: ";
  color: gray;
}

.test.failed div.report > h2:before {
  content: 'FATAL ERROR';
  color: black;
}

pre, div.js {
  font-family: Menlo, Monaco, "Lucida Console", monospace;
}

div.console {
  background: black;
  padding: 10px;
}

div.js {
  color: lightgreen;
}

div.js > div {
  display: pre;
}

div.js > div:before {
  content: '> ';
  color: gray;
}

pre.result {
  color: lightgray;
}

pre.html {
  background: #f0f0f0;
  color: black;
  padding: 10px;
}

.color-1 {
  background: pink;
}

.color-2 {
  background: black;
  color: white;
}

.error em {
  font-style: inherit;
}

a {
  color: inherit;
}

.test.failed, .test.failed .html {
  background: firebrick;
}

.test.failed div.console {
  background: darkred;
}
</style>
<h1>Slowparse Error Reporting Specification</h1>
<p>All of the following documentation is generated on-the-fly,
  in your browser, by Slowparse. If something looks amiss, run the actual 
  output against the expected results at the <a href="../test/">test sute</a>;
  if errors are reported, please feel free to
  <a href="https://github.com/toolness/slowparse/issues">file a bug</a>.</p>
<p>You can also consult the <a href=".">live demo</a> to see this error
  reporting used in an interactive widget.</p>
<div id="templates" style="display: none">
  <div class="report">
    <h2></h2>
    <h3>Example</h3>
    <pre class="html"></pre>
    <div class="error"></div>
    <h3>JavaScript Code</h3>
    <div class="console">
      <div class="js">
        <div>Slowparse.findError({{HTML}});</div>
      </div>
      <pre class="result"></pre>
    </div>
  </div>
  <div class="error-msgs"></div>
</div>
<div class="test">
  <script type="text/x-bad-html">
    <p>hi</i>
  </script>
  <script type="application/json">
  {
    "type": "MISMATCHED_CLOSE_TAG",
    "openTag": {
      "name": "p",
      "start": 0,
      "end": 3
    },
    "closeTag": {
      "name": "i",
      "start": 5,
      "end": 8
    }
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    hello <em>there
  </script>
  <script type="application/json">
  {
    "type": "UNCLOSED_TAG",
    "openTag": {
      "name": "em",
      "start": 6,
      "end": 10
    }
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    <-lol>
  </script>
  <script type="application/json">
  {
    "type": "INVALID_TAG_NAME",
    "openTag": {
      "name": "",
      "start": 0,
      "end": 1
    }
  }
  </script>
</div>
<div class="test">
  <script type="text/x-bad-html">
    <a class=foo bar>
  </script>
  <script type="application/json">
  {
    "type": "UNQUOTED_ATTR_VALUE",
    "start": 9
  }
  </script>
  <h3>Notes</h3>
  <p>The HTML5 specification actually allows unquoted attribute
    values, so long as they don't have spaces in them. However,
    this isn't commonly done outside of minifying HTML. Furthermore, by
    complicating the standard, our predictions about the user's
    intent also become ambiguous, which results in more cryptic
    and confusing error messages. By choosing to enforce monotony, we
    ease the learning process and provide more helpful
    errors.</p>
</div>
<div class="test">
  <script type="text/x-bad-html">
    hello <em class="foo>there</em>
  </script>
  <script type="application/json">
  {
    "type": "UNTERMINATED_ATTR_VALUE",
    "openTag": {
      "name": "em",
      "start": 6
    },
    "attribute": {
      "name": {
        "value": "class",
        "start": 10,
        "end": 15
      },
      "value": {
        "start": 16
      }
    }
  }
  </script>
</div>
<script src="jquery.min.js"></script>
<script src="underscore.min.js"></script>
{'fraction_non_alphanumeric': 0.18082701768381865, 'fraction_numerical': 0.011567610690067811, 'mean_word_length': 2.865364850976362, 'pattern_counts': {'":': 64, '<': 173, '<?xml version=': 0, '>': 183, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2523341', 'n_tokens_mistral': 2881, 'n_tokens_neox': 2787, 'n_words': 685}