From 3ce47cad3750be90fc57110bb0a80456bf58dbba Mon Sep 17 00:00:00 2001 From: Jesse Hallett Date: Mon, 23 Dec 2013 14:59:23 -0800 Subject: Looks for adjacent singleton lists instead of just for singleton lists --- guidelines/wikipedia/spaceBetweenListItems.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/guidelines/wikipedia/spaceBetweenListItems.js b/guidelines/wikipedia/spaceBetweenListItems.js index 9802606..890b31c 100644 --- a/guidelines/wikipedia/spaceBetweenListItems.js +++ b/guidelines/wikipedia/spaceBetweenListItems.js @@ -2,16 +2,14 @@ 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); - } - }); + $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); - function reportWarning(i, li) { - var text = $.trim($(li).text()); - report.warning('List with a single item: '+ text, li); + $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); } }; -- cgit v1.2.3