fix: wikpedia transform only grabs one image from .infobox

pull/5/head
Adam Pash 8 years ago
parent 44d3a547b2
commit 005ba47f6f

6
dist/iris.js vendored

@ -528,7 +528,11 @@ var WikipediaExtractor = {
// transform top infobox to an image with caption
transforms: {
'.infobox img': function infoboxImg($node) {
$node.parents('.infobox').prepend($node);
var $parent = $node.parents('.infobox');
// Only prepend the first image in .infobox
if ($parent.children('img').length === 0) {
$parent.prepend($node);
}
},
'.infobox caption': 'figcaption',
'.infobox': 'figure'

2
dist/iris.js.map vendored

File diff suppressed because one or more lines are too long

@ -10,7 +10,11 @@ const WikipediaExtractor = {
// transform top infobox to an image with caption
transforms: {
'.infobox img': ($node) => {
$node.parents('.infobox').prepend($node);
const $parent = $node.parents('.infobox');
// Only prepend the first image in .infobox
if ($parent.children('img').length === 0) {
$parent.prepend($node);
}
},
'.infobox caption': 'figcaption',
'.infobox': 'figure',

Loading…
Cancel
Save