htmlparser-to-html
Advanced tools
Comparing version 0.0.5 to 0.0.6
19
index.js
@@ -26,3 +26,10 @@ var emptyTags = { | ||
var config = { | ||
disableAttribEscape: false | ||
}; | ||
function escapeAttrib(s) { | ||
if (config.disableAttribEscape === true) | ||
return s.toString(); | ||
// null or undefined | ||
@@ -39,3 +46,3 @@ if(s == null) { return ''; } | ||
function html(item, parent, eachFn) { | ||
var html = function(item, parent, eachFn) { | ||
// apply recursively to arrays | ||
@@ -92,2 +99,12 @@ if(Array.isArray(item)) { | ||
html.configure = function (userConfig) { | ||
if(userConfig !== undefined) { | ||
for (k in config) { | ||
if (userConfig[k] !== undefined){ | ||
config[k] = userConfig[k]; | ||
} | ||
} | ||
} | ||
} | ||
module.exports = html; |
{ | ||
"name": "htmlparser-to-html", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Converts the JSON that the htmlparser/htmlparser2 package produces back to HTML.", | ||
@@ -20,3 +20,3 @@ "main": "index.js", | ||
"author": "Mikito Takada <mikito.takada@gmail.com>", | ||
"license": "BSD", | ||
"license": "BSD-3-Clause", | ||
"readmeFilename": "readme.md", | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
@@ -19,2 +19,8 @@ # htmlparser-to-html | ||
### Configuration | ||
htmlparser-to-html can be configured with the `configure(config_object)`. The following configuration parmeters are available: | ||
- `disableAttribEscape`: Set to `true` to disable escaping the attribute values. (default is `false`) | ||
## Usage | ||
@@ -44,3 +50,7 @@ | ||
### Example configuration | ||
var html = require('htmlparser-to-html'); | ||
html.configure({disableAttribEscape: true); | ||
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
5394
0
100
55