Skip to content

Commit

Permalink
Merge branch 'master' into flat_eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
mnater committed Jan 28, 2024
2 parents fbc66fc + 02c4770 commit 0cb2cdc
Show file tree
Hide file tree
Showing 456 changed files with 80,974 additions and 122,598 deletions.
13 changes: 13 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: hyphenopoly
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16 changes: 14 additions & 2 deletions .oldeslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"examples/webpack/src/*.js"
],
"plugins": [
"security"
"security", "html"
],
"extends": [
"eslint:all",
"plugin:security/recommended"
"plugin:security/recommended-legacy"
],
"rules": {
"no-undef": "error",
Expand Down Expand Up @@ -149,6 +149,18 @@
"parserOptions": {
"sourceType": "module"
}
},
{
"files": ["*.html"],
"globals": {
"Hyphenopoly": "readonly"
},
"rules": {
"complexity": 0,
"require-jsdoc": 0,
"strict": 0,
"sort-keys": 0
}
}
],
"reportUnusedDisableDirectives": true
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Version History

## Version 5.3.0 (2023-11-24)
### Added
* loader/loaderSync now has a second argument containing an URL to the patternDirectory (issue #207)
### Fixed
* simplify events and clarify in docs
* bump devDependencies

## Version 5.2.1 (2023-10-19)
### Fixed
* created and updated patterns for german
* bump devDependencies
### Test
* refactor testsuite: lint code

## Version 5.2.0 (2023-10-04)
### Fixed
* unhyphenate all childNodes (issue #205)
Expand Down
136 changes: 136 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people

* Being respectful of differing opinions, viewpoints, and experiences

* Giving and gracefully accepting constructive feedback

* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience

* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind

* Trolling, insulting or derogatory comments, and personal or political attacks

* Public or private harassment

* Publishing others' private information, such as a physical or email
address, without their explicit permission

* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.

[homepage]: https://www.contributor-covenant.org
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributing

The following is a set of guidelines for contributing to Hyphenopoly hosted on https://github.com/mnater/Hyphenopoly.

## Code of Conduct

https://github.com/mnater/Hyphenopoly/blob/master/CODE_OF_CONDUCT.md

## Filing Issues

Please don't hesitate to open a new issue on GitHub - questions, enhancement suggestions, bugs are equally welcome;-)

### How to submit a (good) issue

A good description helps to reproduce the issue and saves a lot of time. The following points are very helpful:

* Please check that the issue still exists in the latest version of the main branch.
* Please explain what happened and what you expected to see instead.
* Describe the exact steps to reproduce the problem.
* Code samples help a lot, please use [code blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/).

## Pull Requests
Pull requests are welcome. Please keep the code as small as possible, run the tests and check it with ESLint.

## All-Contributors
If I forgot to list you as a contributor, please send me a note.
79 changes: 24 additions & 55 deletions Hyphenopoly.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license Hyphenopoly 5.2.0 - client side hyphenation for webbrowsers
* ©2023 Mathias Nater, Güttingen (mathiasnater at gmail dot com)
* @license Hyphenopoly 5.3.0 - client side hyphenation for webbrowsers
* ©2024 Mathias Nater, Güttingen (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
* Released under the MIT license
Expand Down Expand Up @@ -41,7 +41,7 @@
});
}
return {
"fire": ((eventName, eventData) => {
"fire": ((eventName, eventData = {}) => {
eventData.runDefault = true;
eventData.preventDefault = () => {
eventData.runDefault = false;
Expand Down Expand Up @@ -212,12 +212,7 @@
const C = H.c;
let mainLanguage = null;

event.fire(
"hyphenopolyStart",
{
"msg": "hyphenopolyStart"
}
);
event.fire("hyphenopolyStart");

/**
* Factory for elements
Expand Down Expand Up @@ -263,14 +258,9 @@
list.delete(lang);
counter[0] -= langCount;
if (counter[0] === 0) {
event.fire(
"hyphenopolyEnd",
{
"msg": "hyphenopolyEnd"
}
);
event.fire("hyphenopolyEnd");
if (!C.keepAlive) {
window.Hyphenopoly = null;
w.Hyphenopoly = null;
}
}
}
Expand Down Expand Up @@ -430,27 +420,19 @@
* @returns {string} The hyphenated compound word
*/
function hyphenateCompound(word) {
const zeroWidthSpace = "\u200B";
let parts = null;
let wordHyphenator = null;
if (selSettings.compound === "auto" ||
selSettings.compound === "all") {
wordHyphenator = createWordHyphenator(lo, lang, sel);
parts = word.split("-").map((p) => {
if (p.length >= selSettings.minWordLength) {
return wordHyphenator(p);
}
return p;
});
if (selSettings.compound === "auto") {
word = parts.join("-");
} else {
word = parts.join("-" + zeroWidthSpace);
let joiner = "-";
const parts = word.split(joiner).map((p) => {
if (selSettings.compound !== "hyphen" &&
p.length >= selSettings.minWordLength) {
return createWordHyphenator(lo, lang, sel)(p);
}
} else {
word = word.replace("-", "-" + zeroWidthSpace);
return p;
});
if (selSettings.compound !== "auto") {
// Add Zero Width Space
joiner += "\u200B";
}
return word;
return parts.join(joiner);
}

/**
Expand Down Expand Up @@ -481,10 +463,10 @@
);
} else if (!selSettings.mixedCase && isMixedCase(word)) {
hw = word;
} else if (word.indexOf("-") === -1) {
hw = hyphenateNormal(word);
} else {
} else if (word.includes("-")) {
hw = hyphenateCompound(word);
} else {
hw = hyphenateNormal(word);
}
lo.cache.get(sel).set(word, hw);
}
Expand Down Expand Up @@ -690,14 +672,9 @@
if (elements.counter[0] === 0) {
w.clearTimeout(H.timeOutHandler);
H.hide(0, null);
event.fire(
"hyphenopolyEnd",
{
"msg": "hyphenopolyEnd"
}
);
event.fire("hyphenopolyEnd");
if (!C.keepAlive) {
window.Hyphenopoly = null;
w.Hyphenopoly = null;
}
}
}
Expand Down Expand Up @@ -774,12 +751,7 @@
"reNotAlphabet": RegExp(`[^${alphabet}]`, "i")
});
H.hy6ors.get(lang).resolve(createStringHyphenator(lang));
event.fire(
"engineReady",
{
lang
}
);
event.fire("engineReady", {lang});
if (H.res.els) {
hyphenateLangElements(lang, H.res.els);
}
Expand Down Expand Up @@ -823,7 +795,7 @@
* @returns {undefined}
*/
function instantiateWasmEngine(heProm, lang) {
const wa = window.WebAssembly;
const wa = w.WebAssembly;

/**
* Register character substitutions in the .wasm-hyphenEngine
Expand Down Expand Up @@ -854,7 +826,6 @@
*/
function handleWasm(res) {
const exp = res.instance.exports;
// eslint-disable-next-line multiline-ternary
let alphalen = (wa.Global) ? exp.lct.value : exp.lct;
alphalen = registerSubstitutions(alphalen, exp);
heProm.l.forEach((l) => {
Expand All @@ -865,10 +836,8 @@
exp.hyphenate
),
decode(new Uint16Array(exp.mem.buffer, 1664, alphalen)),
/* eslint-disable multiline-ternary */
(wa.Global) ? exp.lmi.value : exp.lmi,
(wa.Global) ? exp.rmi.value : exp.rmi
/* eslint-enable multiline-ternary */
);
});
}
Expand Down
Loading

0 comments on commit 0cb2cdc

Please sign in to comment.