toRawBook function

RawBook toRawBook(
  1. SrcBook srcBook,
  2. String shelfFolderPath
)

convert src book to dart code

Implementation

RawBook toRawBook(SrcBook srcBook, String shelfFolderPath) {
  // Book: src --> raw
  final codeName = toCodeName(srcBook.name);
  final folderPath = '$shelfFolderPath/$codeName';
  final filePath = '$folderPath$dartExt';
  // Page: src --> raw
  final List<RawPage> rawPages = [];
  for (final srcPage in srcBook.pages) {
    final rawPage = toRawPage(srcPage, folderPath);
    rawPages.add(rawPage);
  }

  final dart = toDartBook(srcBook);
  final rawBook = RawBook(
    pages: rawPages,
    fileContent: dart,
    folderPath: folderPath,
    filePath: filePath,
  );
  return rawBook;
}