public override SaveResult Save(FileModel model) { if (model.Type != DocumentType.Article) { throw new NotSupportedException(); } var vm = (PageViewModel)model.Content; model.Content = ApiBuildOutput.FromModel(vm); // Fill in details return(new SaveResult { DocumentType = "ManagedReference", ModelFile = model.File, LinkToFiles = ((HashSet <string>)model.Properties.LinkToFiles).ToImmutableArray(), LinkToUids = ((HashSet <string>)model.Properties.LinkToUids).ToImmutableHashSet(), XRefSpecs = (from item in vm.Items select GetXRefInfo(item, model.Key)).ToImmutableArray(), }); }
protected virtual void UpdateModelContent(FileModel model) { var apiModel = ApiBuildOutput.FromModel((PageViewModel)model.Content); // Fill in details model.Content = apiModel; // Fill in bookmarks if template doesn't generate them. // TODO: remove these if (apiModel.Type == MemberType.Namespace) { return; } model.Bookmarks[apiModel.Uid] = string.Empty; // Reference's first level bookmark should have no anchor apiModel.Children?.ForEach(c => { model.Bookmarks[c.Uid] = c.Id; if (!string.IsNullOrEmpty(c.Overload?.Uid)) { model.Bookmarks[c.Overload.Uid] = c.Overload.Id; } }); }
protected virtual void UpdateModelContent(FileModel model) { var apiModel = ApiBuildOutput.FromModel((PageViewModel)model.Content); // Fill in details model.Content = apiModel; }