Fix end symbol bug

This commit is contained in:
Oystein Kristoffer Tveit 2020-06-17 11:11:56 +02:00
parent 0194e3a7a0
commit 510b27b802
1 changed files with 8 additions and 0 deletions

View File

@ -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,