define(["exports", "deps/text!core/css/bp.css", "core/pubsubhub"], function (exports, _bp, _pubsubhub) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.name = undefined;
  exports.run = run;

  var _bp2 = _interopRequireDefault(_bp);

  function _interopRequireDefault(obj) {
    return obj && obj.__esModule ? obj : {
      default: obj
    };
  }

  // Module core/best-practices
  // Handles the marking up of best practices, and can generate a summary of all of them.
  // The summary is generated if there is a section in the document with ID bp-summary.
  // Best practices are marked up with span.practicelab.
  var name = exports.name = "core/best-practices";

  function run(conf, doc, cb) {
    var num = 0;
    var $bps = $("span.practicelab", doc);
    var $content = $("<div><h2>Best Practices Summary</h2><ul></ul></div>");
    var $ul = $content.find("ul");
    $bps.each(function () {
      var $bp = $(this);
      var id = $bp.makeID("bp");
      var $li = $("<li><a></a></li>");
      var $a = $li.find("a");
      num++;
      $a.attr("href", "#" + id).text("Best Practice " + num);
      $li.append(doc.createTextNode(": " + $bp.text()));
      $ul.append($li);
      $bp.prepend(doc.createTextNode("Best Practice " + num + ": "));
    });
    if ($bps.length) {
      $(doc).find("head link").first().before($("<style/>").text(_bp2.default));
      if ($("#bp-summary")) $("#bp-summary").append($content.contents());
    } else if ($("#bp-summary").length) {
      (0, _pubsubhub.pub)("warn", "Using best practices summary (#bp-summary) but no best practices found.");
      $("#bp-summary").remove();
    }
    cb();
  }
});
//# sourceMappingURL=best-practices.js.map