lyrics-structure 1.2.2 → 1.2.3
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/.prettierrc +9 -9
- package/.vscode/settings.json +19 -19
- package/CHANGELOG.md +56 -56
- package/README.md +53 -53
- package/debug.ts +47 -47
- package/dist/debug.js +41 -41
- package/dist/lyrics.test.js +22 -22
- package/dist/slide.js +1 -1
- package/dist/slide.test.js +41 -41
- package/index.ts +1 -1
- package/jest.config.js +17 -17
- package/lyrics.test.ts +76 -76
- package/lyrics.ts +107 -107
- package/package.json +28 -28
- package/slide.test.ts +66 -66
- package/slide.ts +63 -63
- package/tsconfig.json +113 -113
package/.prettierrc
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
{
|
|
2
|
-
"semi": true,
|
|
3
|
-
"trailingComma": "es5",
|
|
4
|
-
"singleQuote": true,
|
|
5
|
-
"printWidth": 100,
|
|
6
|
-
"tabWidth": 2,
|
|
7
|
-
"useTabs": false,
|
|
8
|
-
"bracketSpacing": true,
|
|
9
|
-
"arrowParens": "always"
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"trailingComma": "es5",
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"printWidth": 100,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"useTabs": false,
|
|
8
|
+
"bracketSpacing": true,
|
|
9
|
+
"arrowParens": "always"
|
|
10
10
|
}
|
package/.vscode/settings.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"editor.formatOnSave": true,
|
|
3
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
4
|
-
"editor.codeActionsOnSave": {
|
|
5
|
-
"source.fixAll":
|
|
6
|
-
},
|
|
7
|
-
"[typescript]": {
|
|
8
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
9
|
-
},
|
|
10
|
-
"[javascript]": {
|
|
11
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
12
|
-
},
|
|
13
|
-
"[json]": {
|
|
14
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
15
|
-
},
|
|
16
|
-
"[markdown]": {
|
|
17
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"editor.formatOnSave": true,
|
|
3
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
4
|
+
"editor.codeActionsOnSave": {
|
|
5
|
+
"source.fixAll": "explicit"
|
|
6
|
+
},
|
|
7
|
+
"[typescript]": {
|
|
8
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
9
|
+
},
|
|
10
|
+
"[javascript]": {
|
|
11
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
12
|
+
},
|
|
13
|
+
"[json]": {
|
|
14
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
15
|
+
},
|
|
16
|
+
"[markdown]": {
|
|
17
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [1.2.2] - 2024-04-06
|
|
4
|
-
|
|
5
|
-
### Fixed
|
|
6
|
-
|
|
7
|
-
- Fixed issue where consecutive lines without part containers were incorrectly split into separate parts
|
|
8
|
-
- Improved handling of regular text lines to maintain proper grouping
|
|
9
|
-
|
|
10
|
-
## [1.2.0] - 2024-03-XX
|
|
11
|
-
|
|
12
|
-
### Changed
|
|
13
|
-
|
|
14
|
-
- Simplified the lyrics format to use clear section markers
|
|
15
|
-
- Updated documentation with clearer examples
|
|
16
|
-
- Improved type definitions for better TypeScript support
|
|
17
|
-
|
|
18
|
-
### Added
|
|
19
|
-
|
|
20
|
-
- Support for section indications in parentheses
|
|
21
|
-
- Better handling of repeated sections
|
|
22
|
-
- More intuitive content structure
|
|
23
|
-
|
|
24
|
-
### Removed
|
|
25
|
-
|
|
26
|
-
- Slide-based content splitting
|
|
27
|
-
- Special command tags
|
|
28
|
-
- Complex formatting options
|
|
29
|
-
|
|
30
|
-
## [1.1.0] - 2024-03-XX
|
|
31
|
-
|
|
32
|
-
### Added
|
|
33
|
-
|
|
34
|
-
- Initial release
|
|
35
|
-
- `getParts` function for basic content extraction
|
|
36
|
-
- `getSlideParts` function for slide-based content splitting
|
|
37
|
-
- Support for special command tags
|
|
38
|
-
- Comprehensive test suite
|
|
39
|
-
- TypeScript types and documentation
|
|
40
|
-
|
|
41
|
-
### Features
|
|
42
|
-
|
|
43
|
-
- Bracketed section parsing
|
|
44
|
-
- Special command tag handling
|
|
45
|
-
- Slide splitting based on content length
|
|
46
|
-
- Empty line separation
|
|
47
|
-
- Long line handling (>40 characters)
|
|
48
|
-
- Whitespace preservation
|
|
49
|
-
- Unicode support in tags
|
|
50
|
-
|
|
51
|
-
### Test Coverage
|
|
52
|
-
|
|
53
|
-
- Basic functionality tests
|
|
54
|
-
- Slide splitting tests
|
|
55
|
-
- Special command tests
|
|
56
|
-
- Edge case handling
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.2.2] - 2024-04-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed issue where consecutive lines without part containers were incorrectly split into separate parts
|
|
8
|
+
- Improved handling of regular text lines to maintain proper grouping
|
|
9
|
+
|
|
10
|
+
## [1.2.0] - 2024-03-XX
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Simplified the lyrics format to use clear section markers
|
|
15
|
+
- Updated documentation with clearer examples
|
|
16
|
+
- Improved type definitions for better TypeScript support
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Support for section indications in parentheses
|
|
21
|
+
- Better handling of repeated sections
|
|
22
|
+
- More intuitive content structure
|
|
23
|
+
|
|
24
|
+
### Removed
|
|
25
|
+
|
|
26
|
+
- Slide-based content splitting
|
|
27
|
+
- Special command tags
|
|
28
|
+
- Complex formatting options
|
|
29
|
+
|
|
30
|
+
## [1.1.0] - 2024-03-XX
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Initial release
|
|
35
|
+
- `getParts` function for basic content extraction
|
|
36
|
+
- `getSlideParts` function for slide-based content splitting
|
|
37
|
+
- Support for special command tags
|
|
38
|
+
- Comprehensive test suite
|
|
39
|
+
- TypeScript types and documentation
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
- Bracketed section parsing
|
|
44
|
+
- Special command tag handling
|
|
45
|
+
- Slide splitting based on content length
|
|
46
|
+
- Empty line separation
|
|
47
|
+
- Long line handling (>40 characters)
|
|
48
|
+
- Whitespace preservation
|
|
49
|
+
- Unicode support in tags
|
|
50
|
+
|
|
51
|
+
### Test Coverage
|
|
52
|
+
|
|
53
|
+
- Basic functionality tests
|
|
54
|
+
- Slide splitting tests
|
|
55
|
+
- Special command tests
|
|
56
|
+
- Edge case handling
|
package/README.md
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
# Lyrics Parser
|
|
2
|
-
|
|
3
|
-
A TypeScript library for parsing lyrics with bracketed sections and special commands. Supports splitting text into structured parts with names and indications.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install lyrics-parser
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { getLyricsParts } from 'lyrics-parser';
|
|
15
|
-
|
|
16
|
-
const lyrics = `[verse 1] (first time)
|
|
17
|
-
This is the first verse content
|
|
18
|
-
[/verse 1]
|
|
19
|
-
|
|
20
|
-
[chorus]
|
|
21
|
-
This is the chorus content
|
|
22
|
-
[/chorus]
|
|
23
|
-
|
|
24
|
-
[verse 2]
|
|
25
|
-
This is the second verse content
|
|
26
|
-
[/verse 2]`;
|
|
27
|
-
|
|
28
|
-
const parts = getLyricsParts(lyrics);
|
|
29
|
-
// Result: Array of LyricPart objects with name, repetition, indication, and content
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Features
|
|
33
|
-
|
|
34
|
-
- Extracts content from bracketed sections
|
|
35
|
-
- Handles section names and indications
|
|
36
|
-
- Supports repeated sections
|
|
37
|
-
- Preserves non-bracketed content
|
|
38
|
-
- TypeScript support
|
|
39
|
-
|
|
40
|
-
## Example Format
|
|
41
|
-
|
|
42
|
-
```text
|
|
43
|
-
[partname] (indication)
|
|
44
|
-
content
|
|
45
|
-
[/partname]
|
|
46
|
-
|
|
47
|
-
[another part]
|
|
48
|
-
more content
|
|
49
|
-
[/another part]
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## License
|
|
53
|
-
|
|
1
|
+
# Lyrics Parser
|
|
2
|
+
|
|
3
|
+
A TypeScript library for parsing lyrics with bracketed sections and special commands. Supports splitting text into structured parts with names and indications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install lyrics-parser
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { getLyricsParts } from 'lyrics-parser';
|
|
15
|
+
|
|
16
|
+
const lyrics = `[verse 1] (first time)
|
|
17
|
+
This is the first verse content
|
|
18
|
+
[/verse 1]
|
|
19
|
+
|
|
20
|
+
[chorus]
|
|
21
|
+
This is the chorus content
|
|
22
|
+
[/chorus]
|
|
23
|
+
|
|
24
|
+
[verse 2]
|
|
25
|
+
This is the second verse content
|
|
26
|
+
[/verse 2]`;
|
|
27
|
+
|
|
28
|
+
const parts = getLyricsParts(lyrics);
|
|
29
|
+
// Result: Array of LyricPart objects with name, repetition, indication, and content
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- Extracts content from bracketed sections
|
|
35
|
+
- Handles section names and indications
|
|
36
|
+
- Supports repeated sections
|
|
37
|
+
- Preserves non-bracketed content
|
|
38
|
+
- TypeScript support
|
|
39
|
+
|
|
40
|
+
## Example Format
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
[partname] (indication)
|
|
44
|
+
content
|
|
45
|
+
[/partname]
|
|
46
|
+
|
|
47
|
+
[another part]
|
|
48
|
+
more content
|
|
49
|
+
[/another part]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
54
|
MIT
|
package/debug.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { getSlideParts } from './slide';
|
|
2
|
-
|
|
3
|
-
const comprehensiveInput = `
|
|
4
|
-
[verse]
|
|
5
|
-
First line of verse
|
|
6
|
-
Second line of verse
|
|
7
|
-
Third line of verse
|
|
8
|
-
Fourth line of verse
|
|
9
|
-
Fifth line of verse
|
|
10
|
-
[/verse]
|
|
11
|
-
[verse]
|
|
12
|
-
(inside parentheses)
|
|
13
|
-
Regular text line 1
|
|
14
|
-
Regular text line 2
|
|
15
|
-
|
|
16
|
-
[chorus]
|
|
17
|
-
First chorus line
|
|
18
|
-
Second chorus line
|
|
19
|
-
[/chorus]
|
|
20
|
-
|
|
21
|
-
[verse 1]
|
|
22
|
-
This is a very long line that should be considered too long for the slide
|
|
23
|
-
This is another very long line that should also be considered too long
|
|
24
|
-
Short line 1
|
|
25
|
-
Short line 2
|
|
26
|
-
[/verse 1]
|
|
27
|
-
|
|
28
|
-
Regular line 1
|
|
29
|
-
Regular line 2
|
|
30
|
-
|
|
31
|
-
More content
|
|
32
|
-
|
|
33
|
-
This is a very long line that exceeds forty characters for testing purposes
|
|
34
|
-
This is another very long line that also exceeds the forty character limit
|
|
35
|
-
Another very long line that should be considered too long for the slide
|
|
36
|
-
And yet another very long line that should be split into a new section
|
|
37
|
-
Regular line
|
|
38
|
-
|
|
39
|
-
[verse 2]
|
|
40
|
-
First line with spaces
|
|
41
|
-
Second line with spaces
|
|
42
|
-
[/verse 2]
|
|
43
|
-
|
|
44
|
-
[chorus]`;
|
|
45
|
-
|
|
46
|
-
console.log('Output from getSlideParts:');
|
|
47
|
-
console.log(JSON.stringify(getSlideParts(comprehensiveInput), null, 2));
|
|
1
|
+
import { getSlideParts } from './slide';
|
|
2
|
+
|
|
3
|
+
const comprehensiveInput = `
|
|
4
|
+
[verse]
|
|
5
|
+
First line of verse
|
|
6
|
+
Second line of verse
|
|
7
|
+
Third line of verse
|
|
8
|
+
Fourth line of verse
|
|
9
|
+
Fifth line of verse
|
|
10
|
+
[/verse]
|
|
11
|
+
[verse]
|
|
12
|
+
(inside parentheses)
|
|
13
|
+
Regular text line 1
|
|
14
|
+
Regular text line 2
|
|
15
|
+
|
|
16
|
+
[chorus]
|
|
17
|
+
First chorus line
|
|
18
|
+
Second chorus line
|
|
19
|
+
[/chorus]
|
|
20
|
+
|
|
21
|
+
[verse 1]
|
|
22
|
+
This is a very long line that should be considered too long for the slide
|
|
23
|
+
This is another very long line that should also be considered too long
|
|
24
|
+
Short line 1
|
|
25
|
+
Short line 2
|
|
26
|
+
[/verse 1]
|
|
27
|
+
|
|
28
|
+
Regular line 1
|
|
29
|
+
Regular line 2
|
|
30
|
+
|
|
31
|
+
More content
|
|
32
|
+
|
|
33
|
+
This is a very long line that exceeds forty characters for testing purposes
|
|
34
|
+
This is another very long line that also exceeds the forty character limit
|
|
35
|
+
Another very long line that should be considered too long for the slide
|
|
36
|
+
And yet another very long line that should be split into a new section
|
|
37
|
+
Regular line
|
|
38
|
+
|
|
39
|
+
[verse 2]
|
|
40
|
+
First line with spaces
|
|
41
|
+
Second line with spaces
|
|
42
|
+
[/verse 2]
|
|
43
|
+
|
|
44
|
+
[chorus]`;
|
|
45
|
+
|
|
46
|
+
console.log('Output from getSlideParts:');
|
|
47
|
+
console.log(JSON.stringify(getSlideParts(comprehensiveInput), null, 2));
|
package/dist/debug.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const slide_1 = require("./slide");
|
|
4
|
-
const comprehensiveInput = `
|
|
5
|
-
[verse]
|
|
6
|
-
First line of verse
|
|
7
|
-
Second line of verse
|
|
8
|
-
Third line of verse
|
|
9
|
-
Fourth line of verse
|
|
10
|
-
Fifth line of verse
|
|
11
|
-
[/verse]
|
|
12
|
-
[verse]
|
|
13
|
-
(inside parentheses)
|
|
14
|
-
Regular text line 1
|
|
15
|
-
Regular text line 2
|
|
16
|
-
|
|
17
|
-
[chorus]
|
|
18
|
-
First chorus line
|
|
19
|
-
Second chorus line
|
|
20
|
-
[/chorus]
|
|
21
|
-
|
|
22
|
-
[verse 1]
|
|
23
|
-
This is a very long line that should be considered too long for the slide
|
|
24
|
-
This is another very long line that should also be considered too long
|
|
25
|
-
Short line 1
|
|
26
|
-
Short line 2
|
|
27
|
-
[/verse 1]
|
|
28
|
-
|
|
29
|
-
Regular line 1
|
|
30
|
-
Regular line 2
|
|
31
|
-
|
|
32
|
-
More content
|
|
33
|
-
|
|
34
|
-
This is a very long line that exceeds forty characters for testing purposes
|
|
35
|
-
This is another very long line that also exceeds the forty character limit
|
|
36
|
-
Another very long line that should be considered too long for the slide
|
|
37
|
-
And yet another very long line that should be split into a new section
|
|
38
|
-
Regular line
|
|
39
|
-
|
|
40
|
-
[verse 2]
|
|
41
|
-
First line with spaces
|
|
42
|
-
Second line with spaces
|
|
43
|
-
[/verse 2]
|
|
44
|
-
|
|
4
|
+
const comprehensiveInput = `
|
|
5
|
+
[verse]
|
|
6
|
+
First line of verse
|
|
7
|
+
Second line of verse
|
|
8
|
+
Third line of verse
|
|
9
|
+
Fourth line of verse
|
|
10
|
+
Fifth line of verse
|
|
11
|
+
[/verse]
|
|
12
|
+
[verse]
|
|
13
|
+
(inside parentheses)
|
|
14
|
+
Regular text line 1
|
|
15
|
+
Regular text line 2
|
|
16
|
+
|
|
17
|
+
[chorus]
|
|
18
|
+
First chorus line
|
|
19
|
+
Second chorus line
|
|
20
|
+
[/chorus]
|
|
21
|
+
|
|
22
|
+
[verse 1]
|
|
23
|
+
This is a very long line that should be considered too long for the slide
|
|
24
|
+
This is another very long line that should also be considered too long
|
|
25
|
+
Short line 1
|
|
26
|
+
Short line 2
|
|
27
|
+
[/verse 1]
|
|
28
|
+
|
|
29
|
+
Regular line 1
|
|
30
|
+
Regular line 2
|
|
31
|
+
|
|
32
|
+
More content
|
|
33
|
+
|
|
34
|
+
This is a very long line that exceeds forty characters for testing purposes
|
|
35
|
+
This is another very long line that also exceeds the forty character limit
|
|
36
|
+
Another very long line that should be considered too long for the slide
|
|
37
|
+
And yet another very long line that should be split into a new section
|
|
38
|
+
Regular line
|
|
39
|
+
|
|
40
|
+
[verse 2]
|
|
41
|
+
First line with spaces
|
|
42
|
+
Second line with spaces
|
|
43
|
+
[/verse 2]
|
|
44
|
+
|
|
45
45
|
[chorus]`;
|
|
46
46
|
console.log('Output from getSlideParts:');
|
|
47
47
|
console.log(JSON.stringify((0, slide_1.getSlideParts)(comprehensiveInput), null, 2));
|
package/dist/lyrics.test.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const lyrics_1 = require("./lyrics");
|
|
4
|
-
const testLyrics = `[partname 1] (indication 1)
|
|
5
|
-
|
|
6
|
-
content 1
|
|
7
|
-
|
|
8
|
-
[/partname 1]
|
|
9
|
-
|
|
10
|
-
[partname 1] (indication 2)
|
|
11
|
-
|
|
12
|
-
[partname 2]
|
|
13
|
-
|
|
14
|
-
content 2
|
|
15
|
-
|
|
16
|
-
[/partname 2]
|
|
17
|
-
|
|
18
|
-
[interlude 1]
|
|
19
|
-
|
|
20
|
-
[partname 3]
|
|
21
|
-
|
|
22
|
-
content without partname container
|
|
23
|
-
|
|
24
|
-
content standalone 1
|
|
25
|
-
content standalone 2
|
|
4
|
+
const testLyrics = `[partname 1] (indication 1)
|
|
5
|
+
|
|
6
|
+
content 1
|
|
7
|
+
|
|
8
|
+
[/partname 1]
|
|
9
|
+
|
|
10
|
+
[partname 1] (indication 2)
|
|
11
|
+
|
|
12
|
+
[partname 2]
|
|
13
|
+
|
|
14
|
+
content 2
|
|
15
|
+
|
|
16
|
+
[/partname 2]
|
|
17
|
+
|
|
18
|
+
[interlude 1]
|
|
19
|
+
|
|
20
|
+
[partname 3]
|
|
21
|
+
|
|
22
|
+
content without partname container
|
|
23
|
+
|
|
24
|
+
content standalone 1
|
|
25
|
+
content standalone 2
|
|
26
26
|
`;
|
|
27
27
|
describe('getLyricsParts', () => {
|
|
28
28
|
it('should correctly parse lyrics into parts', () => {
|
package/dist/slide.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getSlideParts = void 0;
|
|
13
13
|
const lyrics_1 = require("./lyrics");
|
|
14
|
-
const isLineTooLong = (line) => line.length >
|
|
14
|
+
const isLineTooLong = (line) => line.length > 60;
|
|
15
15
|
const processContent = (content) => {
|
|
16
16
|
const slides = [];
|
|
17
17
|
let currentSlide = [];
|
package/dist/slide.test.js
CHANGED
|
@@ -3,47 +3,47 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const slide_js_1 = require("./slide.js");
|
|
4
4
|
describe('Comprehensive Tests', () => {
|
|
5
5
|
test('handles all cases in one comprehensive input', () => {
|
|
6
|
-
const comprehensiveInput = `
|
|
7
|
-
[verse]
|
|
8
|
-
First line of verse
|
|
9
|
-
Second line of verse
|
|
10
|
-
Third line of verse
|
|
11
|
-
Fourth line of verse
|
|
12
|
-
Fifth line of verse
|
|
13
|
-
[/verse]
|
|
14
|
-
[verse]
|
|
15
|
-
(inside parentheses)
|
|
16
|
-
Regular text line 1
|
|
17
|
-
Regular text line 2
|
|
18
|
-
|
|
19
|
-
[chorus]
|
|
20
|
-
First chorus line
|
|
21
|
-
Second chorus line
|
|
22
|
-
[/chorus]
|
|
23
|
-
|
|
24
|
-
[verse 1]
|
|
25
|
-
This is a very long line that should be considered too long for the slide
|
|
26
|
-
This is another very long line that should also be considered too long
|
|
27
|
-
Short line 1
|
|
28
|
-
Short line 2
|
|
29
|
-
[/verse 1]
|
|
30
|
-
|
|
31
|
-
Regular line 1
|
|
32
|
-
Regular line 2
|
|
33
|
-
|
|
34
|
-
More content
|
|
35
|
-
|
|
36
|
-
This is a very long line that exceeds forty characters for testing purposes
|
|
37
|
-
This is another very long line that also exceeds the forty character limit
|
|
38
|
-
Another very long line that should be considered too long for the slide
|
|
39
|
-
And yet another very long line that should be split into a new section
|
|
40
|
-
Regular line
|
|
41
|
-
|
|
42
|
-
[verse 2]
|
|
43
|
-
First line with spaces
|
|
44
|
-
Second line with spaces
|
|
45
|
-
[/verse 2]
|
|
46
|
-
|
|
6
|
+
const comprehensiveInput = `
|
|
7
|
+
[verse]
|
|
8
|
+
First line of verse
|
|
9
|
+
Second line of verse
|
|
10
|
+
Third line of verse
|
|
11
|
+
Fourth line of verse
|
|
12
|
+
Fifth line of verse
|
|
13
|
+
[/verse]
|
|
14
|
+
[verse]
|
|
15
|
+
(inside parentheses)
|
|
16
|
+
Regular text line 1
|
|
17
|
+
Regular text line 2
|
|
18
|
+
|
|
19
|
+
[chorus]
|
|
20
|
+
First chorus line
|
|
21
|
+
Second chorus line
|
|
22
|
+
[/chorus]
|
|
23
|
+
|
|
24
|
+
[verse 1]
|
|
25
|
+
This is a very long line that should be considered too long for the slide
|
|
26
|
+
This is another very long line that should also be considered too long
|
|
27
|
+
Short line 1
|
|
28
|
+
Short line 2
|
|
29
|
+
[/verse 1]
|
|
30
|
+
|
|
31
|
+
Regular line 1
|
|
32
|
+
Regular line 2
|
|
33
|
+
|
|
34
|
+
More content
|
|
35
|
+
|
|
36
|
+
This is a very long line that exceeds forty characters for testing purposes
|
|
37
|
+
This is another very long line that also exceeds the forty character limit
|
|
38
|
+
Another very long line that should be considered too long for the slide
|
|
39
|
+
And yet another very long line that should be split into a new section
|
|
40
|
+
Regular line
|
|
41
|
+
|
|
42
|
+
[verse 2]
|
|
43
|
+
First line with spaces
|
|
44
|
+
Second line with spaces
|
|
45
|
+
[/verse 2]
|
|
46
|
+
|
|
47
47
|
[chorus]`;
|
|
48
48
|
expect((0, slide_js_1.getSlideParts)(comprehensiveInput)).toEqual([
|
|
49
49
|
'First line of verse\nSecond line of verse\nThird line of verse\nFourth line of verse',
|
package/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './slide.js';
|
|
1
|
+
export * from './slide.js';
|
|
2
2
|
export * from './lyrics.js';
|
package/jest.config.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
-
export default {
|
|
3
|
-
preset: 'ts-jest',
|
|
4
|
-
testEnvironment: 'node',
|
|
5
|
-
extensionsToTreatAsEsm: ['.ts'],
|
|
6
|
-
moduleNameMapper: {
|
|
7
|
-
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
8
|
-
},
|
|
9
|
-
transform: {
|
|
10
|
-
'^.+\\.tsx?$': [
|
|
11
|
-
'ts-jest',
|
|
12
|
-
{
|
|
13
|
-
useESM: true,
|
|
14
|
-
},
|
|
15
|
-
],
|
|
16
|
-
},
|
|
17
|
-
};
|
|
1
|
+
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
+
export default {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
6
|
+
moduleNameMapper: {
|
|
7
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
8
|
+
},
|
|
9
|
+
transform: {
|
|
10
|
+
'^.+\\.tsx?$': [
|
|
11
|
+
'ts-jest',
|
|
12
|
+
{
|
|
13
|
+
useESM: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
};
|