Skip to content

Commit

Permalink
Merge pull request #338 from Aegyo/feature/migaku-readings
Browse files Browse the repository at this point in the history
Migaku Dictionary - Get reading from 'pronunciation' field
  • Loading branch information
arianneorpilla authored Jan 4, 2024
2 parents 6802fab + 274b417 commit 92cd027
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ void prepareEntriesMigakuFormat({

String term = (map['term'] as String).trim();
String definition = map['definition'] as String;
String reading = map['pronunciation'] ?? '';

definition = definition
.replaceAll('<br>', '\n')
.replaceAll(RegExp('<[^<]+?>'), '');

int headingId = DictionaryHeading.hash(term: term, reading: '');
int headingId = DictionaryHeading.hash(term: term, reading: reading);
DictionaryHeading heading = isar.dictionaryHeadings.getSync(headingId) ??
DictionaryHeading(term: term);
DictionaryHeading(term: term, reading: reading);

DictionaryEntry entry = DictionaryEntry(
definitions: [definition],
Expand Down

0 comments on commit 92cd027

Please sign in to comment.