aboutsummaryrefslogtreecommitdiff
path: root/guidelines/wikipedia/spaceBetweenListItems.js
blob: 890b31cb368909ec66edf508ce37c4d71a6436d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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('ol:has(> li:only-of-type) + ol:has(> li:only-of-type)').each(reportWarning);
  $5('ul:has(> li:only-of-type) + ul:has(> li:only-of-type)').each(reportWarning);

  $5('dl:has(> dt:only-of-type):has(> dd:only-of-type) + '+
     'dl:has(> dt:only-of-type):has(> dd:only-of-type)').each(reportWarning);

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