mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-02-28 06:22:45 -08:00
update docs and config
This commit is contained in:
@@ -183,6 +183,10 @@ function isKanaChar(char: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects repeated-kana speech-like tokens (e.g. 「ああああ」, 「ははは」, 「うーん」 style patterns)
|
||||
* so they are not JLPT-labeled when they are mostly expressive particles/sfx.
|
||||
*/
|
||||
function isRepeatedKanaSfx(text: string): boolean {
|
||||
const normalized = text.trim();
|
||||
if (!normalized) {
|
||||
|
||||
11
src/main.ts
11
src/main.ts
@@ -470,20 +470,23 @@ function loadSubtitlePosition(): SubtitlePosition | null {
|
||||
function getJlptDictionarySearchPaths(): string[] {
|
||||
const homeDir = os.homedir();
|
||||
const dictionaryRoots = [
|
||||
// Source checkout paths (development + source tree)
|
||||
// Development/runtime source trees where the repo is checked out.
|
||||
path.join(__dirname, "..", "..", "vendor", "yomitan-jlpt-vocab"),
|
||||
path.join(app.getAppPath(), "vendor", "yomitan-jlpt-vocab"),
|
||||
// Runtime package bundle paths
|
||||
|
||||
// Packaged app resources (Electron build output layout).
|
||||
path.join(process.resourcesPath, "yomitan-jlpt-vocab"),
|
||||
path.join(process.resourcesPath, "app.asar", "vendor", "yomitan-jlpt-vocab"),
|
||||
// User-configurable override locations
|
||||
|
||||
// User override/config directories for manually installed dictionaries.
|
||||
USER_DATA_PATH,
|
||||
app.getPath("userData"),
|
||||
path.join(homeDir, ".config", "SubMiner"),
|
||||
path.join(homeDir, ".config", "subminer"),
|
||||
path.join(homeDir, "Library", "Application Support", "SubMiner"),
|
||||
path.join(homeDir, "Library", "Application Support", "subminer"),
|
||||
// CLI invocation path (when launched from project root)
|
||||
|
||||
// Last-resort fallback: current working directory (local CLI/test runs).
|
||||
process.cwd(),
|
||||
];
|
||||
|
||||
|
||||
@@ -55,10 +55,19 @@ test("computeWordClass preserves known and n+1 classes while adding JLPT classes
|
||||
});
|
||||
|
||||
test("JLPT CSS rules use underline-only styling in renderer stylesheet", () => {
|
||||
const cssText = fs.readFileSync(
|
||||
path.join(process.cwd(), "dist", "renderer", "style.css"),
|
||||
"utf-8",
|
||||
);
|
||||
const distCssPath = path.join(process.cwd(), "dist", "renderer", "style.css");
|
||||
const srcCssPath = path.join(process.cwd(), "src", "renderer", "style.css");
|
||||
|
||||
const cssPath = fs.existsSync(distCssPath)
|
||||
? distCssPath
|
||||
: srcCssPath;
|
||||
if (!fs.existsSync(cssPath)) {
|
||||
assert.fail(
|
||||
"JLPT CSS file missing. Run `pnpm run build` first, or ensure src/renderer/style.css exists.",
|
||||
);
|
||||
}
|
||||
|
||||
const cssText = fs.readFileSync(cssPath, "utf-8");
|
||||
|
||||
for (let level = 1; level <= 5; level += 1) {
|
||||
const block = extractClassBlock(cssText, level);
|
||||
|
||||
Reference in New Issue
Block a user