toRawShelf function

RawShelf toRawShelf(
  1. SrcShelf srcShelf,
  2. String dataFolderPath,
  3. CometYaml cometYaml
)

Src --> Raw

Implementation

RawShelf toRawShelf(
  SrcShelf srcShelf,
  String dataFolderPath,
  CometYaml cometYaml,
) {
  // Shelf: src --> raw
  final codeName = toCodeName(srcShelf.name);
  final folderPath = '$dataFolderPath/$codeName';
  final filePath = '$folderPath$dartExt';

  final List<RawBook> rawBooks = [];
  for (final srcBook in srcShelf.books) {
    final rawBook = toRawBook(srcBook, folderPath);
    rawBooks.add(rawBook);
  }

  final dart = toDartShelf(srcShelf, cometYaml);
  final rawShelf = RawShelf(
    books: rawBooks,
    fileContent: dart,
    folderPath: folderPath,
    filePath: filePath,
  );
  return rawShelf;
}