mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Refine ext detection.
This commit is contained in:
@@ -28,6 +28,8 @@ const highlights = {
|
||||
]
|
||||
};
|
||||
|
||||
const exts = _.keys(highlights);
|
||||
|
||||
/**
|
||||
* Converts Lodash method references into documentation links.
|
||||
*
|
||||
@@ -117,7 +119,8 @@ function tidyHighlights($) {
|
||||
$('.highlight').each(function() {
|
||||
let $spans;
|
||||
const $parent = $(this);
|
||||
const ext = $parent.find('.source,.text').first().attr('class').split(' ').pop();
|
||||
const classes = $parent.find('.source,.text').first().attr('class').split(' ');
|
||||
const ext = _(classes).intersection(exts).last();
|
||||
|
||||
$parent.addClass(ext);
|
||||
|
||||
@@ -132,7 +135,7 @@ function tidyHighlights($) {
|
||||
$parent.find('[class]').each(function() {
|
||||
const $element = $(this);
|
||||
const classes = $element.attr('class').split(' ');
|
||||
const attr = _.intersection(classes, highlights[ext]).join(' ');
|
||||
const attr = _(classes).intersection(highlights[ext]).join(' ');
|
||||
$element.attr('class', attr || null);
|
||||
});
|
||||
// Collapse nested comment highlights.
|
||||
|
||||
Reference in New Issue
Block a user