Comparing version 1.1.2 to 1.2.0
@@ -0,1 +1,6 @@ | ||
1.2.0 / 2015-05-21 | ||
================== | ||
* Add `xmlMode` option | ||
1.1.2 / 2015-05-08 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -9,4 +9,9 @@ | ||
var juice = function (html,options) { | ||
var $ = utils.cheerio(html); | ||
return juiceDocument($,options).html(); | ||
var $ = utils.cheerio(html, { xmlMode: options && options.xmlMode}); | ||
doc = juiceDocument($,options) | ||
if (options && options.xmlMode) | ||
return doc.xml(); | ||
else | ||
return doc.html(); | ||
}; | ||
@@ -299,5 +304,9 @@ | ||
var $ = utils.cheerio(html); | ||
var $ = utils.cheerio(html, { xmlMode: options && options.xmlMode}); | ||
juiceDocument($, options); | ||
callback(null, $.html()); | ||
if (options.xmlMode) | ||
callback(null, $.xml()); | ||
else | ||
callback(null, $.html()); | ||
}; | ||
@@ -339,5 +348,9 @@ | ||
function inlineContent(html, css, options) { | ||
var $ = utils.cheerio(html); | ||
var $ = utils.cheerio(html, { xmlMode: options && options.xmlMode}); | ||
inlineDocument($, css, options); | ||
return $.html(); | ||
if (options && options.xmlMode) | ||
return $.xml(); | ||
else | ||
return $.html(); | ||
} | ||
@@ -378,2 +391,1 @@ | ||
} | ||
@@ -139,4 +139,5 @@ | ||
exports.cheerio = function (html) { | ||
return cheerio.load(html,{decodeEntities: false}); | ||
exports.cheerio = function (html, options) { | ||
options = exports.extend({decodeEntities: false}, options || {}); | ||
return cheerio.load(html,options); | ||
}; | ||
@@ -143,0 +144,0 @@ |
{ | ||
"name": "juice", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Inlines css into html source", | ||
@@ -5,0 +5,0 @@ "bin": "./bin/juice", |
@@ -55,2 +55,3 @@ [![Build Status](https://travis-ci.org/Automattic/juice.png?branch=master)](https://travis-ci.org/Automattic/juice) | ||
* `inlinePseudoElements` - Whether to insert pseudo elements (`::before` and `::after`) as `<span>` into the DOM. *Note*: Inserting pseudo elements will modify the DOM and may conflict with CSS selectors elsewhere on the page (e.g., `:last-child`). | ||
* `xmlMode` - whether to output XML/XHTML with all tags closed. Note that the input *must* also be valid XML/XHTML or you will get undesirable results. Defaults to `false`. | ||
@@ -57,0 +58,0 @@ ### Methods |
238860
673
160