Skip to content

Commit

Permalink
remove support and testing for node 10
Browse files Browse the repository at this point in the history
change hide option
  • Loading branch information
mnater committed Sep 13, 2021
1 parent d196067 commit 0017229
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: node_js
cache: bundler
node_js:
- 10
- 12
- lts/*
- node
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Version History

## Version 5.0.0-beta-1 (2021-09-dd)
### Breaking changes
* The wasm modules internally use a succint trie data structure, memory layout has changed
* Use numbers instead of strings for hiding options
* Drop support for outdated (eol) node versions. Hyphenopoly.module now requires node >= 12


## Version 4.12.0 (2021-07-21)
### Fixed
* Fixed memory access out of bounds (#165)
Expand Down
2 changes: 1 addition & 1 deletion Hyphenopoly.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license Hyphenopoly 4.12.0 - client side hyphenation for webbrowsers
* @license Hyphenopoly 5.0.0-beta.1 - client side hyphenation for webbrowsers
* ©2021 Mathias Nater, Güttingen (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
Expand Down
2 changes: 1 addition & 1 deletion Hyphenopoly_Loader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license Hyphenopoly_Loader 4.12.0 - client side hyphenation
* @license Hyphenopoly_Loader 5.0.0-beta.1 - client side hyphenation
* ©2021 Mathias Nater, Güttingen (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
Expand Down
12 changes: 6 additions & 6 deletions docs/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ Words that contain a hyphen when unhyphenated should not be entered in the list.

### hide
````
type: string ("all" | "element" | "text")
default: "all"
type: number (0 | 1 | 2)
default: 0
````
Define if and how elements are made invisible while being hyphenated.
````html
Expand All @@ -199,16 +199,16 @@ var Hyphenopoly = {
require: {...},
paths: {...},
setup: {
hide: "element"
hide: 1
}
};
</script>
````
To prevent a flash of unhyphenated content (FOUHC) Hyphenopoly hides the elements being hyphenated. Depending on the structure of your page this can lead to visual flicker. You can change the way Hyphenopoly hides the content:

- `all` hides the whole page by inserting the following CSS-rule `html {visibility: hidden !important}`
- `element` hides the selected elements by inserting the following CSS-rule for each selector: `<selector> {visibility: hidden !important}`
- `text` hides only the text of the selected elements by inserting the following CSS-rule for each selector: `<selector> {color: transparent !important}`
- `0` hides the whole page by inserting the following CSS-rule `html {visibility: hidden !important}`
- `1` hides the selected elements by inserting the following CSS-rule for each selector: `<selector> {visibility: hidden !important}`
- `2` hides only the text of the selected elements by inserting the following CSS-rule for each selector: `<selector> {color: transparent !important}`
- any other keyword prevents hiding.

These CSS-rules are removed, when Hyphenopoly has finished its job or when the [timeout](#timeout) gets fired.
Expand Down
16 changes: 5 additions & 11 deletions hyphenopoly.module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license Hyphenopoly.module.js 4.12.0 - hyphenation for node
* @license Hyphenopoly.module.js 5.0.0-beta.1 - hyphenation for node
* ©2021 Mathias Nater, Güttingen (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
Expand All @@ -15,12 +15,9 @@
* in a browser environment (e.g. browserified)
*/
let loader = require("fs");
const TD = typeof TextDecoder === "undefined"
? require("util").TextDecoder
: TextDecoder;

const decode = (() => {
const utf16ledecoder = new TD("utf-16le");
const utf16ledecoder = new TextDecoder("utf-16le");
return (ui16) => {
return utf16ledecoder.decode(ui16);
};
Expand Down Expand Up @@ -291,8 +288,7 @@ function instantiateWasmEngine(lang) {
*/
function handleWasm(inst) {
const exp = inst.exports;
// eslint-disable-next-line multiline-ternary
let alphalen = (WebAssembly.Global) ? exp.lct.value : exp.lct;
let alphalen = exp.lct.value;
alphalen = registerSubstitutions(alphalen, exp);
prepareLanguagesObj(
lang,
Expand All @@ -301,10 +297,8 @@ function instantiateWasmEngine(lang) {
exp.hyphenate
),
decode(new Uint16Array(exp.mem.buffer, 1280, alphalen)),
/* eslint-disable multiline-ternary */
(WebAssembly.Global) ? exp.lmi.value : exp.lmi,
(WebAssembly.Global) ? exp.rmi.value : exp.rmi
/* eslint-enable multiline-ternary */
exp.lmi.value,
exp.rmi.value
);
}
if (H.c.sync) {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hyphenopoly",
"version": "4.12.0",
"version": "5.0.0-beta.1",
"description": "Hyphenation for node and Polyfill for client-side hyphenation.",
"keywords": [
"hyphenation",
Expand Down Expand Up @@ -34,7 +34,7 @@
],
"main": "hyphenopoly.module.js",
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -69,7 +69,7 @@
"createWasmForLang": "sh ./tools/createWasmForLang.sh en-us",
"createAllWasm": "sh ./tools/createAllWasm.sh",
"pretest": "npm run lint",
"test": "tap --branches=95 test/*.js",
"test": "tap --100 test/*.js",
"testsuite": "open http://127.0.0.1/~mnater/Hyphenopoly/testsuite/ && open http://127.0.0.1/~mnater/Hyphenopoly/min/testsuite/",
"lint": "eslint Hyphenopoly_Loader.js Hyphenopoly.js hyphenopoly.module.js test/*.js src/*.ts && remark -q *.md && remark -q */*.md",
"prepare": "sh ./tools/minify.sh",
Expand Down

0 comments on commit 0017229

Please sign in to comment.