Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
mnater committed Jan 9, 2019
2 parents 32713e5 + 1a6125c commit f427c96
Show file tree
Hide file tree
Showing 15 changed files with 360 additions and 302 deletions.
74 changes: 35 additions & 39 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,55 @@
# Version History

## Version 2.6.1 (Jan 09, 2018)
* dontHyphenateClass is configurable (issue #48)
* fixed issue with StringDecoder in older node versions (issue #45)
* small refactorings for smaller codesize
* fixed a StateError in IE 11

## Version 2.6.0 (Dec 01, 2018)
* improve hiding of elements while hyphenating (issue #40)
* fix several issues with lang-fallbacks (issue #41 and #44)
* new feature: use selectors instead of classnames (issue #42)
* updated german patterns (issue #45)
* improve hiding of elements while hyphenating (issue #40)
* fix several issues with lang-fallbacks (issue #41 and #44)
* new feature: use selectors instead of classnames (issue #42)
* updated german patterns (issue #45)

## Version 2.5.1 (Nov 04, 2018)
* remove "Church Slavonic" patterns (see #38)
* fix issue #39
* remove "Church Slavonic" patterns (see #38)
* fix issue #39

## Version 2.5.0 (Oct 02, 2018)
### Hyphenopoly_Loader.js and Hyphenopoly.js:
* fix issues with very long word (#33 and #34)
* Hyphenopoly exposes [Hyphenators](https://github.com/mnater/Hyphenopoly/wiki/Hyphenators)

### hyphenopoly.module.js:
* fix issues with very long word (#33 and #34)
* hyphenopoly.module.js is now [easy to use with browserify](https://github.com/mnater/Hyphenopoly/wiki/browserify)
* fix issues with very long word (#33 and #34)
* Hyphenopoly exposes [Hyphenators](https://github.com/mnater/Hyphenopoly/wiki/Hyphenators)
* fix issues with very long word (#33 and #34)
* hyphenopoly.module.js is now [easy to use with browserify](https://github.com/mnater/Hyphenopoly/wiki/browserify)

## Version 2.4.0 (Sept 01, 2018)
### Hyphenopoly_Loader.js and Hyphenopoly.js:
* Implement fallback mechanism for language subtags where no patterns are available (e.g. en-au -> en-gb) [#29](https://github.com/mnater/Hyphenopoly/issues/29)
* updated patterns for Thai (https://github.com/hyphenation/tex-hyphen/pull/25)

### hyphenopoly.module.js:
* updated patterns for Thai (https://github.com/hyphenation/tex-hyphen/pull/25)
* Implement fallback mechanism for language subtags where no patterns are available (e.g. en-au -> en-gb) [#29](https://github.com/mnater/Hyphenopoly/issues/29)
* updated patterns for Thai [#25](https://github.com/hyphenation/tex-hyphen/pull/25)

## Version 2.3.0 (Juli 26, 2018)
### Hyphenopoly_Loader.js and Hyphenopoly.js:
* Don't use template strings [#28](https://github.com/mnater/Hyphenopoly/issues/28)
* run feature test for wasm support only if necessary

### hyphenopoly.module.js:
* define node >=8.3.0 as requirement (for util.TextDecoder)
* small refactorings
* Don't use template strings [#28](https://github.com/mnater/Hyphenopoly/issues/28)
* run feature test for wasm support only if necessary
* define node >=8.3.0 as requirement (for util.TextDecoder)
* small refactorings

## Version 2.2.0 (June 26, 2018)
* provide example.js for RunKit
* use tap instead of mocha
* [6f9e539](https://github.com/mnater/Hyphenopoly/commit/6f9e539a5dab2d1eff5bdeb0c7857c6fda9eb41e)
* bugfix: [#24](https://github.com/mnater/Hyphenopoly/issues/24): [aeefe6e](https://github.com/mnater/Hyphenopoly/commit/aeefe6e3a59e8356abc99ca490acabf6c3374d7b)
* provide example.js for RunKit
* use tap instead of mocha
* [6f9e539](https://github.com/mnater/Hyphenopoly/commit/6f9e539a5dab2d1eff5bdeb0c7857c6fda9eb41e)
* bugfix: [#24](https://github.com/mnater/Hyphenopoly/issues/24): [aeefe6e](https://github.com/mnater/Hyphenopoly/commit/aeefe6e3a59e8356abc99ca490acabf6c3374d7b)

## Version 2.1.0 (Mai 27, 2018)
* Configure Travis-CI
* bugfixes
* Configure Travis-CI
* bugfixes

## Version 2.0.0 (Mai 27, 2018)
* Provide node module (https://github.com/mnater/Hyphenopoly/wiki/Node-Module)
* default file locations better reflect usual installations [#19](https://github.com/mnater/Hyphenopoly/issues/19)
* Add ability to store results of feature tests (optional) [#22](https://github.com/mnater/Hyphenopoly/issues/22)
* better error handling (f4bbaa7759eed24208e5cd7c744f1131262abb20, 1c7b0b67666b507d6f6b02eea38460562a5835e4)
* correct implementation of e.preventDefault (df988788db6fb7120fc0c8a1cff1c91aac5a3998)
* fix string normalization (a3229f730f79ccdd3054cbac257b2345f5c8e11a)
* Better tooling: minify, eslint, testing (mocha), compiling (https://github.com/mnater/Hyphenopoly/wiki/Usage-of-devDependencies)
* Provide [node module](https://github.com/mnater/Hyphenopoly/wiki/Node-Module)
* default file locations better reflect usual installations [#19](https://github.com/mnater/Hyphenopoly/issues/19)
* Add ability to store results of feature tests (optional) [#22](https://github.com/mnater/Hyphenopoly/issues/22)
* better error handling (f4bbaa7759eed24208e5cd7c744f1131262abb20, 1c7b0b67666b507d6f6b02eea38460562a5835e4)
* correct implementation of e.preventDefault (df988788db6fb7120fc0c8a1cff1c91aac5a3998)
* fix string normalization (a3229f730f79ccdd3054cbac257b2345f5c8e11a)
* Better tooling: minify, eslint, testing (mocha), compiling [devDependencies](https://github.com/mnater/Hyphenopoly/wiki/Usage-of-devDependencies)

## Version 1.0.1 (Mai 13, 2018)
Prevent browsers to force layout on feature test in some cases.
Expand Down
77 changes: 21 additions & 56 deletions Hyphenopoly.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"defaultLanguage": setProp("en-us", 2),
"dontHyphenate": setProp((function createList() {
const r = empty();
const list = "video,audio,script,code,pre,img,br,samp,kbd,var,abbr,acronym,sub,sup,button,option,label,textarea,input,math,svg,style";
const list = "abbr,acronym,audio,br,button,code,img,input,kbd,label,math,option,pre,samp,script,style,sub,sup,svg,textarea,var,video";
list.split(",").forEach(function add(value) {
r[value] = true;
});
Expand Down Expand Up @@ -267,7 +267,7 @@
elements = makeElementCollection();

const dontHyphenateSelector = (function createSel() {
let s = ".donthyphenate";
let s = "." + H.c.dontHyphenateClass;
let k = null;
for (k in C.dontHyphenate) {
if (C.dontHyphenate[k]) {
Expand Down Expand Up @@ -349,8 +349,8 @@
let i = 0;
let wordHyphenator = null;
let hw = word;
switch (classSettings.compound) {
case "auto":
if (classSettings.compound === "auto" ||
classSettings.compound === "all") {
parts = word.split("-");
wordHyphenator = createWordHyphenator(lo, lang, sel);
while (i < parts.length) {
Expand All @@ -359,20 +359,12 @@
}
i += 1;
}
hw = parts.join("-");
break;
case "all":
parts = word.split("-");
wordHyphenator = createWordHyphenator(lo, lang, sel);
while (i < parts.length) {
if (parts[i].length >= classSettings.minWordLength) {
parts[i] = wordHyphenator(parts[i]);
}
i += 1;
if (classSettings.compound === "auto") {
hw = parts.join("-");
} else {
hw = parts.join("-" + zeroWidthSpace);
}
hw = parts.join("-" + zeroWidthSpace);
break;
default:
} else {
hw = word.replace("-", "-" + zeroWidthSpace);
}
return hw;
Expand Down Expand Up @@ -696,13 +688,7 @@
};
} else {
decoder = function (ui16) {
let i = 0;
let str = "";
while (i < ui16.length) {
str += String.fromCharCode(ui16[i]);
i += 1;
}
return str;
return String.fromCharCode.apply(null, ui16);
};
}
return decoder;
Expand Down Expand Up @@ -794,25 +780,6 @@
};
}

/**
* Create basic import Object
* @param {Object} baseData baseData
* @returns {Object} import object
*/
function createImportObject(baseData) {
return {
"hpbPatternsOffset": baseData.hpbPatternsOffset,
"hpbTranslateOffset": baseData.hpbTranslateOffset,
"hyphenatedWordOffset": baseData.hyphenatedWordOffset,
"hyphenPointsOffset": baseData.hyphenPointsOffset,
"patternsLength": baseData.patternsLength,
"patternTrieOffset": baseData.patternTrieOffset,
"translatedWordOffset": baseData.translatedWordOffset,
"valueStoreOffset": baseData.valueStoreOffset,
"wordOffset": baseData.wordOffset
};
}

/**
* Setup env for hyphenateFunction
* @param {Object} baseData baseData
Expand All @@ -832,7 +799,7 @@
);
const defLeftmin = baseData.leftmin;
const defRightmin = baseData.rightmin;
const hyphenatedWordStore = (new Uint16Array(heapBuffer)).subarray(
const hydWrdStore = (new Uint16Array(heapBuffer)).subarray(
hyphenatedWordOffset >> 1,
(hyphenatedWordOffset >> 1) + 128
);
Expand All @@ -855,12 +822,7 @@
wordStore[i + 2] = 95;

if (hyphenateFunc(leftmin, rightmin) === 1) {
i = 1;
word = "";
while (i < hyphenatedWordStore[0] + 1) {
word += String.fromCharCode(hyphenatedWordStore[i]);
i += 1;
}
word = decode(hydWrdStore.subarray(1, hydWrdStore[0] + 1));
if (hyphenchar !== "\u00AD") {
word = word.replace(/\u00AD/g, hyphenchar);
}
Expand Down Expand Up @@ -900,10 +862,10 @@
"memory": baseData.wasmMemory,
"memoryBase": 0
},
"ext": createImportObject(baseData)
"ext": baseData
}).then(
function runWasm(result) {
result.exports.convert();
const alphalen = result.exports.convert();
prepareLanguagesObj(
lang,
encloseHyphenateFunction(
Expand All @@ -912,7 +874,7 @@
),
decode(
(new Uint16Array(wasmMemory.buffer)).
subarray(384, 640)
subarray(385, 384 + alphalen)
),
baseData.leftmin,
baseData.rightmin
Expand Down Expand Up @@ -947,14 +909,17 @@
"Uint16Array": window.Uint16Array,
"Uint8Array": window.Uint8Array
},
createImportObject(baseData),
baseData,
baseData.heapBuffer
);
theHyphenEngine.convert();
const alphalen = theHyphenEngine.convert();
prepareLanguagesObj(
lang,
encloseHyphenateFunction(baseData, theHyphenEngine.hyphenate),
decode((new Uint16Array(heapBuffer)).subarray(384, 640)),
decode(
(new Uint16Array(heapBuffer)).
subarray(385, 384 + alphalen)
),
baseData.leftmin,
baseData.rightmin
);
Expand Down
Loading

0 comments on commit f427c96

Please sign in to comment.