Skip to content

Commit

Permalink
Merge branch 'master' into ui-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
djahandarie authored Jan 21, 2024
2 parents 667a82c + 6ba1ffe commit e986858
Show file tree
Hide file tree
Showing 357 changed files with 4,323 additions and 2,293 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@
"error",
"block",
{
"pattern": " \\* Copyright \\(C\\) (\\d+-)?2023 Yomitan Authors(\n \\* Copyright \\(C\\) (\\d+-)?2022 Yomichan Authors)?\n \\*\n \\* This program is free software: you can redistribute it and/or modify\n \\* it under the terms of the GNU General Public License as published by\n \\* the Free Software Foundation, either version 3 of the License, or\n \\* \\(at your option\\) any later version\\.\n \\*\n \\* This program is distributed in the hope that it will be useful,\n \\* but WITHOUT ANY WARRANTY; without even the implied warranty of\n \\* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\\. See the\n \\* GNU General Public License for more details\\.\n \\*\n \\* You should have received a copy of the GNU General Public License\n \\* along with this program\\. If not, see <https://www\\.gnu\\.org/licenses/>\\.\n "
"pattern": " \\* Copyright \\(C\\) (2023-)?2024 Yomitan Authors(\n \\* Copyright \\(C\\) (20(16|17|18|19|20|21)-)?2022 Yomichan Authors)?\n \\*\n \\* This program is free software: you can redistribute it and/or modify\n \\* it under the terms of the GNU General Public License as published by\n \\* the Free Software Foundation, either version 3 of the License, or\n \\* \\(at your option\\) any later version\\.\n \\*\n \\* This program is distributed in the hope that it will be useful,\n \\* but WITHOUT ANY WARRANTY; without even the implied warranty of\n \\* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\\. See the\n \\* GNU General Public License for more details\\.\n \\*\n \\* You should have received a copy of the GNU General Public License\n \\* along with this program\\. If not, see <https://www\\.gnu\\.org/licenses/>\\.\n "
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ assignees: ''
(e.g. 20.11.1.1)

**Exported settings file**
(If you think it might be relevant, create a settings export file using the _Export Settings_ button on the settings page; zip or rename the resulting file to .txt to attach to the issue.)
(If you think it might be relevant, create a settings export file using the _Export Settings_ button on the settings page and attach it to this issue.)
396 changes: 42 additions & 354 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/bin/build-libs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/bin/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/bin/dictionary-validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/bin/generate-css-json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/bin/schema-validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/build-libs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/data-error.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/data/display-pronunciation-overrides.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2021-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/data/structured-content-overrides.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2021-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
68 changes: 36 additions & 32 deletions dev/dictionary-validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -23,6 +23,7 @@ import {performance} from 'perf_hooks';
import {fileURLToPath} from 'url';
import {parseJson} from './json.js';
import {createJsonSchema} from './schema-validate.js';
import {toError} from './to-error.js';

const dirname = path.dirname(fileURLToPath(import.meta.url));

Expand All @@ -39,35 +40,33 @@ function readSchema(relativeFileName) {
/**
* @param {import('dev/schema-validate').ValidateMode} mode
* @param {import('jszip')} zip
* @param {string} fileNameFormat
* @param {import('dev/dictionary-validate').Schema} schema
* @param {import('dev/dictionary-validate').SchemasDetails} schemasDetails
*/
async function validateDictionaryBanks(mode, zip, fileNameFormat, schema) {
let jsonSchema;
try {
jsonSchema = createJsonSchema(mode, schema);
} catch (e) {
const e2 = e instanceof Error ? e : new Error(`${e}`);
e2.message += `\n(in file ${fileNameFormat})}`;
throw e2;
}
let index = 1;
while (true) {
const fileName = fileNameFormat.replace(/\?/, `${index}`);
async function validateDictionaryBanks(mode, zip, schemasDetails) {
for (const [fileName, file] of Object.entries(zip.files)) {
for (const [fileNameFormat, schema] of schemasDetails) {
if (!fileNameFormat.test(fileName)) { continue; }

const file = zip.files[fileName];
if (!file) { break; }
let jsonSchema;
try {
jsonSchema = createJsonSchema(mode, schema);
} catch (e) {
const e2 = toError(e);
e2.message += `\n(in file ${fileName})}`;
throw e2;
}

const data = parseJson(await file.async('string'));
try {
jsonSchema.validate(data);
} catch (e) {
const e2 = e instanceof Error ? e : new Error(`${e}`);
e2.message += `\n(in file ${fileName})}`;
throw e2;
}
const data = parseJson(await file.async('string'));

++index;
try {
jsonSchema.validate(data);
} catch (e) {
const e2 = toError(e);
e2.message += `\n(in file ${fileName})}`;
throw e2;
}
break;
}
}
}

Expand All @@ -92,16 +91,21 @@ export async function validateDictionary(mode, archive, schemas) {
const jsonSchema = createJsonSchema(mode, schemas.index);
jsonSchema.validate(index);
} catch (e) {
const e2 = e instanceof Error ? e : new Error(`${e}`);
const e2 = toError(e);
e2.message += `\n(in file ${indexFileName})}`;
throw e2;
}

await validateDictionaryBanks(mode, archive, 'term_bank_?.json', version === 1 ? schemas.termBankV1 : schemas.termBankV3);
await validateDictionaryBanks(mode, archive, 'term_meta_bank_?.json', schemas.termMetaBankV3);
await validateDictionaryBanks(mode, archive, 'kanji_bank_?.json', version === 1 ? schemas.kanjiBankV1 : schemas.kanjiBankV3);
await validateDictionaryBanks(mode, archive, 'kanji_meta_bank_?.json', schemas.kanjiMetaBankV3);
await validateDictionaryBanks(mode, archive, 'tag_bank_?.json', schemas.tagBankV3);
/** @type {import('dev/dictionary-validate').SchemasDetails} */
const schemasDetails = [
[/^term_bank_(\d+)\.json$/, version === 1 ? schemas.termBankV1 : schemas.termBankV3],
[/^term_meta_bank_(\d+)\.json$/, schemas.termMetaBankV3],
[/^kanji_bank_(\d+)\.json$/, version === 1 ? schemas.kanjiBankV1 : schemas.kanjiBankV3],
[/^kanji_meta_bank_(\d+)\.json$/, schemas.kanjiMetaBankV3],
[/^tag_bank_(\d+)\.json$/, schemas.tagBankV3]
];

await validateDictionaryBanks(mode, archive, schemasDetails);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion dev/generate-css-json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2021-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/json.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/dexie.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/handlebars.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/parse5.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/ucs2length.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/wanakana.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/z-worker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/lib/zip.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion dev/manifest-util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2021-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion dev/schema-validate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
18 changes: 18 additions & 0 deletions dev/to-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (C) 2023-2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

export {toError} from '../ext/js/core/to-error.js';
2 changes: 1 addition & 1 deletion dev/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Yomitan Authors
* Copyright (C) 2023-2024 Yomitan Authors
* Copyright (C) 2020-2022 Yomichan Authors
*
* This program is free software: you can redistribute it and/or modify
Expand Down
10 changes: 10 additions & 0 deletions docs/advanced-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Advanced Options

Click the `Advanced` toggle switch in the bottom left corner of the Settings page to enable advanced options.

### Parse sentences using MeCab

[MeCab](https://taku910.github.io/mecab/) is a third-party program which uses its own dictionaries and parsing algorithm to decompose sentences into individual words. MeCab may provide more accurate parsing results than Yomitan's internal parser.

In order for Yomitan to use it, both MeCab and a native messaging component must be installed.
A setup guide can be found [here](https://github.com/themoeway/yomitan-mecab-installer/blob/master/README.md).
Loading

0 comments on commit e986858

Please sign in to comment.