diff options
Diffstat (limited to 'exampleData/ruleSets/basic/capitalHeadings.js')
-rw-r--r-- | exampleData/ruleSets/basic/capitalHeadings.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/exampleData/ruleSets/basic/capitalHeadings.js b/exampleData/ruleSets/basic/capitalHeadings.js new file mode 100644 index 0000000..ec44fd7 --- /dev/null +++ b/exampleData/ruleSets/basic/capitalHeadings.js @@ -0,0 +1,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); + }); +}; |