Skip to content

Commit

Permalink
Update ALLOWED_CHARS in constants.ts to include additional characters. (
Browse files Browse the repository at this point in the history
#179)

#### Motivation and context

To support the new `‘`.

#### Checklist:

- [x] I only use the allowed chars
  • Loading branch information
ioanlucut authored Sep 29, 2023
2 parents b845f54 + dec8489 commit 5861fb0
Show file tree
Hide file tree
Showing 9 changed files with 412 additions and 372 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Acest repository conține cântări scrise/folosite de trupele de laudă și în

_inspirat din `EasySlides`, `OpenSongs` și https://www.learnchordal.com/how-to-read-charts_.

Formatul folosit este unul simplu, similar cu cel din `OpenSong`, după cum urmează:
Formatul folosit este unul simplu, după cum urmează:

```
[title]
Expand Down Expand Up @@ -123,24 +123,24 @@ Domn al veșniciei, în veci! Amin!

#### Caractere

Caracterele pe care le putem folosi sunt foarte importante, așa că am definit o listă pe care o putem folosi:
Caracterele pe care le putem folosi sunt foarte importante, așa că am definit o listă:

```
!(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY[\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„
*_{}&!(),-./][1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZYQabcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț‘’”„\n
```

Întrucât sunt foarte multe versiuni ale caracterelor e.g. `ş` în loc de `ș`, e nevoie să folosim aceleași caractere cu
același format unicode. Un exemplu de variațiuni poate fi văzut aici: https://www.compart.com/en/unicode/U+201D.
> Detalii despre `‘’` poți să găsești și aici: https://github.com/ioanlucut/bes-lyrics/issues/105.
#### Dacă vrei să imporți cântece din resurse creștine

- Asigură-te că ultima versiune a repo-ului https://github.com/ioanlucut/bes-lyrics-parser este instalată in același
folder părinte cu acest repository.
- Copiază ID-ul din URL. E.g. https://www.resursecrestine.ro/cantece/212152/cuvantul-intrupat (-> **212152**)
- Copiază `ID`-ul din `URL`. E.g. https://www.resursecrestine.ro/cantece/212152/cuvantul-intrupat (-> **212152**)
- Adaugă-l în fișierul `temp_runners/rc_ids_to_process.txt` într-o linie nouă.
- Rulează scriptul `npm run import:rc:by-ids`
- Rulează scriptul `npm run meta:ci`
- Commit, push & branch nou.
- Branch nou, commit, push și `PR`.

#### Cum poți să te implici altfel?

Expand Down
210 changes: 89 additions & 121 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.1",
"description": "Cântări pentru Biserica Emanuel Sibiu",
"dependencies": {
"@types/nspell": "^2.1.3",
"@types/nspell": "^2.1.4",
"@types/string-similarity": "^4.0.0",
"chalk": "^4.1.2",
"dictionary-ro": "^2.1.0",
Expand All @@ -20,15 +20,15 @@
"devDependencies": {
"@tsconfig/node-lts": "^18.12.5",
"@types/fs-extra": "^11.0.2",
"@types/iconv": "^3.0.1",
"@types/iconv": "^3.0.2",
"@types/jest": "^29.5.5",
"@types/lodash": "^4.14.198",
"@types/lodash": "^4.14.199",
"@types/lodash-es": "^4.17.9",
"@types/node": "^20.6.5",
"@types/recursive-readdir": "^2.2.1",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
"eslint": "^8.49.0",
"@types/node": "^20.7.1",
"@types/recursive-readdir": "^2.2.2",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-plugin-require-extensions": "^0.1.3",
"is-ci-cli": "^2.2.0",
"jest": "^29.7.0",
Expand All @@ -37,15 +37,15 @@
"jest-watch-typeahead": "^2.2.2",
"lodash": "^4.17.21",
"prettier": "^3.0.3",
"prettier-plugin-latex": "1.2.4",
"prettier-plugin-latex": "^2.0.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tslib": "^2.6.2",
"typescript": "5.1.6"
},
"type": "module",
"scripts": {
"format": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./node_modules/.bin/prettier --log-level error --write \"./verified/**/*.txt\" {src,bin}/**/*.ts README.md \"./LaTeX/**/*.tex\"",
"format": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./node_modules/.bin/prettier --log-level error --write \"./verified/**/*.txt\" \"./candidates/**/*.txt\" {src,bin,mocks,temp-runners}/**/*.ts README.md \"./LaTeX/**/*.tex\"",
"test:ci": "NODE_ENV=test jest --runInBand --no-cache",
"test:watch": "NODE_ENV=test TZ='Europe/Berlin' jest --watch --logHeapUsage --no-cache",
"test": "is-ci-cli test:ci test:watch",
Expand All @@ -63,7 +63,7 @@
"import:rc:by-authors": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./temp-runners/importSongsFromRcByAuthors.ts",
"import:rc:by-ids": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./temp-runners/importSongsFromRcByIds.ts",
"build:ci": "npm run lint && npm run test && npm run verify",
"meta:ci": "npm run reprocess:filename && npm run reprocess:content && npm run verify"
"meta:ci": "npm run reprocess:filename && npm run reprocess:content && npm run verify && npm run format"
},
"author": "Ioan Lucuț",
"license": "ISC"
Expand Down
212 changes: 105 additions & 107 deletions src/charsStatsCollector.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,119 +4,117 @@ describe('fileNameNormalizer', () => {
it('should work correctly and not signalize any differences when only allowed chars exist', () => {
const stats = assemblyCharsStats(
'file.txt',
'!(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY' +
'[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„!(),-./1234567890:;?' +
'ABCDEFGHIJKLMNOPRSTUVWXZY[\\]abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„',
'!(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY][abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’‘”„!(),-./1234567890:;?ABCDEFGHIJKLMNOPRSTUVWXZY][abcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț’”„',
);

expect(stats.differenceInContent).toHaveLength(0);
expect(stats.differenceInFileName).toHaveLength(0);

expect(stats).toMatchInlineSnapshot(`
{
"differenceInContent": [],
"differenceInFileName": [],
"fileName": "file.txt",
"uniqueCharsFromContent": [
"!",
"(",
")",
",",
"-",
".",
"/",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
":",
";",
"?",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"[",
"\\",
"]",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
",
",
",
",
",
",
",
",
",
",
"’",
"”",
"„",
],
"uniqueCharsFromFileName": [
".",
"e",
"f",
"i",
"l",
"t",
"x",
],
}
`);
{
"differenceInContent": [],
"differenceInFileName": [],
"fileName": "file.txt",
"uniqueCharsFromContent": [
"!",
"(",
")",
",",
"-",
".",
"/",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
":",
";",
"?",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"[",
"]",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
",
",
",
",
",
",
",
",
",
",
"‘",
"’",
"”",
"„",
],
"uniqueCharsFromFileName": [
".",
"e",
"f",
"i",
"l",
"t",
"x",
],
}
`);
});

it('should work correctly by signalize differences', () => {
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:;?ABCDEFGHIJKLMNOPRSTUVWXZYQabcdefghijklmnopqrstuvwxyzÎâîăÂȘșĂȚț‘’”„\n`.split(
EMPTY_STRING,
);

Expand Down
Loading

0 comments on commit 5861fb0

Please sign in to comment.