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

Fix translator script #2

Merged
merged 1 commit into from May 12, 2021
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
19 changes: 10 additions & 9 deletions app/src/main/assets/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ var HtmlToDatTranslator = /** @class */ (function (_super) {
.replace(/<img src="http(:\/\/[^"]+)">/g, 'sssp$1');
if (title !== null) {
this.openDat();
this.writeDat(mail + "<>" + name_1 + "<>" + date + "<>" + message + "<>" + title + "\n");
this.writeDat(name_1 + "<>" + mail + "<>" + date + "<>" + message + "<>" + title + "\n");
title = null;
}
else {
this.writeDat(mail + "<>" + name_1 + "<>" + date + "<>" + message + "<>\n");
this.writeDat(name_1 + "<>" + mail + "<>" + date + "<>" + message + "<>\n");
}
}
}
Expand All @@ -147,11 +147,11 @@ var HtmlToDatTranslator = /** @class */ (function (_super) {
.replace(/<img src="(\/\/[^"]+)">/g, 'sssp:$1');
if (title !== null) {
this.openDat();
this.writeDat(mail + "<>" + name_2 + "<>" + date + "<>" + message + "<>" + title + "\n");
this.writeDat(name_2 + "<>" + mail + "<>" + date + "<>" + message + "<>" + title + "\n");
title = null;
}
else {
this.writeDat(mail + "<>" + name_2 + "<>" + date + "<>" + message + "<>\n");
this.writeDat(name_2 + "<>" + mail + "<>" + date + "<>" + message + "<>\n");
}
}
}
Expand All @@ -178,11 +178,11 @@ var HtmlToDatTranslator = /** @class */ (function (_super) {
.replace(/<img src="(\/\/[^"]+)">/g, 'sssp:$1');
if (title !== null) {
this.openDat();
this.writeDat(mail + "<>" + name_3 + "<>" + date + "<>" + message + "<>" + title + "\n");
this.writeDat(name_3 + "<>" + mail + "<>" + date + "<>" + message + "<>" + title + "\n");
title = null;
}
else {
this.writeDat(mail + "<>" + name_3 + "<>" + date + "<>" + message + "<>\n");
this.writeDat(name_3 + "<>" + mail + "<>" + date + "<>" + message + "<>\n");
}
}
}
Expand All @@ -209,11 +209,11 @@ var HtmlToDatTranslator = /** @class */ (function (_super) {
.replace(/<img src="http(:\/\/[^"]+)">/g, 'sssp$1');
if (title !== null) {
this.openDat();
this.writeDat(mail + "<>" + name_4 + "<>" + date + "<>" + message + "<>" + title + "\n");
this.writeDat(name_4 + "<>" + mail + "<>" + date + "<>" + message + "<>" + title + "\n");
title = null;
}
else {
this.writeDat(mail + "<>" + name_4 + "<>" + date + "<>" + message + "<>\n");
this.writeDat(name_4 + "<>" + mail + "<>" + date + "<>" + message + "<>\n");
}
}
}
Expand Down Expand Up @@ -269,7 +269,8 @@ var ScToNetTranslator = /** @class */ (function (_super) {
if (res.length < 4)
break;
res[0] = res[0]
.replace(/@\(^o^)//g, '@無断転載禁止');
.replace(/アフィサイトへの\\(\^o\^\)/です/g, 'アフィサイトへの転載は禁止です')
.replace(/@\\(\^o\^\)//g, '@無断転載禁止');
res[2] = res[2]
.replace(/<a href="http:\/\/be\.[25]ch\.net\/user\/(\d+)"[^>]*>\?([^<]+)<\/a>/g, 'BE:$1-$2')
.replace(/( ID:[^ .]+)($| )/g, '$1.sc$2')
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/script/src/translator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ class HtmlToDatTranslator extends Translator {
.replace(/<img src="http(:\/\/[^"]+)">/g, 'sssp$1');
if (title !== null) {
this.openDat();
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>${title}\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>${title}\n`);
title = null;
}
else {
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>\n`);
}
}
}
Expand All @@ -140,11 +140,11 @@ class HtmlToDatTranslator extends Translator {
.replace(/<img src="(\/\/[^"]+)">/g, 'sssp:$1');
if (title !== null) {
this.openDat();
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>${title}\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>${title}\n`);
title = null;
}
else {
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>\n`);
}
}
}
Expand All @@ -171,11 +171,11 @@ class HtmlToDatTranslator extends Translator {
.replace(/<img src="(\/\/[^"]+)">/g, 'sssp:$1');
if (title !== null) {
this.openDat();
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>${title}\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>${title}\n`);
title = null;
}
else {
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>\n`);
}
}
}
Expand All @@ -202,11 +202,11 @@ class HtmlToDatTranslator extends Translator {
.replace(/<img src="http(:\/\/[^"]+)">/g, 'sssp$1');
if (title !== null) {
this.openDat();
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>${title}\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>${title}\n`);
title = null;
}
else {
this.writeDat(`${mail}<>${name}<>${date}<>${message}<>\n`);
this.writeDat(`${name}<>${mail}<>${date}<>${message}<>\n`);
}
}
}
Expand Down Expand Up @@ -258,7 +258,8 @@ class ScToNetTranslator extends Translator {
if (res.length < 4)
break
res[0] = res[0]
.replace(/@\(^o^)//g, '@無断転載禁止');
.replace(/アフィサイトへの\\(\^o\^\)/です/g, 'アフィサイトへの転載は禁止です')
.replace(/@\\(\^o\^\)//g, '@無断転載禁止');
res[2] = res[2]
.replace(/<a href="http:\/\/be\.[25]ch\.net\/user\/(\d+)"[^>]*>\?([^<]+)<\/a>/g, 'BE:$1-$2')
.replace(/( ID:[^ .]+)($| )/g, '$1.sc$2')
Expand Down