@massimo-cassandro/minimo 1.40.1 → 1.40.2
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.
|
@@ -487,9 +487,10 @@ const config = {
|
|
|
487
487
|
// fileName: path.join(output_dir, 'manifest.json'), // NB: symfony -> fileName: 'manifest.json', // scrive in output.path
|
|
488
488
|
// // basePath: item.source_dirname
|
|
489
489
|
// // removeKeyHash: /\?.*$/, // /([a-f0-9]{32}\.?)/gi, // /(\?as_asset)$/,
|
|
490
|
-
// // rimuove i font
|
|
490
|
+
// // rimuove dal manifest i font non woff2 (non necessari, rendono il file inutilmente grande);
|
|
491
|
+
// // i woff2 restano per consentire il preload con asset() nei template sf
|
|
491
492
|
// filter: isDevelopment? undefined : (FileDescriptor) => {
|
|
492
|
-
// return
|
|
493
|
+
// return !/fonts/.test(FileDescriptor.path) || /\.woff2$/.test(FileDescriptor.path);
|
|
493
494
|
// },
|
|
494
495
|
// sort: isDevelopment? undefined : (a, b) => a.name.localeCompare(b.name)
|
|
495
496
|
// }),
|
package/package.json
CHANGED
|
@@ -41,6 +41,8 @@ const PARTICLE_CASING_MAP = new Map(PARTICELLE.map(term => [term.toLowerCase(),
|
|
|
41
41
|
* Improves a text string by fixing punctuation spacing, multiple spaces,
|
|
42
42
|
* typographic quotes, non-breaking spaces after Italian particles/articles,
|
|
43
43
|
* and optionally enforcing the exact casing of custom words.
|
|
44
|
+
* Particles are forced to their listed casing, except at the start of the text
|
|
45
|
+
* where their first letter is capitalized.
|
|
44
46
|
*
|
|
45
47
|
* @param {string} str - input string to process
|
|
46
48
|
* @param {string[]} [custom_words] - list of words whose exact casing must be preserved (e.g. `['iPhone', 'macOS']`) (default: [])
|
|
@@ -75,8 +77,14 @@ export function betterText(str, custom_words = []) {
|
|
|
75
77
|
return match.replace(/ +/g, '\u00A0');
|
|
76
78
|
});
|
|
77
79
|
|
|
78
|
-
// enforce exact casing of every particle in a single pass
|
|
79
|
-
|
|
80
|
+
// enforce exact casing of every particle in a single pass;
|
|
81
|
+
// a particle at the very start of the text (optionally after an opening quote) is capitalized
|
|
82
|
+
str = str.replace(PARTICLE_CASING_REGEX, (match, _p1, offset, whole) => {
|
|
83
|
+
const exact = PARTICLE_CASING_MAP.get(match.toLowerCase()) ?? match;
|
|
84
|
+
return /^[“‘]?$/.test(whole.slice(0, offset))
|
|
85
|
+
? exact.charAt(0).toUpperCase() + exact.slice(1)
|
|
86
|
+
: exact;
|
|
87
|
+
});
|
|
80
88
|
|
|
81
89
|
if(custom_words.length) {
|
|
82
90
|
custom_words.forEach(item => {
|