Skip to content

Commit

Permalink
add alias to anki
Browse files Browse the repository at this point in the history
  • Loading branch information
khaitruong922 committed Jul 26, 2024
1 parent 5e0663c commit 7fd82f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ext/js/data/anki-note-data-creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ function getDefinition(dictionaryEntry, context, resultOutputMode, dictionarySty
* @returns {import('anki-templates').KanjiDictionaryEntry}
*/
function getKanjiDefinition(dictionaryEntry, context) {
const {character, dictionary, onyomi, kunyomi, definitions} = dictionaryEntry;
const {character, dictionary, dictionaryAlias, onyomi, kunyomi, definitions} = dictionaryEntry;

let {url} = context;
if (typeof url !== 'string') { url = ''; }
Expand All @@ -343,6 +343,7 @@ function getKanjiDefinition(dictionaryEntry, context) {
type: 'kanji',
character,
dictionary,
dictionaryAlias,
onyomi,
kunyomi,
glossary: definitions,
Expand Down Expand Up @@ -422,7 +423,7 @@ function getTermDefinition(dictionaryEntry, context, resultOutputMode, dictionar
case 'merge': type = 'termMerged'; break;
}

const {inflectionRuleChainCandidates, score, dictionaryIndex, dictionaryPriority, sourceTermExactMatchCount, definitions} = dictionaryEntry;
const {inflectionRuleChainCandidates, score, dictionaryIndex, dictionaryAlias, dictionaryPriority, sourceTermExactMatchCount, definitions} = dictionaryEntry;

let {url} = context;
if (typeof url !== 'string') { url = ''; }
Expand Down Expand Up @@ -455,6 +456,7 @@ function getTermDefinition(dictionaryEntry, context, resultOutputMode, dictionar
isPrimary: (type === 'term' ? dictionaryEntry.isPrimary : void 0),
get sequence() { return getCachedValue(sequence); },
get dictionary() { return getCachedValue(dictionaryNames)[0]; },
dictionaryAlias,
dictionaryOrder: {
index: dictionaryIndex,
priority: dictionaryPriority,
Expand Down
2 changes: 2 additions & 0 deletions types/ext/anki-templates.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export type KanjiDictionaryEntry = {
type: 'kanji';
character: string;
dictionary: string;
dictionaryAlias: string;
onyomi: string[];
kunyomi: string[];
glossary: string[];
Expand Down Expand Up @@ -179,6 +180,7 @@ export type TermDictionaryEntry = {
isPrimary?: boolean;
readonly sequence: number;
readonly dictionary: string;
readonly dictionaryAlias: string;
dictionaryOrder: {
index: number;
priority: number;
Expand Down

0 comments on commit 7fd82f1

Please sign in to comment.