buildAllMetaInfo method

  1. @visibleForTesting
Map<String, MetaInfo> buildAllMetaInfo(
  1. Document htmlDocument
)

Construct all MetaInfo with given Document.

It returns an unmodifiable Map which contains all registered MetaPropertyParser's results with MetaPropertyParser.propertyNamePrefix as a key of the Map.

Implementation

@visibleForTesting
Map<String, MetaInfo> buildAllMetaInfo(Document htmlDocument) {
  Map<String, MetaInfo> metaInfoMap = HashMap<String, MetaInfo>();

  for (String prefix in _prefixSequence(htmlDocument)) {
    try {
      var parser = _findCorrespondedParser(prefix);
      metaInfoMap[prefix] = parser.parse(htmlDocument.head!);
    } on StateError {
      // If the prefix does not supported.
      continue;
    }
  }

  return Map.unmodifiable(metaInfoMap);
}