aboutsummaryrefslogtreecommitdiff
path: root/guidelines/wikipedia/spaceBetweenListItems.js
blob: 98026068ac89628272491321b52e853ceb568ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
exports.name = "Do not separate list items with blank lines";
exports.description = "Leaving blank lines between list items causes mediawiki to end one list and to start a new one.";

exports.rule = function(report) {
  $5('li:only-of-type').each(reportWarning);
  $5('dl:has(dt):has(dd)').each(function(i, dl) {
    var $dd = $(dl).find('dd');
    if ($dd.length === 1) {
      reportWarning(i, dl);
    }
  });

  function reportWarning(i, li) {
    var text = $.trim($(li).text());
    report.warning('List with a single item: '+ text, li);
  }
};