@videinfra/static-website-builder 1.15.7 → 1.15.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.15.9] - 2025-09-10
|
|
8
|
+
- Added dashes to the "preposition_nbsp" TWIG filter
|
|
9
|
+
|
|
7
10
|
## [1.15.7] - 2025-07-31
|
|
8
11
|
### Added
|
|
9
12
|
- Optional chaining to the JS
|
package/package.json
CHANGED
|
@@ -10,6 +10,18 @@ const prepositions = [
|
|
|
10
10
|
const regexWordBoundary = '(?<=(^|[^\\p{L}]))';
|
|
11
11
|
const regexEscape = /[.*+?^${}()|[\]\\]/g;
|
|
12
12
|
|
|
13
|
+
const regexMdash = /\s+—/uig;
|
|
14
|
+
const regexNdash = /\s+–/uig;
|
|
15
|
+
const regexHyphen = /\s+-/uig; // actual hyphen from keyboard
|
|
16
|
+
const regexHyphen2 = /\s+‐/uig;
|
|
17
|
+
const regexFigureDash = /\s+‒/uig;
|
|
18
|
+
|
|
19
|
+
const regexMdashEntity = /\s+—/uig;
|
|
20
|
+
const regexNdashEntity = /\s+–/uig;
|
|
21
|
+
const regexHyphenEntity = /\s+-/uig;
|
|
22
|
+
const regexHyphen2Entity = /\s+‐/uig;
|
|
23
|
+
const regexFigureDashEntity = /\s+‒/uig;
|
|
24
|
+
|
|
13
25
|
let prepositionsRegex = null;
|
|
14
26
|
|
|
15
27
|
function escapeRegExp(string) {
|
|
@@ -22,7 +34,21 @@ function prepositionNbsp(text) {
|
|
|
22
34
|
prepositionsRegex = new RegExp(`${regexWordBoundary}(${prepositionsEscaped.join('|')})\\s+`, 'uig');
|
|
23
35
|
}
|
|
24
36
|
|
|
25
|
-
|
|
37
|
+
text = text.replace(prepositionsRegex, '$2 ');
|
|
38
|
+
|
|
39
|
+
text = text.replace(regexMdash, ' —', text);
|
|
40
|
+
text = text.replace(regexNdash, ' –', text);
|
|
41
|
+
text = text.replace(regexHyphen, ' -', text);
|
|
42
|
+
text = text.replace(regexHyphen2, ' ‐', text);
|
|
43
|
+
text = text.replace(regexFigureDash, ' ‒', text);
|
|
44
|
+
|
|
45
|
+
text = text.replace(regexMdashEntity, ' —', text);
|
|
46
|
+
text = text.replace(regexNdashEntity, ' –', text);
|
|
47
|
+
text = text.replace(regexHyphenEntity, ' -', text);
|
|
48
|
+
text = text.replace(regexHyphen2Entity, ' ‐', text);
|
|
49
|
+
text = text.replace(regexFigureDashEntity, ' ‒', text);
|
|
50
|
+
|
|
51
|
+
return text;
|
|
26
52
|
}
|
|
27
53
|
|
|
28
54
|
module.exports = prepositionNbsp;
|
package/tasks/env/get-env.js
CHANGED
|
@@ -26,7 +26,7 @@ function normalizeTwigVariable (value) {
|
|
|
26
26
|
function getEnvData () {
|
|
27
27
|
const envVariables = {};
|
|
28
28
|
const twigVariables = {};
|
|
29
|
-
const scssVariables = { env: {} };
|
|
29
|
+
const scssVariables = { env: { _tmp: 1 } }; // _tmp is used to avoid SCSS error if object is empty
|
|
30
30
|
const jsVariables = {};
|
|
31
31
|
const envOutVariables = {};
|
|
32
32
|
|
|
@@ -21,6 +21,20 @@ test('preposition_nbsp russian', () => {
|
|
|
21
21
|
expect(preposition_nbsp('ппппп before над дддд')).toEqual('ппппп before над дддд');
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
test('preposition_nbsp hyphens', () => {
|
|
25
|
+
expect(preposition_nbsp('hello — world')).toEqual('hello — world');
|
|
26
|
+
expect(preposition_nbsp('hello – world')).toEqual('hello – world');
|
|
27
|
+
expect(preposition_nbsp('hello - world')).toEqual('hello - world');
|
|
28
|
+
expect(preposition_nbsp('hello ‐ world')).toEqual('hello ‐ world');
|
|
29
|
+
expect(preposition_nbsp('hello ‒ world')).toEqual('hello ‒ world');
|
|
30
|
+
|
|
31
|
+
// Don't replace hyphens with entities if not needed
|
|
32
|
+
expect(preposition_nbsp('hello— world')).toEqual('hello— world');
|
|
33
|
+
|
|
34
|
+
// Hyphens + prepositions
|
|
35
|
+
expect(preposition_nbsp('hello ‒ at world')).toEqual('hello ‒ at world');
|
|
36
|
+
});
|
|
37
|
+
|
|
24
38
|
test('Preposition TWIG filter applied', () => {
|
|
25
39
|
return fsPromises.readFile(path.resolve(publicPath, 'preposition.html'), {'encoding': 'utf8'}).then((html) => {
|
|
26
40
|
expect(html).toBe('<html><body>hello at world</body></html>');
|