mirror of
https://github.com/h7x4/unofficial_jisho_api_dart.git
synced 2025-12-18 00:20:24 +01:00
Fix end symbol bug
This commit is contained in:
@@ -237,6 +237,11 @@ String uriForExampleSearch(String phrase) {
|
|||||||
return '${SCRAPE_BASE_URI}${Uri.encodeComponent(phrase)}%23sentences';
|
return '${SCRAPE_BASE_URI}${Uri.encodeComponent(phrase)}%23sentences';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getEndSymbolsOfExampleSentence(Element ul) {
|
||||||
|
final endSymbols = RegExp(r'<\/li>([^<>]+)$');
|
||||||
|
return endSymbols.firstMatch(ul.innerHtml).group(1);
|
||||||
|
}
|
||||||
|
|
||||||
ExampleResultData getKanjiAndKana(Element div) {
|
ExampleResultData getKanjiAndKana(Element div) {
|
||||||
final ul = div.querySelector('ul');
|
final ul = div.querySelector('ul');
|
||||||
final contents = ul.children;
|
final contents = ul.children;
|
||||||
@@ -277,6 +282,9 @@ ExampleResultData getKanjiAndKana(Element div) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final endSymbols = getEndSymbolsOfExampleSentence(ul).trim();
|
||||||
|
kanji+= endSymbols;
|
||||||
|
kana += endSymbols;
|
||||||
|
|
||||||
return ExampleResultData(
|
return ExampleResultData(
|
||||||
kanji: kanji,
|
kanji: kanji,
|
||||||
|
|||||||
Reference in New Issue
Block a user