Fix example sentence missing pieces bug
This commit is contained in:
parent
cf70eea0a1
commit
202be67ebb
|
@ -92,10 +92,19 @@ List<String> _getKanjiAndKana(Element div) {
|
||||||
return [kanji, kana];
|
return [kanji, kana];
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExampleSentencePiece> getPieces(Element sentenceElement) {
|
Element normalizeSentenceElement(Element sentenceElement) =>
|
||||||
final pieceElements = sentenceElement.querySelectorAll('li.clearfix');
|
Element.html('<ul>' +
|
||||||
|
sentenceElement.children.first.innerHtml.replaceAllMapped(
|
||||||
|
RegExp(r'(?<=^|<\/li>)\s*([^<>]+)\s*(?=<li)'),
|
||||||
|
(match) =>
|
||||||
|
'<li class="clearfix"><span class="unlinked">${match.group(0)}</span></li>',
|
||||||
|
) +
|
||||||
|
'</ul>');
|
||||||
|
|
||||||
return pieceElements.map((var e) {
|
List<ExampleSentencePiece> getPieces(Element sentenceElement) {
|
||||||
|
return normalizeSentenceElement(sentenceElement)
|
||||||
|
.querySelectorAll('li.clearfix')
|
||||||
|
.map((var e) {
|
||||||
final unlifted = assertNotNull(
|
final unlifted = assertNotNull(
|
||||||
variable: e.querySelector('.unlinked')?.text,
|
variable: e.querySelector('.unlinked')?.text,
|
||||||
errorMessage:
|
errorMessage:
|
||||||
|
|
Loading…
Reference in New Issue