disable furigana cleaning
This commit is contained in:
1 parent
5cc5272f77
commit
ae3e2840e1
1 file changed
+19
-9
+19
-9
@@ -365,9 +365,9 @@ export class WaniKani {
|
|||||||
for (const n of notes) {
|
for (const n of notes) {
|
||||||
const { value: ja } = n.fields[fields.ja] || {};
|
const { value: ja } = n.fields[fields.ja] || {};
|
||||||
if (ja) {
|
if (ja) {
|
||||||
const audio = audioMap.get(
|
// const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '')
|
||||||
ja.replace(/\[.+?\]/g, '').replace(/ /g, ''),
|
const cleanJa = ja;
|
||||||
);
|
const audio = audioMap.get(cleanJa);
|
||||||
if (audio) {
|
if (audio) {
|
||||||
notesToUpdate.push({
|
notesToUpdate.push({
|
||||||
id: n.noteId,
|
id: n.noteId,
|
||||||
@@ -467,7 +467,8 @@ export class WaniKani {
|
|||||||
for (const n of notes) {
|
for (const n of notes) {
|
||||||
const { value: ja } = n.fields[fields.vocabJa] || {};
|
const { value: ja } = n.fields[fields.vocabJa] || {};
|
||||||
if (ja) {
|
if (ja) {
|
||||||
const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '');
|
// const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '');
|
||||||
|
const cleanJa = ja;
|
||||||
const sent = sentenceMap.get(cleanJa);
|
const sent = sentenceMap.get(cleanJa);
|
||||||
if (sent) {
|
if (sent) {
|
||||||
const fieldUpdate = {
|
const fieldUpdate = {
|
||||||
@@ -479,10 +480,19 @@ export class WaniKani {
|
|||||||
fields.sentenceCloze &&
|
fields.sentenceCloze &&
|
||||||
!n.fields[fields.sentenceCloze]?.value
|
!n.fields[fields.sentenceCloze]?.value
|
||||||
) {
|
) {
|
||||||
fieldUpdate[fields.sentenceCloze] = sent.sentences
|
const clozeChar = '__';
|
||||||
|
let newSent = sent.sentences
|
||||||
.map(({ ja, en }) => `${ja}<br/>${en}`)
|
.map(({ ja, en }) => `${ja}<br/>${en}`)
|
||||||
.join('<br/>')
|
.join('<br/>')
|
||||||
.replace(cleanJa, '__');
|
.replace(cleanJa, clozeChar);
|
||||||
|
|
||||||
|
cleanJa.split(/[\p{sc=Hiragana}]+/gu).map((c) => {
|
||||||
|
if (c) {
|
||||||
|
newSent = newSent.replace(c, clozeChar);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
fieldUpdate[fields.sentenceCloze] = newSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
notesToUpdate.push({
|
notesToUpdate.push({
|
||||||
@@ -554,9 +564,9 @@ export class WaniKani {
|
|||||||
for (const n of notes) {
|
for (const n of notes) {
|
||||||
const { value: ja } = n.fields[fields.ja] || {};
|
const { value: ja } = n.fields[fields.ja] || {};
|
||||||
if (ja) {
|
if (ja) {
|
||||||
const vocab = vocabMap.get(
|
// const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '')
|
||||||
ja.replace(/\[.+?\]/g, '').replace(/ /g, ''),
|
const cleanJa = ja;
|
||||||
);
|
const vocab = vocabMap.get(cleanJa);
|
||||||
if (vocab) {
|
if (vocab) {
|
||||||
notesToUpdate.push({
|
notesToUpdate.push({
|
||||||
id: n.noteId,
|
id: n.noteId,
|
||||||
|
|||||||
Reference in new issue
Block a user