Comparing version 0.0.4 to 0.0.5
@@ -6,2 +6,7 @@ !(function () { | ||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | ||
var sys = require('sys'); | ||
this.log = function (message) { | ||
sys.puts(message); | ||
} | ||
// If this is | ||
@@ -14,2 +19,5 @@ this.$ = require('jquery'); | ||
this.marked = marked; | ||
this.log = function (message) { | ||
console.log(message); | ||
} | ||
} | ||
@@ -46,2 +54,8 @@ | ||
if (options.debug === false) { | ||
this.log = function (message) { | ||
return message; | ||
} | ||
} | ||
if (options.sourceFormat === 'markdown') { | ||
@@ -64,3 +78,3 @@ children = this.$('<body>').append(this.marked(this.source)).children(); | ||
parse_html: function (content, htmlbooklevel) { | ||
console.log("\n>>> Making section " + htmlbooklevel.name); | ||
this.log("\n>>> Making section " + htmlbooklevel.name); | ||
// initialize variables | ||
@@ -86,3 +100,3 @@ var section; | ||
if (first_element != false) { | ||
console.log("found a heading as the first element") | ||
this.log("found a heading as the first element") | ||
var more_headings = this.find_headings(content, first_element.tag_name); | ||
@@ -96,3 +110,3 @@ var arr = this.wrap_in_section(htmlbooklevel, children, first_element, more_headings); | ||
var section_content; | ||
console.log('no more headings in this branch.'); | ||
this.log('no more headings in this branch.'); | ||
section_content = this.$('<div>').html(first).html() + this.parse_html(rest, htmlbooklevel); | ||
@@ -118,7 +132,7 @@ | ||
subheading = htmlbook_spec[htmlbooklevel.child]; | ||
console.log('sub headings'); | ||
this.log('sub headings'); | ||
section_content = this.parse_html(children.splice(1), subheading); | ||
} else { | ||
// There are no other headings, so the work is done. | ||
console.log("no more headings in the document."); | ||
this.log("no more headings in the document."); | ||
section_content = children.splice(1); | ||
@@ -125,0 +139,0 @@ } |
{ | ||
"name": "htmlbook", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "HTML to HTMLBook parser", | ||
@@ -5,0 +5,0 @@ "main": "./htmlbook.js", |
@@ -42,2 +42,3 @@ # htmlbook.js | ||
- fragment: _false_ or true | ||
- level: _chapter_ or book | ||
- level: _chapter_ or book | ||
- debug: boolean -- default for command line is 'false' |
Sorry, the diff of this file is not supported yet
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
3445
43
239340
13