add how to populate from wanikani

This commit is contained in:
polv committed 2022-04-28 13:28:06 +07:00
1 parent 92c1de3d1f
commit 45232b33fc
4 files changed
+130 -28

No files matched your search

+20
View File
@@ -46,3 +46,23 @@ export interface IAnkiTemplate {
export interface IAnkiDeckConfig {
id: number;
}
export const soundTag = {
pre: '[sound:',
post: ']',
is(src: string) {
return src.startsWith(this.pre) && src.endsWith(this.post);
},
add(src: string) {
if (soundTag.is(src)) return src;
return this.pre + src + this.post;
},
remove(src: string) {
if (!soundTag.is(src)) return src;
if (this.isEmpty(src)) return src;
return src.substring(this.pre.length, src.length - this.post.length);
},
isEmpty(src: string) {
return src === this.pre + this.post;
},
};
+20 -8
View File
@@ -99,14 +99,25 @@ interface ISubjectBase<
export type IRadical = ISubjectBase<
'radical',
{
character_images: {
character_images: ({
url: string;
metadata: {
inline_styles?: boolean;
dimensions?: string;
};
content_type: string;
}[];
} & (
| {
metadata: {
inline_styles?: boolean;
dimensions?: string;
};
content_type: 'image/svg+xml';
}
| {
metadata: {
color: string;
dimensions: string;
style_name: string;
};
content_type: 'image/png';
}
))[];
amalgamation_subject_ids: SubjectID[];
}
>;
@@ -117,7 +128,8 @@ export type IKanji = ISubjectBase<
readings: {
reading: string;
primary: boolean;
type: 'kunyomi' | 'onyomi';
accepted_answer: boolean;
type: 'kunyomi' | 'onyomi' | 'nanori';
}[];
component_subject_ids: SubjectID[];
visually_similar_subject_ids: SubjectID[];