mirror of
https://github.com/KevinMidboe/inline-html.git
synced 2025-10-29 17:40:29 +00:00
Return decoded html.
This commit is contained in:
@@ -12,7 +12,7 @@ var unwrap = function (value) {
|
|||||||
return value.replace(regexp, '$1');
|
return value.replace(regexp, '$1');
|
||||||
};
|
};
|
||||||
var inline = function (html, filePath) {
|
var inline = function (html, filePath) {
|
||||||
var $ = cheerio.load(html);
|
var $ = cheerio.load(html, {decodeEntities: false});
|
||||||
|
|
||||||
// style elements
|
// style elements
|
||||||
var styles = $('style');
|
var styles = $('style');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ var path = require('path');
|
|||||||
|
|
||||||
var inline = function (html, filePath) {
|
var inline = function (html, filePath) {
|
||||||
var basedir = path.dirname(filePath);
|
var basedir = path.dirname(filePath);
|
||||||
var $ = cheerio.load(html);
|
var $ = cheerio.load(html, {decodeEntities: false});
|
||||||
var images = $('img').filter(function (index, element) {
|
var images = $('img').filter(function (index, element) {
|
||||||
return isLocalPath($(element).attr('src'));
|
return isLocalPath($(element).attr('src'));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ var inline = co.wrap(function * (html, filepath, options) {
|
|||||||
|
|
||||||
// TODO Import less links
|
// TODO Import less links
|
||||||
// get links
|
// get links
|
||||||
var $ = cheerio.load(html);
|
var $ = cheerio.load(html, {decodeEntities: false});
|
||||||
var links = $('link[rel="stylesheet/less"]')
|
var links = $('link[rel="stylesheet/less"]')
|
||||||
.filter(function (index, element) {
|
.filter(function (index, element) {
|
||||||
return isLocalPath($(element).attr('href'));
|
return isLocalPath($(element).attr('href'));
|
||||||
|
|||||||
2
test/fixtures/index.html
vendored
2
test/fixtures/index.html
vendored
@@ -19,5 +19,7 @@
|
|||||||
<div id="style">Style</div>
|
<div id="style">Style</div>
|
||||||
<div id="attribute" style="background-image: url('./assets/person.png'); background-size: contain; background-repeat: no-repeat;">Attribute</div>
|
<div id="attribute" style="background-image: url('./assets/person.png'); background-size: contain; background-repeat: no-repeat;">Attribute</div>
|
||||||
<img height="32px" width="32px" src="./assets/person.png"/>Image
|
<img height="32px" width="32px" src="./assets/person.png"/>Image
|
||||||
|
{{> partial}}
|
||||||
|
{{helper}}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user