Commit 2c60eee9 authored by Fred Chasen's avatar Fred Chasen

Fix hypenator output

parent 09c537d1
......@@ -56,7 +56,7 @@ Hyphenator.prototype.process = function (input, output, encoding, options) {
hyphenated = this.walk($doc, this.hyphenateText.bind(this), options);
if (output) {
this.output(contents, output, encoding);
this.output(hyphenated, output, encoding);
}
return hyphenated;
......
{
"name": "vivliostyle-electron",
"version": "0.0.6",
"version": "0.0.7",
"description": "Render Html to PDFs using Vivliostyle.js and Electron",
"repository": {
"type": "git",
......
......@@ -37,7 +37,7 @@ Hyphenator.prototype.process = function (input, output, encoding, options) {
hyphenated = this.walk($doc, this.hyphenateText.bind(this), options);
if (output) {
this.output(contents, output, encoding);
this.output(hyphenated, output, encoding);
}
return hyphenated;
......@@ -98,6 +98,7 @@ Hyphenator.prototype.baseTag = function($, inputPath, outputPath) {
$base.attr("href", "file://" + resolved + "/");
};
Hyphenator.prototype.walk = function($, doThis, options) {
......
......@@ -42,8 +42,12 @@ describe('Hyphenator', function() {
it('should process a valid inputPath', function() {
var inputPath = "./test/samples/wood/index.html";
var result = hyphenator.process(inputPath);
var hyphens = result.indexOf("\u00AD");
assert.equal(result.length, 8729);
// soft hyphens
assert(hyphens > -1, "Hypens have been added" );
});
it('should reject an invalid inputPath', function() {
......@@ -59,12 +63,26 @@ describe('Hyphenator', function() {
});
describe('#toDocument', function() {
var hyphenator = new Hyphenator();
it('should load xhtml and return it unchanged', function() {
var $doc = hyphenator.toDocument(XHTML);
assert.equal($doc('html').length, 1);
});
});
describe('#walk', function() {
var hyphenator = new Hyphenator();
it('should load xhtml and return it unchanged', function() {
var $doc = hyphenator.toDocument(XHTML);
var result = hyphenator.walk(XHTML, function(data){
var result = hyphenator.walk($doc, function(data){
return data;
}, {});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment