NotationSiteFiles constructor

NotationSiteFiles(
  1. Map<String, String> files, {
  2. Catalog? catalog,
})

Reads files (path → text). The manifest is site/site.json, else site.json; the pages are pages/*.txt (else site/pages/*.txt), the components components/*.txt (and site/components/*.txt). Any other file is not read. catalog says which words the notation already has (a component of such a name is said).

Implementation

NotationSiteFiles(Map<String, String> files, {Catalog? catalog})
    : files = {for (final e in files.entries) notationSitePath(e.key): e.value},
      _catalog = catalog ?? Catalog.current {
  final text = this.files['site/${SiteManifest.fileName}'] ?? this.files[SiteManifest.fileName];
  if (text != null && text.trim().isNotEmpty) {
    try {
      manifest = readMap(jsonDecode(text)) ?? const {};
    } on FormatException catch (e) {
      problems.add((path: manifestPath, line: null, message: '$manifestPath is not JSON (${e.message}): its variables, theme and pages were not read'));
    }
  }
  _readComponents();
  _checkRings();
}