Comparing version 0.1.1 to 0.1.2
@@ -169,3 +169,3 @@ var sys = require('sys'), | ||
HTMLBook.prototype.wrap_in_section = function (node, callback) { | ||
return this.section_start(node.name) + "<" + htmlbook_headers[this.depth] + ">" + callback(node.children) + "</" + htmlbook_headers[this.depth] + ">\n" | ||
return this.section_start(node.name) + "<" + htmlbook_headers[this.depth] + ">" + callback.call(this, node.children) + "</" + htmlbook_headers[this.depth] + ">\n" | ||
} | ||
@@ -180,4 +180,6 @@ | ||
output += S(node.data).unescapeHTML().s.replace(/([<>&])/gm, function(m){return S(m).escapeHTML().s}); | ||
} else if (node.type === "comment") { | ||
output += "<!-- "+node.data+"-->"; | ||
// Markdown doesn't convert pre blocks the way we would like, so let's | ||
@@ -191,4 +193,5 @@ // step in and make it all work. | ||
output += open_tag(node) + this.traverse(code.children) + close_tag(node); | ||
// Check to see if this node is a header, which should signal the start // of a new section. | ||
} else if (_.contains(markdown_headers, node.name)) { | ||
// Check to see if this node is a header, which should signal the start // of a new section. Only allow headers without parent elements. | ||
} else if (_.contains(markdown_headers, node.name) && !helpers.existy(node.parent) ) { | ||
this.openings += 1; | ||
@@ -195,0 +198,0 @@ output += this.wrap_in_section(node, this.traverse) |
{ | ||
"name": "htmlbook", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Markdown to HTMLBook converter", | ||
@@ -5,0 +5,0 @@ "main": "./htmlbook.js", |
@@ -23,2 +23,22 @@ var htmlbook = require('../htmlbook'); | ||
describe("htmlbook validations", function () { | ||
it("BBEPart2", function (done) { | ||
convert_and_validate("spec/samples/BBEPart2.md", done) | ||
}) | ||
it("streams", function (done) { | ||
convert_and_validate("spec/samples/streams.md", done) | ||
}) | ||
it("artofnode", function (done) { | ||
convert_and_validate("spec/samples/artofnode.md", done) | ||
}) | ||
it("dataviz tech", function (done) { | ||
convert_and_validate("spec/samples/dataviz_tech.md", done) | ||
}) | ||
it("dataviz data", function (done) { | ||
convert_and_validate("spec/samples/dataviz_data.md", done) | ||
}) | ||
it("should convert all_headings.md to valid HTMLBook", function (done) { | ||
@@ -25,0 +45,0 @@ convert_and_validate("spec/documents/all_headings.md", done); |
366965
24
8001