-
-
Notifications
You must be signed in to change notification settings - Fork 33
Convert Storybooks #870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TheNonPirate
wants to merge
20
commits into
sillsdev:main
Choose a base branch
from
TheNonPirate:feature/convertStorybook
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Convert Storybooks #870
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
9110a76
Began exploratory work on storybooks
TheNonPirate 60af75b
Minor fixes
TheNonPirate 97a38bf
Implemented illustrations in storybooks
TheNonPirate 13985ef
Made images work for non-docx storybook files
TheNonPirate 6242649
Swiping storybook image now switches pages.
TheNonPirate fedf820
Implemented paragraph style milestones
TheNonPirate 2ed780c
Inline styles implemented in storybooks
TheNonPirate c2b7b37
Implemented single-level lists
TheNonPirate 84c4331
Implemented multi-level lists
TheNonPirate 373c260
Made it Prettier-compliant
TheNonPirate 3f442b8
Removed unnecessary console.log
TheNonPirate 0e6c712
Removed story from list of unsupported types
TheNonPirate 981509d
Removed unnecessary console.logs
TheNonPirate 5341b97
Simplified list conversion
TheNonPirate 430016c
Implemented list conversion tests
TheNonPirate 6c95457
Converted lists to standalone milestones
TheNonPirate 89a8961
Removed unnecessary replacePageTags function
TheNonPirate a45467e
Fixed bug with level 2 unordered lists
TheNonPirate a25055d
Implemented Playwright testing for storybooks
TheNonPirate 7763c09
Improved passing of parameters to runTests
TheNonPirate File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| test-results | ||
| *.swp | ||
| .DS_Store | ||
| node_modules | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { spawn } from 'node:child_process'; | ||
|
|
||
| const args = process.argv.slice(2).join(' '); | ||
| console.log('playwright test ' + args); | ||
| spawn('playwright test ' + args, { | ||
| shell: true, | ||
| stdio: 'inherit' | ||
| }).on('close', (code) => { | ||
| console.log('vitest ' + args); | ||
| spawn('vitest ' + args, { | ||
| shell: true, | ||
| stdio: 'inherit' | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| import { expect, test } from 'vitest'; | ||
| import { transformLists } from '../../convertBooks'; | ||
|
|
||
| function tokensOf(str: string) { | ||
| return str.split(/\s+/).filter((token) => token.length); | ||
| } | ||
|
|
||
| test('convert unordered list to milestones', () => { | ||
| const input = ` | ||
| \\m Some content | ||
| \\zuli1 One | ||
| \\zuli1 Two \\zuli1 Three in a row! | ||
| \\b | ||
| `; | ||
| const expected = ` | ||
| \\m Some content | ||
| \\nb \\zuli1\\* One | ||
| \\nb \\zuli1\\* Two | ||
| \\nb \\zuli1\\* Three in a row! | ||
| \\b | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); | ||
|
|
||
| test('convert ordered list to milestones', () => { | ||
| const input = ` | ||
| \\m Some content | ||
| \\zon1 10 | ||
| \\zoli1 One | ||
| \\zoli1 Two \\zoli1 Three in a row! | ||
| \\b | ||
| `; | ||
| const expected = ` | ||
| \\m Some content | ||
| \\zon1 |start="10"\\* | ||
| \\nb \\zoli1\\* One | ||
| \\nb \\zoli1\\* Two | ||
| \\nb \\zoli1\\* Three in a row! | ||
| \\b | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); | ||
|
|
||
| test('convert multilevel unordered list to milestones', () => { | ||
| const input = ` | ||
| \\c 2 | ||
| \\b | ||
| \\zuli1 Old Testament | ||
| \\zuli2 Pentateuch | ||
| \\zuli3 Genesis | ||
| \\zuli3 Exodus | ||
| \\zuli3 Leviticus | ||
| \\zuli2 Joshua | ||
| \\zuli2 Judges | ||
| \\zuli1 New Testament | ||
| \\zuli2 Matthew | ||
| \\zuli2 Mark | ||
| \\zuli2 Luke | ||
| \\zuli2 John | ||
| \\zuli1 Glossary | ||
| `; | ||
| const expected = ` | ||
| \\c 2 | ||
| \\b | ||
| \\nb \\zuli1\\* Old Testament | ||
| \\nb \\zuli2\\* Pentateuch | ||
| \\nb \\zuli3\\* Genesis | ||
| \\nb \\zuli3\\* Exodus | ||
| \\nb \\zuli3\\* Leviticus | ||
| \\nb \\zuli2\\* Joshua | ||
| \\nb \\zuli2\\* Judges | ||
| \\nb \\zuli1\\* New Testament | ||
| \\nb \\zuli2\\* Matthew | ||
| \\nb \\zuli2\\* Mark | ||
| \\nb \\zuli2\\* Luke | ||
| \\nb \\zuli2\\* John | ||
| \\nb \\zuli1\\* Glossary | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); | ||
|
|
||
| test('convert multilevel ordered list to milestones', () => { | ||
| const input = ` | ||
| \\m My List: | ||
| \\b | ||
| \\zon1 1 | ||
| \\zoli1 Food | ||
| \\zon2 1 | ||
| \\zoli2 Fruit | ||
| \\zon3 1 | ||
| \\zoli3 Apples | ||
| \\zoli3 Bananas | ||
| \\zoli3 Pears | ||
| \\zoli2 Dessert | ||
| \\zoli3 Pie | ||
| \\zoli3 Cake | ||
| \\zoli3 Ice Cream | ||
| \\zoli1 Drinks | ||
| \\zoli2 Coffee | ||
| \\zoli2 Water | ||
| \\zoli2 Tea | ||
| `; | ||
| const expected = ` | ||
| \\m My List: | ||
| \\b | ||
| \\zon1 |start="1"\\* | ||
| \\nb \\zoli1\\* Food | ||
| \\zon2 |start="1"\\* | ||
| \\nb \\zoli2\\* Fruit | ||
| \\zon3 |start="1"\\* | ||
| \\nb \\zoli3\\* Apples | ||
| \\nb \\zoli3\\* Bananas | ||
| \\nb \\zoli3\\* Pears | ||
| \\nb \\zoli2\\* Dessert | ||
| \\nb \\zoli3\\* Pie | ||
| \\nb \\zoli3\\* Cake | ||
| \\nb \\zoli3\\* Ice Cream | ||
| \\nb \\zoli1\\* Drinks | ||
| \\nb \\zoli2\\* Coffee | ||
| \\nb \\zoli2\\* Water | ||
| \\nb \\zoli2\\* Tea | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); | ||
|
|
||
| test('convert unordered list with formatting to milestones', () => { | ||
| const input = ` | ||
| \\m Some content | ||
| \\zuli1 One | ||
| \\zuli1 \\bd Two \\bd* | ||
| \\zuli1 Three in a row! | ||
| \\b | ||
| `; | ||
| const expected = ` | ||
| \\m Some content | ||
| \\nb \\zuli1\\* One | ||
| \\nb \\zuli1\\* \\bd Two \\bd* | ||
| \\nb \\zuli1\\* Three in a row! | ||
| \\b | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); | ||
|
|
||
| test('convert ordered list with formatting to milestones', () => { | ||
| const input = ` | ||
| \\m Some content | ||
| \\zon1 10 | ||
| \\zoli1 One | ||
| \\zoli1 \\bdit Two \\bdit* | ||
| \\zoli1 Three in a row! | ||
| \\b | ||
| `; | ||
| const expected = ` | ||
| \\m Some content | ||
| \\zon1 |start="10"\\* | ||
| \\nb \\zoli1\\* One | ||
| \\nb \\zoli1\\* \\bdit Two \\bdit* | ||
| \\nb \\zoli1\\* Three in a row! | ||
| \\b | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); | ||
|
|
||
| test('convert multilevel ordered list with formatting to milestones', () => { | ||
| const input = ` | ||
| \\m Some content | ||
| \\zon1 10 | ||
| \\zoli1 One | ||
| \\zon2 3 | ||
| \\zoli2 \\it sub-point 1 \\it* | ||
| \\zoli2 sub-point 2 | ||
| \\zoli1 \\bdit Two \\bdit* | ||
| \\zoli1 Three in a row! | ||
| \\b | ||
| `; | ||
| const expected = ` | ||
| \\m Some content | ||
| \\zon1 |start="10"\\* | ||
| \\nb \\zoli1\\* One | ||
| \\zon2 |start="3"\\* | ||
| \\nb \\zoli2\\* \\it sub-point 1 \\it* | ||
| \\nb \\zoli2\\* sub-point 2 | ||
| \\nb \\zoli1\\* \\bdit Two \\bdit* | ||
| \\nb \\zoli1\\* Three in a row! | ||
| \\b | ||
| `; | ||
| const result = transformLists(input, '', ''); | ||
| expect(tokensOf(result)).toEqual(tokensOf(expected)); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that it will fall to the default case, but I think it would be better to include
case 'story':abovedefault: