<commit_before>describe("Markdown.Extra", function() {
  // basic code block
  var codeBlock = "```foolang\nfoo=bar;\n```";
  // expected code block html
  var codeBlockHtml ='<pre><code class="foolang">foo=bar;</code></pre>';

  // basic table
  var table = "h1 | h2 | h3\n:- | :-: | -:\n1 | 2 | 3";
  var tableVerbose = "| h1 | h2 | h3 |\n| :- | :-: | -: |\n| 1 | 2 | 3 |";
  // expected table html
  var tableHtml ='<table>\n' +
    '<thead>\n' +
    '<tr>\n' +
    '  <th style="text-align:left;">h1</th>\n' +
    '  <th style="text-align:center;">h2</th>\n' +
    '  <th style="text-align:right;">h3</th>\n' +
    '</tr>\n' +
    '</thead>\n' +
    '<tr>\n' +
    '  <td style="text-align:left;">1</td>\n' +
    '  <td style="text-align:center;">2</td>\n' +
    '  <td style="text-align:right;">3</td>\n' +
    '</tr>\n' +
    '</table>';
  // table containing inline and block-level tags and markdown
  var tableComplex = "h1|h2|h3\n-|-|-\n`code`|##hdr##|<script></script>";

  // markdown for a group of elements using attribute lists
  var attrList = "``` {#gfm-id .gfm-class}\n" +
    "var foo = bar;\n" +
    "```\n\n" +
    "## A Header {#header-id}\n\n" +
    "### Another One ### {#header-id .hclass}\n\n" +
    "Underlined {#what}\n" +
    "==========\n";
  // expected output for attribute list markdown
  var attrListHtml = '<pre id="gfm-id" class="gfm-class"><code>var foo = bar;</code></pre>\n\n' +
    '<h2 id="header-id">A Header</h2>\n\n' +
    '<h3 id="header-id" class="hclass">Another One</h3>\n\n' +
    '<h1 id="what">Underlined</h1>';

  var defList = "Term 1\nTerm 2\n:   Def1";
  var defListHtml = "<dl>\n<dt>Term 1</dt>\n<dt>Term 2</dt>\n<dd>Def1</dd>\n</dl>";
  var defListComplex = "Term 1\n\n" +
    ":   This definition has a code block, a blockquote and a list.\n\n" +
    "        code block.\n\n" +
    "    > block quote\n" +
    "    > on two lines.\n\n" +
    "    1.  first list item\n" +
    "    2.  second list item\n\n" +
    "Term 2\n\n" +
    ":   Definition 2\n\n";

  // some basic markdown without extensions
  var markdown = "#TestHeader\n_This_ is *markdown*" +
    "\n\nCool. And a link: [google](http://www.google.com)";

  function strip(str) {
    return str.replace(/^\s+|\s+$/g, '');
  }

  describe("when setting options", function() {
    var converter;

    beforeEach(function() {
      converter = new Markdown.Converter();
    });

    it("should default to use 'all' extensions", function() {
      var extra = Markdown.Extra.init(converter);
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      spyOn(extra, "definitionLists").andCallThrough();
      spyOn(extra, "hashHeaderAttributeBlocks").andCallThrough();
      spyOn(extra, "hashFcbAttributeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.tables).toHaveBeenCalled();
      expect(extra.fencedCodeBlocks).wasNotCalled();
      expect(extra.definitionLists).toHaveBeenCalled();
      expect(extra.hashHeaderAttributeBlocks).toHaveBeenCalled();
      expect(extra.hashFcbAttributeBlocks).toHaveBeenCalled();
    });

    it("should use 'all' extensions if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "all"});
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      spyOn(extra, "definitionLists").andCallThrough();
      spyOn(extra, "hashHeaderAttributeBlocks").andCallThrough();
      spyOn(extra, "hashFcbAttributeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.tables).toHaveBeenCalled();
      expect(extra.fencedCodeBlocks).wasNotCalled();
      expect(extra.definitionLists).toHaveBeenCalled();
      expect(extra.hashHeaderAttributeBlocks).toHaveBeenCalled();
      expect(extra.hashFcbAttributeBlocks).toHaveBeenCalled();
    });

    it("should use 'tables' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "tables"});
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.tables).toHaveBeenCalled();
      expect(extra.fencedCodeBlocks).wasNotCalled();
    });

    it("should use 'fenced_code_gfm' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "fenced_code_gfm"});
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.fencedCodeBlocks).toHaveBeenCalled();
      expect(extra.tables).wasNotCalled();
    });

    it("should use 'def_list' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "def_list"});
      spyOn(extra, "definitionLists").andCallThrough();
      spyOn(extra, "hashHeaderAttributeBlocks").andCallThrough();
      spyOn(extra, "hashFcbAttributeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.definitionLists).toHaveBeenCalled();
      expect(extra.hashHeaderAttributeBlocks).toHaveBeenCalled();
      expect(extra.hashFcbAttributeBlocks).toHaveBeenCalled();
    });

    it("should use 'attr_list' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "attr_list"});<commit_msg>Fixed unit tests<commit_after>describe("Markdown.Extra", function() {
  // basic code block
  var codeBlock = "```foolang\nfoo=bar;\n```";
  // expected code block html
  var codeBlockHtml ='<pre><code class="foolang">foo=bar;</code></pre>';

  // basic table
  var table = "h1 | h2 | h3\n:- | :-: | -:\n1 | 2 | 3";
  var tableVerbose = "| h1 | h2 | h3 |\n| :- | :-: | -: |\n| 1 | 2 | 3 |";
  // expected table html
  var tableHtml ='<table>\n' +
    '<thead>\n' +
    '<tr>\n' +
    '  <th style="text-align:left;">h1</th>\n' +
    '  <th style="text-align:center;">h2</th>\n' +
    '  <th style="text-align:right;">h3</th>\n' +
    '</tr>\n' +
    '</thead>\n' +
    '<tr>\n' +
    '  <td style="text-align:left;">1</td>\n' +
    '  <td style="text-align:center;">2</td>\n' +
    '  <td style="text-align:right;">3</td>\n' +
    '</tr>\n' +
    '</table>';
  // table containing inline and block-level tags and markdown
  var tableComplex = "h1|h2|h3\n-|-|-\n`code`|##hdr##|<script></script>";

  // markdown for a group of elements using attribute lists
  var attrList = "``` {#gfm-id .gfm-class}\n" +
    "var foo = bar;\n" +
    "```\n\n" +
    "## A Header {#header-id}\n\n" +
    "### Another One ### {#header-id .hclass}\n\n" +
    "Underlined {#what}\n" +
    "==========\n";
  // expected output for attribute list markdown
  var attrListHtml = '<pre id="gfm-id" class="gfm-class"><code>var foo = bar;</code></pre>\n\n' +
    '<h2 id="header-id">A Header</h2>\n\n' +
    '<h3 id="header-id" class="hclass">Another One</h3>\n\n' +
    '<h1 id="what">Underlined</h1>';

  var defList = "Term 1\nTerm 2\n:   Def1";
  var defListHtml = "<dl>\n<dt>Term 1</dt>\n<dt>Term 2</dt>\n<dd>Def1</dd>\n</dl>";
  var defListComplex = "Term 1\n\n" +
    ":   This definition has a code block, a blockquote and a list.\n\n" +
    "        code block.\n\n" +
    "    > block quote\n" +
    "    > on two lines.\n\n" +
    "    1.  first list item\n" +
    "    2.  second list item\n\n" +
    "Term 2\n\n" +
    ":   Definition 2\n\n";

  // some basic markdown without extensions
  var markdown = "#TestHeader\n_This_ is *markdown*" +
    "\n\nCool. And a link: [google](http://www.google.com)";

  function strip(str) {
    return str.replace(/^\s+|\s+$/g, '');
  }

  describe("when setting options", function() {
    var converter;

    beforeEach(function() {
      converter = new Markdown.Converter();
    });

    it("should default to use 'all' extensions", function() {
      var extra = Markdown.Extra.init(converter);
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      spyOn(extra, "definitionLists").andCallThrough();
      spyOn(extra, "hashHeaderAttributeBlocks").andCallThrough();
      spyOn(extra, "hashFcbAttributeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.tables).toHaveBeenCalled();
      expect(extra.fencedCodeBlocks).toHaveBeenCalled();
      expect(extra.definitionLists).toHaveBeenCalled();
      expect(extra.hashHeaderAttributeBlocks).toHaveBeenCalled();
      expect(extra.hashFcbAttributeBlocks).toHaveBeenCalled();
    });

    it("should use 'all' extensions if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "all"});
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      spyOn(extra, "definitionLists").andCallThrough();
      spyOn(extra, "hashHeaderAttributeBlocks").andCallThrough();
      spyOn(extra, "hashFcbAttributeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.tables).toHaveBeenCalled();
      expect(extra.fencedCodeBlocks).toHaveBeenCalled();
      expect(extra.definitionLists).toHaveBeenCalled();
      expect(extra.hashHeaderAttributeBlocks).toHaveBeenCalled();
      expect(extra.hashFcbAttributeBlocks).toHaveBeenCalled();
    });

    it("should use 'tables' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "tables"});
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.tables).toHaveBeenCalled();
      expect(extra.fencedCodeBlocks).wasNotCalled();
    });

    it("should use 'fenced_code_gfm' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "fenced_code_gfm"});
      spyOn(extra, "tables").andCallThrough();
      spyOn(extra, "fencedCodeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.fencedCodeBlocks).toHaveBeenCalled();
      expect(extra.tables).wasNotCalled();
    });

    it("should use 'def_list' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "def_list"});
      spyOn(extra, "definitionLists").andCallThrough();
      spyOn(extra, "hashHeaderAttributeBlocks").andCallThrough();
      spyOn(extra, "hashFcbAttributeBlocks").andCallThrough();
      converter.makeHtml(markdown);
      expect(extra.definitionLists).toHaveBeenCalled();
      expect(extra.hashHeaderAttributeBlocks).wasNotCalled();
      expect(extra.hashFcbAttributeBlocks).wasNotCalled();
    });

    it("should use 'attr_list' extension if specified", function() {
      var extra = Markdown.Extra.init(converter, {extensions: "attr_list"});
{'fraction_non_alphanumeric': 0.1848178700528316, 'fraction_numerical': 0.007044211697098897, 'mean_word_length': 3.5052192066805845, 'pattern_counts': {'":': 4, '<': 91, '<?xml version=': 0, '>': 95, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1204632', 'n_tokens_mistral': 3691, 'n_tokens_neox': 3608, 'n_words': 643}