FB2Description constructor
Implementation
FB2Description(final String description, this.coverPage) {
final Iterable<RegExpMatch> genresRegExp =
RegExp(r'<genre>(.+?)<\/genre>').allMatches(description);
for (final RegExpMatch genre in genresRegExp) {
genres?.add(genre.group(1) ?? '');
}
final Iterable<RegExpMatch> keywordsRegExp =
RegExp(r'<keywords>(.+?)<\/keywords>').allMatches(description);
// for (final RegExpMatch keyword in keywordsRegExp) {
// keywords?.add(keyword.group(1) ?? '');
// }
keywords = keywordsRegExp.map((e) => e.group(1) ?? '').toList();
final Iterable<RegExpMatch> authorsRegExp =
RegExp(r'<author>([\s\S]+?)<\/author>').allMatches(description);
// for (final RegExpMatch author in authorsRegExp) {
// authors?.add(FB2Author(author.group(1) ?? ''));
// }
authors = authorsRegExp.map((e) => FB2Author(e.group(1) ?? '')).toList();
title = RegExp(r'<book-title>(.+?)<\/book-title>')
.firstMatch(description)
?.group(1);
annotation = RegExp(r'<annotation>([\s\S]+?)<\/annotation>')
.firstMatch(description)
?.group(1);
date = RegExp(r'<date>(.+?)<\/date>').firstMatch(description)?.group(1);
lang = RegExp(r'<lang>(.+?)<\/lang>').firstMatch(description)?.group(1);
srcLang = RegExp(r'<src-lang>(.+?)<\/src-lang>')
.firstMatch(description)
?.group(1);
sequence = RegExp(r'<sequence name="([\s\S]+?)"\/\>')
.firstMatch(description)
?.group(1);
}