Skip to content

Commit e37de1b

Browse files
committed
Update version and lint
1 parent 202be67 commit e37de1b

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 2.0.4
2+
3+
- Fixed bug where pieces were missing in example sentences
4+
- Fixed bug where some scrapeForPhrase searches would crash for no apparent reason.
5+
16
## 2.0.3
27

38
- Bug fixes

lib/src/example_search.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,18 @@ List<String> _getKanjiAndKana(Element div) {
9292
return [kanji, kana];
9393
}
9494

95-
Element normalizeSentenceElement(Element sentenceElement) =>
96-
Element.html('<ul>' +
97-
sentenceElement.children.first.innerHtml.replaceAllMapped(
98-
RegExp(r'(?<=^|<\/li>)\s*([^<>]+)\s*(?=<li)'),
99-
(match) =>
100-
'<li class="clearfix"><span class="unlinked">${match.group(0)}</span></li>',
101-
) +
95+
Element _normalizeSentenceElement(Element sentenceElement) =>
96+
Element.html('<ul>'
97+
'${sentenceElement.children.first.innerHtml.replaceAllMapped(
98+
RegExp(r'(?<=^|<\/li>)\s*([^<>]+)\s*(?=<li)'),
99+
(match) =>
100+
'<li class="clearfix"><span class="unlinked">${match.group(0)}</span></li>',
101+
)}'
102102
'</ul>');
103103

104+
// ignore: public_member_api_docs
104105
List<ExampleSentencePiece> getPieces(Element sentenceElement) {
105-
return normalizeSentenceElement(sentenceElement)
106+
return _normalizeSentenceElement(sentenceElement)
106107
.querySelectorAll('li.clearfix')
107108
.map((var e) {
108109
final unlifted = assertNotNull(

lib/src/phrase_scrape.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ PhrasePageScrapeResultData _getMeaningsOtherFormsAndNotes(
159159
var notes;
160160

161161
for (var child in meaningsWrapper.children) {
162-
final mostRecentWordType = mostRecentWordTypes.length >= 1 ? mostRecentWordTypes[0] : null;
162+
final mostRecentWordType = mostRecentWordTypes.isNotEmpty ? mostRecentWordTypes[0] : null;
163163
if (child.className.contains('meaning-tags')) {
164164
mostRecentWordTypes = _getMostRecentWordTypes(child);
165165
} else if (mostRecentWordType == 'other forms') {

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: unofficial_jisho_api
2-
version: 2.0.3
2+
version: 2.0.4
33

44
description: An unofficial api for searching and scraping the japanese dictionary Jisho.org
55
homepage: https://github.com/h7x4ABk3g/unofficial_jisho_api_dart/
@@ -14,7 +14,7 @@ dependencies:
1414
html: ^0.15.0
1515

1616
dev_dependencies:
17-
pedantic: ^1.11.1
17+
lints: ^1.0.1
1818
test: ^1.17.10
1919
path: ^1.8.0
2020
effective_dart: ^1.3.2

0 commit comments

Comments
 (0)