aboutsummaryrefslogtreecommitdiff
path: root/guidelines/wikipedia/src/pseudoHeadings.js
blob: 1776b6ea6ae848ef0c93d39d54f0c438dc7ad177 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
exports.name = "Do not make pseudo-headings";
exports.description = "Do not make pseudo-headings using bold or semicolon markup.";

exports.rule = function(report) {
  $5('#mw-content-text p > b:only-child').each(function(i, b) {
    var boldText = $.trim($(b).text());
    var paraText = $.trim($(b).closest('p').text());
    if (boldText && boldText === paraText) {
      report.error('Bold text used as pseudo-heading: '+ boldText, b);
    }
  });

  $5('#mw-content-text dl:not(:has(dd)) dt').each(function(i, dt) {
    var text = $.trim($(dt).text());
    report.error('Semicolon markup used to create pseudo-heading: '+ text, dt);
  });
};