punctilio 0.2.2 → 0.3.0
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/README.md +44 -26
- package/dist/dashes.d.ts +11 -80
- package/dist/dashes.d.ts.map +1 -1
- package/dist/dashes.js +45 -120
- package/dist/dashes.js.map +1 -1
- package/dist/index.d.ts +26 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/quotes.d.ts +13 -0
- package/dist/quotes.d.ts.map +1 -1
- package/dist/quotes.js +48 -20
- package/dist/quotes.js.map +1 -1
- package/dist/symbols.js +2 -2
- package/dist/symbols.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,19 +6,34 @@ Smart typography transformations for JavaScript/TypeScript. Converts ASCII punct
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
| **Feature** | **Before** | **After** |
|
|
10
|
+
|---------|--------|-------|
|
|
11
|
+
| Smart quotes | "straight" | “curly” |
|
|
12
|
+
| | 'apostrophes' | ‘apostrophes’ |
|
|
13
|
+
| Em dashes | wait - why did you | wait—why did you |
|
|
14
|
+
| En dashes | 1-5 | 1–5 |
|
|
15
|
+
| | January-March | January–March |
|
|
16
|
+
| Minus signs | -5 | −5 (proper Unicode minus) |
|
|
17
|
+
| Ellipsis | ... | … |
|
|
18
|
+
| Multiplication | 5x5 | 5×5 |
|
|
19
|
+
| | 3*4 | 3×4 |
|
|
20
|
+
| Math symbols | != | ≠ |
|
|
21
|
+
| | +- | ± |
|
|
22
|
+
| | <= | ≤ |
|
|
23
|
+
| | >= | ≥ |
|
|
24
|
+
| | ~= | ≈ |
|
|
25
|
+
| Legal symbols | (c) | © |
|
|
26
|
+
| | (r) | ® |
|
|
27
|
+
| | (tm) | ™ |
|
|
28
|
+
| Arrows | -> | → |
|
|
29
|
+
| | <- | ← |
|
|
30
|
+
| | <-> | ↔ |
|
|
31
|
+
| Prime marks | 5'10" | 5′10″ |
|
|
32
|
+
| Fractions (optional) | 1/2 | ½ |
|
|
33
|
+
| | 3/4 | ¾ |
|
|
34
|
+
| Degrees (optional) | 20 C | 20 °C |
|
|
35
|
+
|
|
36
|
+
**Handles edge cases**: contractions, possessives, nested quotes, year abbreviations ('99), "rock 'n' roll"
|
|
22
37
|
|
|
23
38
|
## Why another typography library?
|
|
24
39
|
|
|
@@ -76,6 +91,14 @@ transform('Add 1/2 cup at 20 C', {
|
|
|
76
91
|
// Disable symbol transforms if you only want quotes/dashes
|
|
77
92
|
transform('5x5 = 25', { symbols: false })
|
|
78
93
|
// → 5x5 = 25 (unchanged)
|
|
94
|
+
|
|
95
|
+
// Punctuation style: american (default), british, or none
|
|
96
|
+
transform('"Hello".', { punctuationStyle: 'american' }) // → "Hello."
|
|
97
|
+
transform('"Hello."', { punctuationStyle: 'british' }) // → "Hello".
|
|
98
|
+
|
|
99
|
+
// Dash style: american (default), british, or none
|
|
100
|
+
transform('word - word', { dashStyle: 'american' }) // → word—word
|
|
101
|
+
transform('word - word', { dashStyle: 'british' }) // → word – word
|
|
79
102
|
```
|
|
80
103
|
|
|
81
104
|
### With HTML Element Boundaries
|
|
@@ -105,29 +128,24 @@ Applies all typography transformations. Options:
|
|
|
105
128
|
- `symbols`: Include symbol transforms (default: `true`)
|
|
106
129
|
- `fractions`: Convert common fractions like 1/2 → ½ (default: `false`)
|
|
107
130
|
- `degrees`: Convert temperature notation like 20 C → 20 °C (default: `false`)
|
|
131
|
+
- `punctuationStyle`: `"american"` (default) puts periods/commas inside quotes; `"british"` puts them outside; `"none"` leaves unchanged
|
|
132
|
+
- `dashStyle`: `"american"` (default) uses unspaced em dash (—); `"british"` uses spaced en dash ( – ); `"none"` skips dash conversion
|
|
108
133
|
|
|
109
134
|
### Quote Functions
|
|
110
135
|
|
|
111
136
|
#### `niceQuotes(text, options?)`
|
|
112
137
|
|
|
113
|
-
Converts straight quotes to curly quotes.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- Contractions: `don't` → `don't`
|
|
117
|
-
- Possessives: `dog's` → `dog's`
|
|
118
|
-
- Year abbreviations: `'99` → `'99`
|
|
119
|
-
- Special cases: `'n'` in "rock 'n' roll"
|
|
138
|
+
Converts straight quotes to curly quotes. Options: `separator`, `punctuationStyle`.
|
|
139
|
+
|
|
140
|
+
Handles: opening/closing quotes, contractions (`don't`), possessives (`dog's`), year abbreviations (`'99`), special cases (`'n'`).
|
|
120
141
|
|
|
121
142
|
### Dash Functions
|
|
122
143
|
|
|
123
144
|
#### `hyphenReplace(text, options?)`
|
|
124
145
|
|
|
125
|
-
Converts hyphens to proper dashes.
|
|
126
|
-
|
|
127
|
-
-
|
|
128
|
-
- En dashes for date ranges: `Jan-Mar` → `Jan–Mar`
|
|
129
|
-
- Minus signs: `-5` → `−5`
|
|
130
|
-
- Preserves: horizontal rules (`---`), compound words (`well-known`)
|
|
146
|
+
Converts hyphens to proper dashes. Options: `separator`, `dashStyle`.
|
|
147
|
+
|
|
148
|
+
Handles: em dashes (`word - word` → `word—word`), en dashes for ranges (`1-5` → `1–5`, `Jan-Mar` → `Jan–Mar`), minus signs (`-5` → `−5`). Preserves horizontal rules and compound words.
|
|
131
149
|
|
|
132
150
|
#### `enDashNumberRange(text, options?)`
|
|
133
151
|
|
package/dist/dashes.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Converts hyphens and dashes to typographically correct em-dashes,
|
|
5
5
|
* en-dashes, and minus signs based on context.
|
|
6
6
|
*/
|
|
7
|
+
export type DashStyle = "american" | "british" | "none";
|
|
7
8
|
export interface DashOptions {
|
|
8
9
|
/**
|
|
9
10
|
* A boundary marker character used when transforming text that spans
|
|
@@ -14,6 +15,16 @@ export interface DashOptions {
|
|
|
14
15
|
* Default: "\uE000" (Unicode Private Use Area)
|
|
15
16
|
*/
|
|
16
17
|
separator?: string;
|
|
18
|
+
/**
|
|
19
|
+
* How to style parenthetical dashes.
|
|
20
|
+
*
|
|
21
|
+
* - `"american"` (default): Unspaced em dash (word—word)
|
|
22
|
+
* - `"british"`: Spaced en dash (word – word)
|
|
23
|
+
* - `"none"`: Don't convert parenthetical dashes
|
|
24
|
+
*
|
|
25
|
+
* Default: "american"
|
|
26
|
+
*/
|
|
27
|
+
dashStyle?: DashStyle;
|
|
17
28
|
}
|
|
18
29
|
/**
|
|
19
30
|
* List of month names (full and abbreviated) for date range detection
|
|
@@ -21,98 +32,18 @@ export interface DashOptions {
|
|
|
21
32
|
export declare const months: string;
|
|
22
33
|
/**
|
|
23
34
|
* Replaces hyphens with en-dashes in number ranges.
|
|
24
|
-
*
|
|
25
|
-
* Handles:
|
|
26
|
-
* - Simple ranges: "1-5" → "1–5"
|
|
27
|
-
* - Page numbers: "p.206-207" → "p.206–207"
|
|
28
|
-
* - Dollar amounts: "$100-$200" → "$100–$200"
|
|
29
|
-
* - Comma-formatted numbers: "1,000-2,000" → "1,000–2,000"
|
|
30
|
-
*
|
|
31
|
-
* Does NOT replace:
|
|
32
|
-
* - Spaced ranges: "1 - 5" (ambiguous, could be subtraction)
|
|
33
|
-
* - Version numbers with decimals: "1.5-1.8"
|
|
34
|
-
*
|
|
35
|
-
* @param text - The text to transform
|
|
36
|
-
* @param options - Configuration options
|
|
37
|
-
* @returns The text with en-dashes in number ranges
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* enDashNumberRange("pages 10-15")
|
|
42
|
-
* // → "pages 10–15"
|
|
43
|
-
* ```
|
|
44
35
|
*/
|
|
45
36
|
export declare function enDashNumberRange(text: string, options?: DashOptions): string;
|
|
46
37
|
/**
|
|
47
38
|
* Replaces hyphens with en-dashes in month/date ranges.
|
|
48
|
-
*
|
|
49
|
-
* Handles full and abbreviated month names:
|
|
50
|
-
* - "January-March" → "January–March"
|
|
51
|
-
* - "Jan-Mar" → "Jan–Mar"
|
|
52
|
-
*
|
|
53
|
-
* @param text - The text to transform
|
|
54
|
-
* @param options - Configuration options
|
|
55
|
-
* @returns The text with en-dashes in date ranges
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* enDashDateRange("January-March 2024")
|
|
60
|
-
* // → "January–March 2024"
|
|
61
|
-
* ```
|
|
62
39
|
*/
|
|
63
40
|
export declare function enDashDateRange(text: string, options?: DashOptions): string;
|
|
64
41
|
/**
|
|
65
42
|
* Replaces hyphens with proper minus signs (−) in numerical contexts.
|
|
66
|
-
*
|
|
67
|
-
* Handles negative numbers at:
|
|
68
|
-
* - Start of string/line
|
|
69
|
-
* - After whitespace
|
|
70
|
-
* - After opening parenthesis
|
|
71
|
-
* - After opening quote
|
|
72
|
-
*
|
|
73
|
-
* @param text - The text to transform
|
|
74
|
-
* @param options - Configuration options
|
|
75
|
-
* @returns The text with minus signs
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* minusReplace("The temperature was -5 degrees")
|
|
80
|
-
* // → "The temperature was −5 degrees"
|
|
81
|
-
* ```
|
|
82
43
|
*/
|
|
83
44
|
export declare function minusReplace(text: string, options?: DashOptions): string;
|
|
84
45
|
/**
|
|
85
46
|
* Comprehensive dash replacement for typographic correctness.
|
|
86
|
-
*
|
|
87
|
-
* Applies multiple transformations:
|
|
88
|
-
* 1. Converts hyphens to minus signs in numerical contexts
|
|
89
|
-
* 2. Converts surrounded dashes (- or --) to em-dashes (—)
|
|
90
|
-
* 3. Removes spaces around em-dashes (per modern style)
|
|
91
|
-
* 4. Preserves space after em-dash at start of line
|
|
92
|
-
* 5. Adds space after em-dash following quotation marks
|
|
93
|
-
* 6. Converts number ranges to en-dashes (1-5 → 1–5)
|
|
94
|
-
* 7. Converts date ranges to en-dashes (Jan-Mar → Jan–Mar)
|
|
95
|
-
*
|
|
96
|
-
* Does NOT modify:
|
|
97
|
-
* - Horizontal rules (---)
|
|
98
|
-
* - Compound modifiers (well-known, browser-specific)
|
|
99
|
-
* - Hyphens in quoted blockquotes ("> - item")
|
|
100
|
-
*
|
|
101
|
-
* @param text - The text to transform
|
|
102
|
-
* @param options - Configuration options
|
|
103
|
-
* @returns The text with proper dashes
|
|
104
|
-
*
|
|
105
|
-
* @example
|
|
106
|
-
* ```ts
|
|
107
|
-
* hyphenReplace("This is a - test")
|
|
108
|
-
* // → "This is a—test"
|
|
109
|
-
*
|
|
110
|
-
* hyphenReplace("Since--as you know")
|
|
111
|
-
* // → "Since—as you know"
|
|
112
|
-
*
|
|
113
|
-
* hyphenReplace("Pages 1-5")
|
|
114
|
-
* // → "Pages 1–5"
|
|
115
|
-
* ```
|
|
116
47
|
*/
|
|
117
48
|
export declare function hyphenReplace(text: string, options?: DashOptions): string;
|
|
118
49
|
//# sourceMappingURL=dashes.d.ts.map
|
package/dist/dashes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashes.d.ts","sourceRoot":"","sources":["../src/dashes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,WAAW;IAC1B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"dashes.d.ts","sourceRoot":"","sources":["../src/dashes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;AAEvD,MAAM,WAAW,WAAW;IAC1B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAID;;GAEG;AACH,eAAO,MAAM,MAAM,QAKR,CAAA;AAEX;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CASjF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAM/E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAI5E;AAuDD;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAe7E"}
|
package/dist/dashes.js
CHANGED
|
@@ -10,53 +10,13 @@ const { EN_DASH, EM_DASH, MINUS } = UNICODE_SYMBOLS;
|
|
|
10
10
|
* List of month names (full and abbreviated) for date range detection
|
|
11
11
|
*/
|
|
12
12
|
export const months = [
|
|
13
|
-
"January",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"May",
|
|
18
|
-
"June",
|
|
19
|
-
"July",
|
|
20
|
-
"August",
|
|
21
|
-
"September",
|
|
22
|
-
"October",
|
|
23
|
-
"November",
|
|
24
|
-
"December",
|
|
25
|
-
"Jan",
|
|
26
|
-
"Feb",
|
|
27
|
-
"Mar",
|
|
28
|
-
"Apr",
|
|
29
|
-
"May",
|
|
30
|
-
"Jun",
|
|
31
|
-
"Jul",
|
|
32
|
-
"Aug",
|
|
33
|
-
"Sep",
|
|
34
|
-
"Oct",
|
|
35
|
-
"Nov",
|
|
36
|
-
"Dec",
|
|
13
|
+
"January", "February", "March", "April", "May", "June",
|
|
14
|
+
"July", "August", "September", "October", "November", "December",
|
|
15
|
+
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
|
16
|
+
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
|
|
37
17
|
].join("|");
|
|
38
18
|
/**
|
|
39
19
|
* Replaces hyphens with en-dashes in number ranges.
|
|
40
|
-
*
|
|
41
|
-
* Handles:
|
|
42
|
-
* - Simple ranges: "1-5" → "1–5"
|
|
43
|
-
* - Page numbers: "p.206-207" → "p.206–207"
|
|
44
|
-
* - Dollar amounts: "$100-$200" → "$100–$200"
|
|
45
|
-
* - Comma-formatted numbers: "1,000-2,000" → "1,000–2,000"
|
|
46
|
-
*
|
|
47
|
-
* Does NOT replace:
|
|
48
|
-
* - Spaced ranges: "1 - 5" (ambiguous, could be subtraction)
|
|
49
|
-
* - Version numbers with decimals: "1.5-1.8"
|
|
50
|
-
*
|
|
51
|
-
* @param text - The text to transform
|
|
52
|
-
* @param options - Configuration options
|
|
53
|
-
* @returns The text with en-dashes in number ranges
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* enDashNumberRange("pages 10-15")
|
|
58
|
-
* // → "pages 10–15"
|
|
59
|
-
* ```
|
|
60
20
|
*/
|
|
61
21
|
export function enDashNumberRange(text, options = {}) {
|
|
62
22
|
const chr = options.separator ?? DEFAULT_SEPARATOR;
|
|
@@ -64,20 +24,6 @@ export function enDashNumberRange(text, options = {}) {
|
|
|
64
24
|
}
|
|
65
25
|
/**
|
|
66
26
|
* Replaces hyphens with en-dashes in month/date ranges.
|
|
67
|
-
*
|
|
68
|
-
* Handles full and abbreviated month names:
|
|
69
|
-
* - "January-March" → "January–March"
|
|
70
|
-
* - "Jan-Mar" → "Jan–Mar"
|
|
71
|
-
*
|
|
72
|
-
* @param text - The text to transform
|
|
73
|
-
* @param options - Configuration options
|
|
74
|
-
* @returns The text with en-dashes in date ranges
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```ts
|
|
78
|
-
* enDashDateRange("January-March 2024")
|
|
79
|
-
* // → "January–March 2024"
|
|
80
|
-
* ```
|
|
81
27
|
*/
|
|
82
28
|
export function enDashDateRange(text, options = {}) {
|
|
83
29
|
const chr = options.separator ?? DEFAULT_SEPARATOR;
|
|
@@ -85,79 +31,58 @@ export function enDashDateRange(text, options = {}) {
|
|
|
85
31
|
}
|
|
86
32
|
/**
|
|
87
33
|
* Replaces hyphens with proper minus signs (−) in numerical contexts.
|
|
88
|
-
*
|
|
89
|
-
* Handles negative numbers at:
|
|
90
|
-
* - Start of string/line
|
|
91
|
-
* - After whitespace
|
|
92
|
-
* - After opening parenthesis
|
|
93
|
-
* - After opening quote
|
|
94
|
-
*
|
|
95
|
-
* @param text - The text to transform
|
|
96
|
-
* @param options - Configuration options
|
|
97
|
-
* @returns The text with minus signs
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```ts
|
|
101
|
-
* minusReplace("The temperature was -5 degrees")
|
|
102
|
-
* // → "The temperature was −5 degrees"
|
|
103
|
-
* ```
|
|
104
34
|
*/
|
|
105
35
|
export function minusReplace(text, options = {}) {
|
|
106
36
|
const chr = options.separator ?? DEFAULT_SEPARATOR;
|
|
107
37
|
const minusRegex = new RegExp(`(^|[\\s\\(${chr}""])-(\\s?\\d*\\.?\\d+)`, "gm");
|
|
108
38
|
return text.replaceAll(minusRegex, `$1${MINUS}$2`);
|
|
109
39
|
}
|
|
40
|
+
/** Convert surrounded dashes and multiple dashes to em/en dashes */
|
|
41
|
+
function convertParentheticalDashes(text, sep, style) {
|
|
42
|
+
if (style === "none")
|
|
43
|
+
return text;
|
|
44
|
+
const dash = style === "british" ? EN_DASH : EM_DASH;
|
|
45
|
+
const spaced = style === "british";
|
|
46
|
+
// Handle dashes with potential spaces
|
|
47
|
+
const preDash = new RegExp(`((?<markerBeforeTwo>${sep}?)[ ]+|(?<markerBeforeThree>${sep}))`);
|
|
48
|
+
const surroundedDash = new RegExp(`(?<=[^\\s>]|^)${preDash.source}[~${EN_DASH}${EM_DASH}-]+[ ]*(?<markerAfter>${sep}?)([ ]+|$)`, "g");
|
|
49
|
+
const replacement = spaced
|
|
50
|
+
? `$<markerBeforeTwo>$<markerBeforeThree> ${dash} $<markerAfter>`
|
|
51
|
+
: `$<markerBeforeTwo>$<markerBeforeThree>${dash}$<markerAfter>`;
|
|
52
|
+
text = text.replace(surroundedDash, replacement);
|
|
53
|
+
// Handle multiple dashes within words (e.g., since--as)
|
|
54
|
+
const multipleDashInWords = new RegExp(`(?<=[A-Za-z\\d])(?<markerBefore>${sep}?)[~${EN_DASH}${EM_DASH}-]{2,}(?<markerAfter>${sep}?)(?=[A-Za-z\\d ])`, "g");
|
|
55
|
+
const multiReplacement = spaced
|
|
56
|
+
? `$<markerBefore> ${dash} $<markerAfter>`
|
|
57
|
+
: `$<markerBefore>${dash}$<markerAfter>`;
|
|
58
|
+
text = text.replace(multipleDashInWords, multiReplacement);
|
|
59
|
+
// Handle dashes at start of line
|
|
60
|
+
text = text.replace(new RegExp(`^(${sep})?[-]+ `, "gm"), `$1${dash} `);
|
|
61
|
+
return text;
|
|
62
|
+
}
|
|
63
|
+
/** Normalize spacing around em dashes for American style */
|
|
64
|
+
function normalizeEmDashSpacing(text, sep) {
|
|
65
|
+
const spacesAroundEM = new RegExp(`(?<markerBefore>${sep}?)[ ]*${EM_DASH}[ ]*(?<markerAfter>${sep}?)[ ]*`, "g");
|
|
66
|
+
text = text.replace(spacesAroundEM, `$<markerBefore>${EM_DASH}$<markerAfter>`);
|
|
67
|
+
// Add space after em dash following quotation marks
|
|
68
|
+
const postQuote = new RegExp(`(?<quote>[.!?]${sep}?['"'"]${sep}?|…)${spacesAroundEM.source}`, "g");
|
|
69
|
+
text = text.replace(postQuote, `$<quote> $<markerBefore>${EM_DASH}$<markerAfter> `);
|
|
70
|
+
// Preserve space after em dash at start of line
|
|
71
|
+
const startOfLine = new RegExp(`^${spacesAroundEM.source}(?<after>[A-Z0-9])`, "gm");
|
|
72
|
+
text = text.replace(startOfLine, `$<markerBefore>${EM_DASH}$<markerAfter> $<after>`);
|
|
73
|
+
return text;
|
|
74
|
+
}
|
|
110
75
|
/**
|
|
111
76
|
* Comprehensive dash replacement for typographic correctness.
|
|
112
|
-
*
|
|
113
|
-
* Applies multiple transformations:
|
|
114
|
-
* 1. Converts hyphens to minus signs in numerical contexts
|
|
115
|
-
* 2. Converts surrounded dashes (- or --) to em-dashes (—)
|
|
116
|
-
* 3. Removes spaces around em-dashes (per modern style)
|
|
117
|
-
* 4. Preserves space after em-dash at start of line
|
|
118
|
-
* 5. Adds space after em-dash following quotation marks
|
|
119
|
-
* 6. Converts number ranges to en-dashes (1-5 → 1–5)
|
|
120
|
-
* 7. Converts date ranges to en-dashes (Jan-Mar → Jan–Mar)
|
|
121
|
-
*
|
|
122
|
-
* Does NOT modify:
|
|
123
|
-
* - Horizontal rules (---)
|
|
124
|
-
* - Compound modifiers (well-known, browser-specific)
|
|
125
|
-
* - Hyphens in quoted blockquotes ("> - item")
|
|
126
|
-
*
|
|
127
|
-
* @param text - The text to transform
|
|
128
|
-
* @param options - Configuration options
|
|
129
|
-
* @returns The text with proper dashes
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* hyphenReplace("This is a - test")
|
|
134
|
-
* // → "This is a—test"
|
|
135
|
-
*
|
|
136
|
-
* hyphenReplace("Since--as you know")
|
|
137
|
-
* // → "Since—as you know"
|
|
138
|
-
*
|
|
139
|
-
* hyphenReplace("Pages 1-5")
|
|
140
|
-
* // → "Pages 1–5"
|
|
141
|
-
* ```
|
|
142
77
|
*/
|
|
143
78
|
export function hyphenReplace(text, options = {}) {
|
|
144
|
-
const
|
|
79
|
+
const sep = options.separator ?? DEFAULT_SEPARATOR;
|
|
80
|
+
const dashStyle = options.dashStyle ?? "american";
|
|
145
81
|
text = minusReplace(text, options);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const surroundedDash = new RegExp(`(?<=[^\\s>]|^)${preDash.source}[~${EN_DASH}${EM_DASH}-]+[ ]*(?<markerAfter>${chr}?)([ ]+|$)`, "g");
|
|
151
|
-
text = text.replace(surroundedDash, `$<markerBeforeTwo>$<markerBeforeThree>${EM_DASH}$<markerAfter>`);
|
|
152
|
-
const multipleDashInWords = new RegExp(`(?<=[A-Za-z\\d])(?<markerBefore>${chr}?)[~${EN_DASH}${EM_DASH}-]{2,}(?<markerAfter>${chr}?)(?=[A-Za-z\\d ])`, "g");
|
|
153
|
-
text = text.replace(multipleDashInWords, `$<markerBefore>${EM_DASH}$<markerAfter>`);
|
|
154
|
-
text = text.replace(new RegExp(`^(${chr})?[-]+ `, "gm"), `$1${EM_DASH} `);
|
|
155
|
-
const spacesAroundEM = new RegExp(`(?<markerBefore>${chr}?)[ ]*${EM_DASH}[ ]*(?<markerAfter>${chr}?)[ ]*`, "g");
|
|
156
|
-
text = text.replace(spacesAroundEM, `$<markerBefore>${EM_DASH}$<markerAfter>`);
|
|
157
|
-
const postQuote = new RegExp(`(?<quote>[.!?]${chr}?['"'"]${chr}?|…)${spacesAroundEM.source}`, "g");
|
|
158
|
-
text = text.replace(postQuote, `$<quote> $<markerBefore>${EM_DASH}$<markerAfter> `);
|
|
159
|
-
const startOfLine = new RegExp(`^${spacesAroundEM.source}(?<after>[A-Z0-9])`, "gm");
|
|
160
|
-
text = text.replace(startOfLine, `$<markerBefore>${EM_DASH}$<markerAfter> $<after>`);
|
|
82
|
+
text = convertParentheticalDashes(text, sep, dashStyle);
|
|
83
|
+
if (dashStyle === "american") {
|
|
84
|
+
text = normalizeEmDashSpacing(text, sep);
|
|
85
|
+
}
|
|
161
86
|
text = enDashNumberRange(text, options);
|
|
162
87
|
text = enDashDateRange(text, options);
|
|
163
88
|
return text;
|
package/dist/dashes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashes.js","sourceRoot":"","sources":["../src/dashes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"dashes.js","sourceRoot":"","sources":["../src/dashes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB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,IAAI,GAAG,sBAAsB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC1C,CAAC;IAED,IAAI,GAAG,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACvC,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAErC,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
export { niceQuotes, type QuoteOptions } from "./quotes.js";
|
|
11
|
-
|
|
10
|
+
export { niceQuotes, type QuoteOptions, type PunctuationStyle } from "./quotes.js";
|
|
11
|
+
import type { PunctuationStyle } from "./quotes.js";
|
|
12
|
+
export { hyphenReplace, enDashNumberRange, enDashDateRange, minusReplace, months, type DashOptions, type DashStyle, } from "./dashes.js";
|
|
13
|
+
import type { DashStyle } from "./dashes.js";
|
|
12
14
|
export { ellipsis, multiplication, mathSymbols, legalSymbols, arrows, degrees, fractions, primeMarks, symbolTransform, type SymbolOptions, } from "./symbols.js";
|
|
13
15
|
export interface TransformOptions {
|
|
14
16
|
/**
|
|
@@ -35,6 +37,28 @@ export interface TransformOptions {
|
|
|
35
37
|
* Default: false (can be aggressive)
|
|
36
38
|
*/
|
|
37
39
|
degrees?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* How to handle punctuation placement around quotation marks.
|
|
42
|
+
*
|
|
43
|
+
* - `"american"` (default): Periods and commas go inside quotes
|
|
44
|
+
* Example: "Hello." and "Hello,"
|
|
45
|
+
* - `"british"`: Periods and commas go outside quotes
|
|
46
|
+
* Example: "Hello". and "Hello",
|
|
47
|
+
* - `"none"`: Don't modify punctuation placement
|
|
48
|
+
*
|
|
49
|
+
* Default: "american"
|
|
50
|
+
*/
|
|
51
|
+
punctuationStyle?: PunctuationStyle;
|
|
52
|
+
/**
|
|
53
|
+
* How to style parenthetical dashes.
|
|
54
|
+
*
|
|
55
|
+
* - `"american"` (default): Unspaced em dash (word—word)
|
|
56
|
+
* - `"british"`: Spaced en dash (word – word)
|
|
57
|
+
* - `"none"`: Don't convert parenthetical dashes
|
|
58
|
+
*
|
|
59
|
+
* Default: "american"
|
|
60
|
+
*/
|
|
61
|
+
dashStyle?: DashStyle;
|
|
38
62
|
}
|
|
39
63
|
/**
|
|
40
64
|
* Applies all typography transformations: smart quotes, proper dashes,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,KAAK,WAAW,EAChB,KAAK,SAAS,GACf,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,QAAQ,EACR,cAAc,EACd,WAAW,EACX,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,eAAe,EACf,KAAK,aAAa,GACnB,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IAEnC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,MAAM,CAoB9E;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAA4C,MAAM,aAAa,CAAA;AAElF,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,MAAM,GAGP,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,QAAQ,EACR,cAAc,EACd,WAAW,EACX,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,eAAe,GAEhB,MAAM,cAAc,CAAA;AAwDrB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,SAAS,IAAI,kBAAkB,EAAE,OAAO,IAAI,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAExH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,UAA4B,EAAE;IACpE,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,aAAa,EAAE,GAAG,OAAO,CAAA;IAExF,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IACzC,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IACtC,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IAEtC,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,GAAG,eAAe,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IAC7C,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAA;IAC/B,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAA"}
|
package/dist/quotes.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Converts straight quotes to typographically correct curly quotes,
|
|
5
5
|
* handling contractions, possessives, and nested quotes.
|
|
6
6
|
*/
|
|
7
|
+
export type PunctuationStyle = "american" | "british" | "none";
|
|
7
8
|
export interface QuoteOptions {
|
|
8
9
|
/**
|
|
9
10
|
* A boundary marker character used when transforming text that spans
|
|
@@ -15,6 +16,18 @@ export interface QuoteOptions {
|
|
|
15
16
|
* Default: "\uE000" (Unicode Private Use Area)
|
|
16
17
|
*/
|
|
17
18
|
separator?: string;
|
|
19
|
+
/**
|
|
20
|
+
* How to handle punctuation placement around quotation marks.
|
|
21
|
+
*
|
|
22
|
+
* - `"american"` (default): Periods and commas go inside quotes
|
|
23
|
+
* Example: "Hello." and "Hello,"
|
|
24
|
+
* - `"british"`: Periods and commas go outside quotes
|
|
25
|
+
* Example: "Hello". and "Hello",
|
|
26
|
+
* - `"none"`: Don't modify punctuation placement
|
|
27
|
+
*
|
|
28
|
+
* Default: "american"
|
|
29
|
+
*/
|
|
30
|
+
punctuationStyle?: PunctuationStyle;
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
20
33
|
* Converts standard quotes to typographic smart quotes.
|
package/dist/quotes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../src/quotes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"quotes.d.ts","sourceRoot":"","sources":["../src/quotes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;AAE9D,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AA+ED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,MAAM,CAS3E"}
|
package/dist/quotes.js
CHANGED
|
@@ -6,38 +6,66 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { UNICODE_SYMBOLS, DEFAULT_SEPARATOR } from "./constants.js";
|
|
8
8
|
const { EM_DASH, LEFT_DOUBLE_QUOTE, RIGHT_DOUBLE_QUOTE, LEFT_SINGLE_QUOTE, RIGHT_SINGLE_QUOTE, ELLIPSIS, } = UNICODE_SYMBOLS;
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @param text - The text to transform
|
|
13
|
-
* @param options - Configuration options
|
|
14
|
-
* @returns The text with smart quotes
|
|
15
|
-
*/
|
|
16
|
-
export function niceQuotes(text, options = {}) {
|
|
17
|
-
const chr = options.separator ?? DEFAULT_SEPARATOR;
|
|
9
|
+
/** Convert straight single quotes to curly quotes and apostrophes */
|
|
10
|
+
function convertSingleQuotes(text, sep) {
|
|
18
11
|
const afterEndingSinglePatterns = `\\s\\.!?;,\\)${EM_DASH}\\-\\]"`;
|
|
19
|
-
const afterEndingSingle = `(?=${
|
|
12
|
+
const afterEndingSingle = `(?=${sep}?(?:s${sep}?)?(?:[${afterEndingSinglePatterns}]|$))`;
|
|
20
13
|
const endingSingle = `(?<=[^\\s${LEFT_DOUBLE_QUOTE}'])[']${afterEndingSingle}`;
|
|
21
14
|
text = text.replace(new RegExp(endingSingle, "gm"), RIGHT_SINGLE_QUOTE);
|
|
22
|
-
const contraction = `(?<=[A-Za-z])['${RIGHT_SINGLE_QUOTE}](?=${
|
|
15
|
+
const contraction = `(?<=[A-Za-z])['${RIGHT_SINGLE_QUOTE}](?=${sep}?[a-zA-Z])`;
|
|
23
16
|
text = text.replace(new RegExp(contraction, "gm"), RIGHT_SINGLE_QUOTE);
|
|
24
17
|
const apostropheWhitelist = `(?=n${RIGHT_SINGLE_QUOTE} )`;
|
|
25
18
|
const endQuoteNotContraction = `(?!${contraction})${RIGHT_SINGLE_QUOTE}${afterEndingSingle}`;
|
|
26
19
|
const apostropheRegex = new RegExp(`(?<=^|[^\\w])'(${apostropheWhitelist}|(?![^${LEFT_SINGLE_QUOTE}'\\n]*${endQuoteNotContraction}))`, "gm");
|
|
27
20
|
text = text.replace(apostropheRegex, RIGHT_SINGLE_QUOTE);
|
|
28
|
-
const beginningSingle = `((?:^|[\\s${LEFT_DOUBLE_QUOTE}${RIGHT_DOUBLE_QUOTE}\\-\\(])${
|
|
21
|
+
const beginningSingle = `((?:^|[\\s${LEFT_DOUBLE_QUOTE}${RIGHT_DOUBLE_QUOTE}\\-\\(])${sep}?)['](?=${sep}?\\S)`;
|
|
29
22
|
text = text.replace(new RegExp(beginningSingle, "gm"), `$1${LEFT_SINGLE_QUOTE}`);
|
|
30
|
-
|
|
23
|
+
return text;
|
|
24
|
+
}
|
|
25
|
+
/** Convert straight double quotes to curly quotes */
|
|
26
|
+
function convertDoubleQuotes(text, sep) {
|
|
27
|
+
const beginningDouble = new RegExp(`(?<=^|[\\s\\(\\/\\[\\{\\-${EM_DASH}${sep}])(?<beforeChr>${sep}?)["](?<afterChr>(${sep}[ .,])|(?=${sep}?\\.{3}|${sep}?[^\\s\\)\\${EM_DASH},!?${sep};:.\\}]))`, "gm");
|
|
31
28
|
text = text.replace(beginningDouble, `$<beforeChr>${LEFT_DOUBLE_QUOTE}$<afterChr>`);
|
|
32
|
-
text = text.replace(new RegExp(`(?<=\\{)(${
|
|
33
|
-
const endingDouble = `([^\\s\\(])["](${
|
|
29
|
+
text = text.replace(new RegExp(`(?<=\\{)(${sep}? )?["]`, "g"), `$1${LEFT_DOUBLE_QUOTE}`);
|
|
30
|
+
const endingDouble = `([^\\s\\(])["](${sep}?)(?=${sep}|[\\s/\\).,;${EM_DASH}:\\-\\}!?s]|$)`;
|
|
34
31
|
text = text.replace(new RegExp(endingDouble, "g"), `$1${RIGHT_DOUBLE_QUOTE}$2`);
|
|
35
|
-
text = text.replace(new RegExp(`["](${
|
|
32
|
+
text = text.replace(new RegExp(`["](${sep}?)$`, "g"), `${RIGHT_DOUBLE_QUOTE}$1`);
|
|
36
33
|
text = text.replace(new RegExp(`'(?=${RIGHT_DOUBLE_QUOTE})`, "gu"), RIGHT_SINGLE_QUOTE);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
return text;
|
|
35
|
+
}
|
|
36
|
+
/** Apply American or British punctuation style */
|
|
37
|
+
function applyPunctuationStyle(text, sep, style) {
|
|
38
|
+
if (style === "american") {
|
|
39
|
+
// Period outside → inside: "Hello". → "Hello."
|
|
40
|
+
const periodOutsideRegex = new RegExp(`(?<![!?:\\.${ELLIPSIS}])(${sep}?)([${RIGHT_SINGLE_QUOTE}${RIGHT_DOUBLE_QUOTE}])(${sep}?)(?!\\.\\.\\.)\\.`, "g");
|
|
41
|
+
text = text.replace(periodOutsideRegex, "$1.$2$3");
|
|
42
|
+
// Comma outside → inside: "Hello", → "Hello,"
|
|
43
|
+
const commaOutsideRegex = new RegExp(`(${sep}?)([${RIGHT_SINGLE_QUOTE}${RIGHT_DOUBLE_QUOTE}])(${sep}?),`, "g");
|
|
44
|
+
text = text.replace(commaOutsideRegex, "$1,$2$3");
|
|
45
|
+
}
|
|
46
|
+
else if (style === "british") {
|
|
47
|
+
// Period inside → outside: "Hello." → "Hello".
|
|
48
|
+
const periodInsideRegex = new RegExp(`(?<![!?:\\.${ELLIPSIS}])(${sep}?)\\.(${sep}?)([${RIGHT_SINGLE_QUOTE}${RIGHT_DOUBLE_QUOTE}])`, "g");
|
|
49
|
+
text = text.replace(periodInsideRegex, "$1$2$3.");
|
|
50
|
+
// Comma inside → outside: "Hello," → "Hello",
|
|
51
|
+
const commaInsideRegex = new RegExp(`(?<![!?]),(${sep}?[${RIGHT_DOUBLE_QUOTE}${RIGHT_SINGLE_QUOTE}])`, "g");
|
|
52
|
+
text = text.replace(commaInsideRegex, "$1,");
|
|
53
|
+
}
|
|
54
|
+
return text;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Converts standard quotes to typographic smart quotes.
|
|
58
|
+
*
|
|
59
|
+
* @param text - The text to transform
|
|
60
|
+
* @param options - Configuration options
|
|
61
|
+
* @returns The text with smart quotes
|
|
62
|
+
*/
|
|
63
|
+
export function niceQuotes(text, options = {}) {
|
|
64
|
+
const sep = options.separator ?? DEFAULT_SEPARATOR;
|
|
65
|
+
const punctuationStyle = options.punctuationStyle ?? "american";
|
|
66
|
+
text = convertSingleQuotes(text, sep);
|
|
67
|
+
text = convertDoubleQuotes(text, sep);
|
|
68
|
+
text = applyPunctuationStyle(text, sep, punctuationStyle);
|
|
41
69
|
return text;
|
|
42
70
|
}
|
|
43
71
|
//# sourceMappingURL=quotes.js.map
|
package/dist/quotes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quotes.js","sourceRoot":"","sources":["../src/quotes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEnE,MAAM,EACJ,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,GACT,GAAG,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"quotes.js","sourceRoot":"","sources":["../src/quotes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEnE,MAAM,EACJ,OAAO,EACP,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,QAAQ,GACT,GAAG,eAAe,CAAA;AA8BnB,qEAAqE;AACrE,SAAS,mBAAmB,CAAC,IAAY,EAAE,GAAW;IACpD,MAAM,yBAAyB,GAAG,gBAAgB,OAAO,SAAS,CAAA;IAClE,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,yBAAyB,OAAO,CAAA;IACxF,MAAM,YAAY,GAAG,YAAY,iBAAiB,SAAS,iBAAiB,EAAE,CAAA;IAC9E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAA;IAEvE,MAAM,WAAW,GAAG,kBAAkB,kBAAkB,OAAO,GAAG,YAAY,CAAA;IAC9E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,kBAAkB,CAAC,CAAA;IAEtE,MAAM,mBAAmB,GAAG,OAAO,kBAAkB,IAAI,CAAA;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AI,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC9C,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY,EAAE,UAAwB,EAAE;IACjE,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,IAAI,iBAAiB,CAAA;IAClD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,UAAU,CAAA;IAE/D,IAAI,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACrC,IAAI,GAAG,mBAAmB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACrC,IAAI,GAAG,qBAAqB,CAAC,IAAI,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAA;IAEzD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/symbols.js
CHANGED
|
@@ -59,8 +59,8 @@ export function multiplication(text, options = {}) {
|
|
|
59
59
|
// Dimensions without spaces: keep tight
|
|
60
60
|
const tightPattern = new RegExp(`(\\d${chr}?)[xX*](${chr}?\\d)`, "g");
|
|
61
61
|
text = text.replace(tightPattern, `$1${MULTIPLICATION}$2`);
|
|
62
|
-
// Trailing multiplier: 5x (followed by
|
|
63
|
-
const trailingPattern = new RegExp(`(\\d${chr}?)[xX*]
|
|
62
|
+
// Trailing multiplier: 5x (followed by word boundary - space, punctuation, etc.)
|
|
63
|
+
const trailingPattern = new RegExp(`(\\d${chr}?)[xX*]\\b`, "g");
|
|
64
64
|
text = text.replace(trailingPattern, `$1${MULTIPLICATION}`);
|
|
65
65
|
return text;
|
|
66
66
|
}
|
package/dist/symbols.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../src/symbols.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,gB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