gitbook-html
Advanced tools
Comparing version 1.0.0 to 1.0.1
var _ = require('lodash'); | ||
var dom = require('./dom'); | ||
var SELECTOR_LIST = '.olist > ol, ol, ul'; | ||
var SELECTOR_LIST = 'ol, ul'; | ||
var SELECTOR_LINK = '> a, p > a'; | ||
@@ -57,5 +57,7 @@ | ||
var $list = $(this); | ||
var $title = $list.prevUntil(SELECTOR_LIST, 'h2, h3, h4').first(); | ||
parts.push({ | ||
articles: parseList($(SELECTOR_LIST).first(), $) | ||
title: $title.text().trim(), | ||
articles: parseList($list, $) | ||
}); | ||
@@ -62,0 +64,0 @@ }); |
@@ -126,2 +126,4 @@ var _ = require('lodash'); | ||
if (part.title) content += this.onTitleStart(2) + this.onText(part.title) + this.onTitleEnd(2); | ||
content += this._summaryArticles(part.articles); | ||
@@ -128,0 +130,0 @@ content += this.onSection(); |
{ | ||
"name": "gitbook-html", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://www.gitbook.com", | ||
@@ -5,0 +5,0 @@ "description": "Parse HTML content for gitbook", |
@@ -16,4 +16,12 @@ var fs = require('fs'); | ||
it('should detect parts', function() { | ||
assert.equal(LEXED.parts.length, 3); | ||
describe('Parts', function() { | ||
it('should detect parts', function() { | ||
assert.equal(LEXED.parts.length, 3); | ||
}); | ||
it('should detect title', function() { | ||
assert.equal(LEXED.parts[0].title, ''); | ||
assert.equal(LEXED.parts[1].title, 'Part 2'); | ||
assert.equal(LEXED.parts[2].title, ''); | ||
}); | ||
}); | ||
@@ -25,2 +33,6 @@ | ||
it('should detect chapters in other parts', function() { | ||
assert.equal(LEXED.parts[1].articles.length, 1); | ||
}); | ||
it('should support articles', function() { | ||
@@ -27,0 +39,0 @@ assert.equal(PART.articles[0].articles.length, 2); |
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
17226
410