pageJson method

Map<String, dynamic> pageJson(
  1. BookPage page, {
  2. bool withContent = true,
})

Implementation

Map<String, dynamic> pageJson(BookPage page, {bool withContent = true}) {
  final file = page.filename;
  final article = summary.byPath(file);
  final attributes = page.attributes;
  return {
    'page': {
      if (withContent) 'content': page.content,
      'dir': page.dir,
      if (attributes != null) ...attributes,
      if (article != null) ...navJson(article),
    },
    'file': {
      'path': file,
    },
  };
}