FB2Body constructor

FB2Body(
  1. String body
)

Implementation

FB2Body(final String body) {
  title = RegExp(r'<title>(.+?)<\/title>').firstMatch(body)?.group(1);

  epigraph =
      RegExp(r'<epigraph>([\s\S]+?)<\/epigraph>').firstMatch(body)?.group(1);

  final Iterable<RegExpMatch> sectionsRegExp =
      RegExp(r'<section>([\s\S]+?)<\/section>').allMatches(body);
  if (sectionsRegExp.isNotEmpty) {
    sections = sectionsRegExp.map((e) => FB2Section(e.group(0)!)).toList();
  }
}