begin method

  1. @override
void begin(
  1. TagContext tc,
  2. String data
)
override

Called when the beginning of a tag is encountered.

Implementation

@override
void begin(TagContext tc, String data) {
  String? partOf, parts, imports, name, desc, args, ctype, dart,
    lastModified, etag;

  final attrs = parseArgs(data);
  attrs.forEach((nm, val) {
    switch (nm) {
      case "partOf":
      case "part-of":
        partOf = val;
        break;
      case "part":
        parts = val;
        break;
      case "import":
        imports = val;
        break;
      case "name":
        name = val;
        break;
      case "content-type":
      case "contentType":
        ctype = val;
        break;
      case "args":
      case "arguments":
        if ((args = val.trim()).isEmpty) args = null;
        break;
      case "description":
        desc = val;
        break;
      case "dart":
        dart = val;
        break;
      case "last-modified":
      case "lastModified":
        lastModified = val;
        break;
      case "etag":
        etag = val;
        break;
      default:
        tc.warning("Unknown attribute: $nm");
        break;
    }
  });
  tc.compiler.setPage(partOf, parts, imports, name, desc, args, ctype, dart,
    lastModified, etag);
}