Skip to content
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

Support new char #8

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,836 changes: 1,288 additions & 1,548 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@
},
"author": "Ioan Lucut",
"dependencies": {
"@googleapis/drive": "^8.0.0",
"dotenv": "^16.0.3",
"dotenv-cli": "^7.2.1",
"@googleapis/drive": "^8.3.1",
"dotenv": "^16.3.1",
"dotenv-cli": "^7.3.0",
"fs-extra": "^11.1.1",
"google-protobuf": "^3.21.2",
"lodash": "^4.17.21",
"p-map": "^4.0.0",
"protobufjs": "^7.2.3",
"protobufjs": "^7.2.5",
"recursive-readdir": "^2.2.3",
"ts-proto": "^1.147.1",
"uuid": "^9.0.0"
"ts-proto": "^1.158.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@tsconfig/node-lts": "^18.12.1",
"@types/fs-extra": "^11.0.1",
"@types/jest": "^29.5.1",
"@types/lodash": "^4.14.194",
"@types/node": "^20.0.0",
"@types/recursive-readdir": "^2.2.1",
"@typescript-eslint/eslint-plugin": "^5.59.2",
"@typescript-eslint/parser": "^5.59.2",
"eslint": "^8.39.0",
"@tsconfig/node-lts": "^18.12.5",
"@types/fs-extra": "^11.0.2",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.199",
"@types/node": "^20.7.1",
"@types/recursive-readdir": "^2.2.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.50.0",
"is-ci-cli": "^2.2.0",
"jest": "^29.6.1",
"jest": "^29.7.0",
"jest-watch-typeahead": "^2.2.2",
"prettier": "^2.8.8",
"ts-jest": "^29.1.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tslib": "^2.5.0",
"typescript": "^5.0.4"
"tslib": "^2.6.2",
"typescript": "5.1.6"
}
}
128 changes: 64 additions & 64 deletions src/__snapshots__/proPresenter7SongConverter.spec.ts.snap

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/__snapshots__/txtToRtfConverter.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ exports[`txtToRtfConverter should convert to expected \`rtf\` correctly 1`] = `
\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural\\qc\\partightenfactor0

\\f0\\b\\fs120 \\cf2 \\cb3 Row 1-1\\
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyz\\uc0\\u206\\uc0\\u226\\uc0\\u238\\uc0\\u259\\uc0\\u194\\uc0\\u536\\uc0\\u537\\uc0\\u258\\uc0\\u538\\uc0\\u539\\uc0\\u8217\\uc0\\u8221\\uc0\\u8222\\
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyz\\uc0\\u206\\uc0\\u226\\uc0\\u238\\uc0\\u259\\uc0\\u194\\uc0\\u536\\uc0\\u537\\uc0\\u258\\uc0\\u538\\uc0\\u539\\uc0\\u8217\\uc0\\u8216\\uc0\\u8221\\uc0\\u8222\\
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyz\\uc0\\u206\\uc0\\u226\\uc0\\u238\\uc0\\u259\\uc0\\u194\\uc0\\u536\\uc0\\u537\\uc0\\u258\\uc0\\u538\\uc0\\u539\\uc0\\u8217\\uc0\\u8216\\uc0\\u8221\\uc0\\u8222\\
Row 1-3}
"
`;
Expand All @@ -34,6 +35,7 @@ space-not-expected-before \\uc0\\u538text\\
space-not-expected-before \\uc0\\u539text\\
space-not-expected-before -text\\
space-not-expected-before \\uc0\\u8217text\\
space-not-expected-before \\uc0\\u8216text\\
space-not-expected-before \\uc0\\u8221text\\
space-not-expected-before \\uc0\\u8222text\\
\\
Expand All @@ -49,6 +51,7 @@ text\\uc0\\u538 single-space-expected-after-this\\
text\\uc0\\u539 single-space-expected-after-this\\
text- single-space-expected-after-this\\
text\\uc0\\u8217 single-space-expected-after-this\\
text\\uc0\\u8216 single-space-expected-after-this\\
text\\uc0\\u8221 single-space-expected-after-this\\
text\\uc0\\u8222 single-space-expected-after-this\\
\\
Expand All @@ -64,6 +67,7 @@ end-of-line-works-without-extra-space-text\\uc0\\u538\\
end-of-line-works-without-extra-space-text\\uc0\\u539\\
end-of-line-works-without-extra-space-text-\\
end-of-line-works-without-extra-space-text\\uc0\\u8217\\
end-of-line-works-without-extra-space-text\\uc0\\u8216\\
end-of-line-works-without-extra-space-text\\uc0\\u8221\\
end-of-line-works-without-extra-space-text\\uc0\\u8222}
"
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const TXT_EXTENSION = '.txt';
export const TEST_FILE = 'TEMPLATE.txt';

export const ALLOWED_CHARS =
` {}&#!(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZYQ[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„\n`.split(
` *_{}&!(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZYQ[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„\n`.split(
EMPTY_STRING,
);

Expand Down
18 changes: 9 additions & 9 deletions src/proPresenter7SongConverter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ jest.mock('crypto', () => {
const ANY_CONFIG = {
arrangementName: 'BES',
ccliSettings: {
publisher: 'Biserica Emanuel Sibiu',
author: 'Ioan Lucuț',
copyrightYear: new Date().getFullYear(),
album: `Biserica Emanuel Sibiu ${new Date().getFullYear()}`,
publisher: 'ANY_PUBLISHER',
author: 'ANY_AUTHOR',
copyrightYear: 2023,
album: `Biserica Emanuel Sibiu 2023`,
songNumber: 0,
} as Presentation_CCLI,
fontConfig: {
name: 'CMGSans-Regular',
name: 'CMGSans-BoldCnCAPS',
size: 58,
family: 'CMGSans',
family: 'CMG Sans Cn CAPS',
bold: true,
} as Graphics_Text_Attributes_Font,
graphicSize: {
width: 1920,
height: 1080,
},
presentationCategory: `Worship Songs ~ BES ${new Date().getFullYear()}`,
refMacroId: '3ffd01b7-104f-499f-aac9-a13135006d0e',
refMacroName: 'Songs',
presentationCategory: `Worship Songs ~ BES 2023`,
refMacroId: 'ANY_REF_MACRO_ID',
refMacroName: 'ANY_REF_MACRO_NAME',
};

describe('proPresenter7SongConverter', () => {
Expand Down
6 changes: 5 additions & 1 deletion src/txtToRtfConverter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { convertToRtf } from './txtToRtfConverter';
describe('txtToRtfConverter', () => {
it('should convert to expected `rtf` correctly', () => {
const rtfContent = convertToRtf(`Row 1-1
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’‘”„
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’‘”„
Row 1-3`);

expect(rtfContent).toMatchSnapshot();
Expand All @@ -25,6 +26,7 @@ space-not-expected-before Țtext
space-not-expected-before țtext
space-not-expected-before -text
space-not-expected-before ’text
space-not-expected-before ‘text
space-not-expected-before ”text
space-not-expected-before „text

Expand All @@ -40,6 +42,7 @@ textȚ single-space-expected-after-this
textț single-space-expected-after-this
text- single-space-expected-after-this
text’ single-space-expected-after-this
text‘ single-space-expected-after-this
text” single-space-expected-after-this
text„ single-space-expected-after-this

Expand All @@ -55,6 +58,7 @@ end-of-line-works-without-extra-space-textȚ
end-of-line-works-without-extra-space-textț
end-of-line-works-without-extra-space-text-
end-of-line-works-without-extra-space-text’
end-of-line-works-without-extra-space-text‘
end-of-line-works-without-extra-space-text”
end-of-line-works-without-extra-space-text„`);

Expand Down
4 changes: 3 additions & 1 deletion src/txtToRtfConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const encodeVerseContentToUnicodeRTFFormat = (verseContent: string) =>
.replaceAll('” ', '\\uc0\\u8221 ')
.replaceAll('„ ', '\\uc0\\u8222 ')
.replaceAll('’ ', '\\uc0\\u8217 ')
.replaceAll('‘ ', '\\uc0\\u8216 ')
// Remaining chars
.replaceAll('Â', '\\uc0\\u194')
.replaceAll('â', '\\uc0\\u226')
Expand All @@ -36,7 +37,8 @@ const encodeVerseContentToUnicodeRTFFormat = (verseContent: string) =>
.replaceAll('Ț', '\\uc0\\u538')
.replaceAll('”', '\\uc0\\u8221')
.replaceAll('„', '\\uc0\\u8222')
.replaceAll('’', '\\uc0\\u8217');
.replaceAll('’', '\\uc0\\u8217')
.replaceAll('‘', '\\uc0\\u8216');

export const convertToRtf = (multiLineVerseContent: string) => {
if (!rtfTemplate) {
Expand Down
3 changes: 2 additions & 1 deletion txtToRtfConverterGeneratedRtf.rtf
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc\partightenfactor0

\f0\b\fs120 \cf2 \cb3 Row 1-1\
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\]abcdefghijklmnopqrstuvwxyz\uc0\u206\uc0\u226\uc0\u238\uc0\u259\uc0\u194\uc0\u536\uc0\u537\uc0\u258\uc0\u538\uc0\u539\uc0\u8217\uc0\u8221\uc0\u8222\
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\]abcdefghijklmnopqrstuvwxyz\uc0\u206\uc0\u226\uc0\u238\uc0\u259\uc0\u194\uc0\u536\uc0\u537\uc0\u258\uc0\u538\uc0\u539\uc0\u8217\uc0\u8216\uc0\u8221\uc0\u8222\
Row 1-2 !(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\]abcdefghijklmnopqrstuvwxyz\uc0\u206\uc0\u226\uc0\u238\uc0\u259\uc0\u194\uc0\u536\uc0\u537\uc0\u258\uc0\u538\uc0\u539\uc0\u8217\uc0\u8216\uc0\u8221\uc0\u8222\
Row 1-3}
3 changes: 3 additions & 0 deletions txtToRtfConverterGeneratedRtf_II.rtf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ space-not-expected-before \uc0\u538text\
space-not-expected-before \uc0\u539text\
space-not-expected-before -text\
space-not-expected-before \uc0\u8217text\
space-not-expected-before \uc0\u8216text\
space-not-expected-before \uc0\u8221text\
space-not-expected-before \uc0\u8222text\
\
Expand All @@ -32,6 +33,7 @@ text\uc0\u538 single-space-expected-after-this\
text\uc0\u539 single-space-expected-after-this\
text- single-space-expected-after-this\
text\uc0\u8217 single-space-expected-after-this\
text\uc0\u8216 single-space-expected-after-this\
text\uc0\u8221 single-space-expected-after-this\
text\uc0\u8222 single-space-expected-after-this\
\
Expand All @@ -47,5 +49,6 @@ end-of-line-works-without-extra-space-text\uc0\u538\
end-of-line-works-without-extra-space-text\uc0\u539\
end-of-line-works-without-extra-space-text-\
end-of-line-works-without-extra-space-text\uc0\u8217\
end-of-line-works-without-extra-space-text\uc0\u8216\
end-of-line-works-without-extra-space-text\uc0\u8221\
end-of-line-works-without-extra-space-text\uc0\u8222}