Skip to content

Commit

Permalink
entities → he
Browse files Browse the repository at this point in the history
discussion the-grid/ced#10
  • Loading branch information
forresto committed Mar 16, 2016
1 parent 8db6481 commit 27fae6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions index.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
htmlparser = require 'htmlparser'
entities = require 'entities'
he = require 'he'
uri = require 'urijs'
Promise = require 'bluebird'

Expand Down Expand Up @@ -265,8 +265,8 @@ module.exports = class Flatten
type: 'image'
src: tag.attribs.src
html: @tagToHtml tag, id
img.title = entities.decodeHTML(tag.attribs.title) if tag.attribs.title
img.caption = entities.decodeHTML(tag.attribs.alt) if tag.attribs.alt
img.title = he.decode(tag.attribs.title) if tag.attribs.title
img.caption = he.decode(tag.attribs.alt) if tag.attribs.alt
results.push img
when 'figure'
return results unless tag.children
Expand Down Expand Up @@ -294,7 +294,7 @@ module.exports = class Flatten
type: type
src: src
html: @tagToHtml tag, id, true
img.caption = entities.decodeHTML(caption) if caption
img.caption = he.decode(caption) if caption
results.push img
when 'article'
return results unless tag.children
Expand All @@ -315,8 +315,8 @@ module.exports = class Flatten
article =
type: 'article'
html: @tagToHtml tag, id
article.title = entities.decodeHTML(title) if title
article.caption = entities.decodeHTML(caption) if caption
article.title = he.decode(title) if title
article.caption = he.decode(caption) if caption
article.src = src if src
results.push article
when 'p', 'em', 'small'
Expand Down Expand Up @@ -472,7 +472,7 @@ module.exports = class Flatten
tagToText: (tag) ->
text = ''
if tag.type is 'text'
return entities.decodeHTML tag.data
return he.decode tag.data
if tag.name is 'br'
return ' '
if tag.children
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"dependencies": {
"bluebird": "^3.1.4",
"entities": "1.1.1",
"he": "^0.5.0",
"htmlparser": "1.7.7",
"urijs": "1.17.1"
},
Expand Down

0 comments on commit 27fae6e

Please sign in to comment.