aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/basic/capitalHeadings.js
blob: ec44fd740751dce0ed5d6d211b88a5eb63445c58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
exports.name = 'Capitalized headings';
exports.description = 'All headings should lead with a capital letter';

exports.rule = function(report) {
  var badHeadings = $5(':header').filter(
    function(idx) {
      var ch = $(this).text()[0];
      if (ch) {
        return (ch == ch.toLowerCase());
      }
      else {
        return false;
      }
    });
  $(badHeadings).each(function(i, elt) {
    report.error('Heading does not start with a capital letter', elt);
  });
};