blob: ba20306472ae8684fc7f2493a2c57cfd426b3fa8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
exports.name = "Avoid single-sentence paragraphs";
exports.description = "The number of single-sentence paragraphs should be minimized.";
exports.rule = function(report) {
var sentenceBoundary = /[.?!](?:(?:\[\d+\])|['"])*(?:\s|$)/gm;
$5('#mw-content-text p').each(function(i, p) {
var $p = $(p);
var text = $.trim($p.text());
var boundaries = text && text.match(sentenceBoundary);
if (boundaries && boundaries.length === 1) {
report.warning('Paragraph with only one sentence: "' + text +'"', p);
}
});
};
|