public ExpressionDocumentation(ResourceKeyStack messagePath, IExpressionParser expr, Type type) { GatherTokens(expr); _name = type.Name; _messagePath = messagePath.BranchFor(expr); _category = CategoryHelper.GetCategory(type); _description = _messagePath.Description; }
public FunctionDocumentation(string libName, ResourceKeyStack messagePath, IFunctionDefinition func) { _libName = libName; _name = func.Name; _arguments = func.Arguments; _returnType = func.ReturnType; _messagePath = messagePath.BranchFor(func); _description = _messagePath.Description; _category = CategoryHelper.GetCategory(func.GetType()); }
public TagDocumentation(ResourceKeyStack messagePath, ITag tag, IList <Func <ITag, TagDocumentation, bool> > specials, Dictionary <int, TagDocumentation> tagDictionary) { _tagDictionary = tagDictionary; _messagePath = messagePath.BranchFor(tag); _name = tag.TagName; var tagType = tag.GetType(); _category = CategoryHelper.GetCategory(tagType); _list = new List <PropertyDocumentation>(); _nested = new List <int>(); _methods = new List <FunctionDocumentation>(); TagBodyMode = tag.TagBodyMode; foreach (var property in tagType.GetCustomAttributes <PropertyAttribute>()) { _list.Add(new PropertyDocumentation(_messagePath, property)); } foreach (var property in tagType.GetProperties( BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.FlattenHierarchy)) { if (Equals(property.PropertyType, typeof(ITagAttribute)) && !IsInternal(property)) { _list.Add(new PropertyDocumentation(_messagePath, property)); } } var extendingTag = tag as ITagExtendTagLib; if (extendingTag != null) { foreach (var nested in extendingTag.TagLibExtension) { var hash = nested.GetType().GetHashCode(); if (!_tagDictionary.ContainsKey(hash)) { _tagDictionary[hash] = null; var tagDoc = new TagDocumentation(_messagePath, nested, specials, _tagDictionary); _tagDictionary[hash] = tagDoc; } _nested.Add(hash); } } var instanceDocumentation = tag as IInstanceTagDocumentation; if (instanceDocumentation != null) { _description = instanceDocumentation.Description; _examples.AddRange(instanceDocumentation.Examples ?? new ExampleAttribute[] {}); _notes.AddRange(instanceDocumentation.Notes ?? new NoteAttribute[] {}); } else { _description = DescriptionAttribute.Harvest(tagType) ?? _messagePath.Description; if (ExampleAttribute.Harvest(tagType)) { _examples.AddRange(ExampleAttribute.HarvestTags(tagType)); } if (HasExample.Has(tagType)) { _examples.Add(new ExampleAttribute(_messagePath.Example)); } if (NoteAttribute.Harvest(tagType)) { _notes.AddRange(NoteAttribute.HarvestTags(tagType)); } if (HasNote.Has(tagType)) { _notes.Add(new NoteAttribute(_messagePath.Note)); } } }