From c36b2da719fd3a55d463cb5a137f0cb8558b16cc Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Tue, 12 Jul 2016 18:09:12 +0200 Subject: [PATCH] Handle article with only an image, fixes #60 --- index.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.coffee b/index.coffee index 5020311..573bf94 100644 --- a/index.coffee +++ b/index.coffee @@ -259,6 +259,12 @@ module.exports = class Flatten caption = null title = null src = null + if tag.children.length is 1 and tag.children[0].name is 'img' and tag.children[0].attribs?.src + results.push + type: 'image' + html: @tagToHtml tag.children[0] + src: @normalizeUrl tag.children[0].attribs.src + return results for child in tag.children if child.name is 'h1' and not title title = ''