Comparing version 0.0.1 to 0.0.2
@@ -5,3 +5,8 @@ <!--mdast setext--> | ||
0.0.2 / 2015-10-10 | ||
================== | ||
* Add voids, open-close as processor data ([c16499f](https://github.com/wooorm/hast/commit/c16499f)) | ||
0.0.1 / 2015-10-09 | ||
================== |
@@ -20,2 +20,4 @@ /** | ||
var Compiler = require('./lib/compile'); | ||
var openClose = require('./lib/data/open-close'); | ||
var voids = require('./lib/data/void'); | ||
@@ -29,3 +31,7 @@ /* | ||
'Parser': Parser, | ||
'Compiler': Compiler | ||
'Compiler': Compiler, | ||
'data': { | ||
'voids': voids, | ||
'openClose': openClose | ||
} | ||
}); |
@@ -19,3 +19,2 @@ /** | ||
var compileAttributes = require('./attributes/compile'); | ||
var voids = require('./data/void'); | ||
@@ -44,4 +43,7 @@ /** | ||
* @param {File} file - Virtual file. | ||
* @param {Object?} options - Configuration. | ||
* @param {HAST} hast - Processor. | ||
*/ | ||
function Compiler(file) { | ||
function Compiler(file, options, hast) { | ||
this.data = hast.data; | ||
this.file = file; | ||
@@ -144,2 +146,3 @@ } | ||
function element(node) { | ||
var self = this; | ||
var nodeName = node.tagName; | ||
@@ -153,5 +156,5 @@ var value = '<' + nodeName; | ||
value += '>' + this.all(node); | ||
value += '>' + self.all(node); | ||
return value + (voids[nodeName] ? '' : '</' + nodeName + '>'); | ||
return value + (self.data.voids[nodeName] ? '' : '</' + nodeName + '>'); | ||
} | ||
@@ -162,3 +165,3 @@ | ||
* | ||
* @this {Parser} | ||
* @this {Compiler} | ||
* @return {string} - HTML. | ||
@@ -165,0 +168,0 @@ */ |
@@ -18,4 +18,2 @@ /** | ||
var parseAttributes = require('./attributes/parse'); | ||
var openClose = require('./data/open-close'); | ||
var voids = require('./data/void'); | ||
@@ -110,4 +108,7 @@ /* | ||
* @param {File} file - Virtual file. | ||
* @param {Object?} options - Configuration. | ||
* @param {HAST} hast - Processor. | ||
*/ | ||
function Parser(file) { | ||
function Parser(file, options, hast) { | ||
this.data = hast.data; | ||
this.file = file; | ||
@@ -332,3 +333,3 @@ this.stack = []; | ||
var nodeName = tagName.toLowerCase(); | ||
var closing = openClose[nodeName]; | ||
var closing = self.data.openClose[nodeName]; | ||
@@ -343,3 +344,3 @@ self.tagName = nodeName; | ||
if (!has.call(voids, nodeName)) { | ||
if (!has.call(self.data.voids, nodeName)) { | ||
self.tagNameStack.push(nodeName); | ||
@@ -366,3 +367,3 @@ } | ||
if (has.call(voids, self.tagName)) { | ||
if (has.call(self.data.voids, self.tagName)) { | ||
self.exit(); | ||
@@ -387,3 +388,3 @@ } | ||
if (self.tagNameStack.length && !has.call(voids, nodeName)) { | ||
if (self.tagNameStack.length && !has.call(self.data.voids, nodeName)) { | ||
pos = self.tagNameStack.lastIndexOf(nodeName); | ||
@@ -390,0 +391,0 @@ |
{ | ||
"name": "hast", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "HTML processor powered by plugins", | ||
@@ -28,3 +28,3 @@ "license": "MIT", | ||
"trim": "0.0.1", | ||
"unified": "^2.0.0" | ||
"unified": "^2.1.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31026
1094
Updatedunified@^2.1.0