|
|
@ -365,9 +365,9 @@ export class WaniKani { |
|
|
|
for (const n of notes) { |
|
|
|
const { value: ja } = n.fields[fields.ja] || {}; |
|
|
|
if (ja) { |
|
|
|
const audio = audioMap.get( |
|
|
|
ja.replace(/\[.+?\]/g, '').replace(/ /g, ''), |
|
|
|
); |
|
|
|
// const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '')
|
|
|
|
const cleanJa = ja; |
|
|
|
const audio = audioMap.get(cleanJa); |
|
|
|
if (audio) { |
|
|
|
notesToUpdate.push({ |
|
|
|
id: n.noteId, |
|
|
@ -467,7 +467,8 @@ export class WaniKani { |
|
|
|
for (const n of notes) { |
|
|
|
const { value: ja } = n.fields[fields.vocabJa] || {}; |
|
|
|
if (ja) { |
|
|
|
const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, ''); |
|
|
|
// const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '');
|
|
|
|
const cleanJa = ja; |
|
|
|
const sent = sentenceMap.get(cleanJa); |
|
|
|
if (sent) { |
|
|
|
const fieldUpdate = { |
|
|
@ -479,10 +480,19 @@ export class WaniKani { |
|
|
|
fields.sentenceCloze && |
|
|
|
!n.fields[fields.sentenceCloze]?.value |
|
|
|
) { |
|
|
|
fieldUpdate[fields.sentenceCloze] = sent.sentences |
|
|
|
const clozeChar = '__'; |
|
|
|
let newSent = sent.sentences |
|
|
|
.map(({ ja, en }) => `${ja}<br/>${en}`) |
|
|
|
.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({ |
|
|
@ -554,9 +564,9 @@ export class WaniKani { |
|
|
|
for (const n of notes) { |
|
|
|
const { value: ja } = n.fields[fields.ja] || {}; |
|
|
|
if (ja) { |
|
|
|
const vocab = vocabMap.get( |
|
|
|
ja.replace(/\[.+?\]/g, '').replace(/ /g, ''), |
|
|
|
); |
|
|
|
// const cleanJa = ja.replace(/\[.+?\]/g, '').replace(/ /g, '')
|
|
|
|
const cleanJa = ja; |
|
|
|
const vocab = vocabMap.get(cleanJa); |
|
|
|
if (vocab) { |
|
|
|
notesToUpdate.push({ |
|
|
|
id: n.noteId, |
|
|
|