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

Update version and lint

This commit is contained in:
2022-02-13 01:18:27 +01:00
parent 202be67ebb
commit e37de1bdb1
4 changed files with 17 additions and 11 deletions

View File

@@ -92,17 +92,18 @@ List<String> _getKanjiAndKana(Element div) {
return [kanji, kana];
}
Element normalizeSentenceElement(Element sentenceElement) =>
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>',
) +
Element _normalizeSentenceElement(Element sentenceElement) =>
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>');
// ignore: public_member_api_docs
List<ExampleSentencePiece> getPieces(Element sentenceElement) {
return normalizeSentenceElement(sentenceElement)
return _normalizeSentenceElement(sentenceElement)
.querySelectorAll('li.clearfix')
.map((var e) {
final unlifted = assertNotNull(

View File

@@ -159,7 +159,7 @@ PhrasePageScrapeResultData _getMeaningsOtherFormsAndNotes(
var notes;
for (var child in meaningsWrapper.children) {
final mostRecentWordType = mostRecentWordTypes.length >= 1 ? mostRecentWordTypes[0] : null;
final mostRecentWordType = mostRecentWordTypes.isNotEmpty ? mostRecentWordTypes[0] : null;
if (child.className.contains('meaning-tags')) {
mostRecentWordTypes = _getMostRecentWordTypes(child);
} else if (mostRecentWordType == 'other forms') {