1
0
mirror of https://github.com/h7x4/unofficial_jisho_api_dart.git synced 2025-09-14 04:52:45 +02:00

Debug local functions

This commit is contained in:
2020-04-26 13:43:38 +02:00
parent a1a99a90dd
commit 763924531f
3 changed files with 199 additions and 13 deletions

View File

@@ -69,11 +69,20 @@ class YomiExample {
String reading;
String meaning;
YomiExample({String example, String reading, String meaning}){
YomiExample({String example, String reading, String meaning})
{
this.example = example;
this.reading = reading;
this.meaning = meaning;
}
Map<String, String> toJson() =>
{
'example': example,
'reading': reading,
'meaning': meaning
};
}
class Radical {
@@ -86,6 +95,14 @@ class Radical {
this.forms = forms;
this.meaning = meaning;
}
Map<String, dynamic> toJson() =>
{
'symbol': symbol,
'forms': forms,
'meaning': meaning
};
}
class KanjiResult {

View File

@@ -90,7 +90,7 @@ List<YomiExample> getYomiExamples(String pageHtml, String yomiLocatorSymbol) {
return null;
}
final regex = RegExp(r'/<li>(.*?)<\/li>');
final regex = RegExp(r'<li>(.*?)<\/li>', dotAll: true);
final regexResults = getAllGlobalGroupMatches(exampleSection, regex).map((s) => s.trim());
final examples = regexResults.map((regexResult) {
@@ -182,9 +182,9 @@ List<String> getParts(String pageHtml) {
}
String getSvgUri(String pageHtml) {
var svgRegex = RegExp('\/\/.*?.cloudfront.net\/.*?.svg/');
final regexResult = svgRegex.firstMatch(pageHtml).toString();
return regexResult ?? 'http:${regexResult}';
var svgRegex = RegExp('\/\/.*?.cloudfront.net\/.*?.svg');
final regexResult = svgRegex.firstMatch(pageHtml).group(0).toString();
return regexResult.isNotEmpty ? 'http:${regexResult}' : null;
}
String getGifUri(String kanji) {