Update version and lint

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

View File

@ -1,3 +1,8 @@
# 2.0.4
- Fixed bug where pieces were missing in example sentences
- Fixed bug where some scrapeForPhrase searches would crash for no apparent reason.
## 2.0.3
- Bug fixes

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(
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') {

View File

@ -1,5 +1,5 @@
name: unofficial_jisho_api
version: 2.0.3
version: 2.0.4
description: An unofficial api for searching and scraping the japanese dictionary Jisho.org
homepage: https://github.com/h7x4ABk3g/unofficial_jisho_api_dart/
@ -14,7 +14,7 @@ dependencies:
html: ^0.15.0
dev_dependencies:
pedantic: ^1.11.1
lints: ^1.0.1
test: ^1.17.10
path: ^1.8.0
effective_dart: ^1.3.2