Esempio n. 1
0
        public TagGroupDocumentation(ResourceKeyStack messagePath, ITagGroup tagGroup, IList<Func<ITag, TagDocumentation, bool>> specials)
        {
            _messagePath = messagePath.BranchFor(tagGroup);
            _name = tagGroup.Name;
            _specials = specials;
            _tags = new List<TagDocumentation>();
            var tagGroupType=tagGroup.GetType();
            _description=DescriptionAttribute.Harvest(tagGroupType)?? _messagePath.Description;

            _title = TitleAttribute.HarvestTagLibrary(tagGroupType);
            foreach (ITag _tag in tagGroup)
            {
                _tags.Add(new TagDocumentation(_messagePath, _tag, _specials));
            }
            if (ExampleAttribute.Harvest(tagGroupType))
            {
                _examples.AddRange(ExampleAttribute.HarvestTags(tagGroupType));
            }
            if (HasExample.Has(tagGroupType))
            {
                _examples.Add(new ExampleAttribute(_messagePath.Example));
            }
            if (NoteAttribute.Harvest(tagGroupType))
            {
                _notes.AddRange(NoteAttribute.HarvestTags(tagGroupType));
            }
            if (HasNote.Has(tagGroupType))
            {
                _notes.Add(new NoteAttribute(_messagePath.Note));
            }
        }
Esempio n. 2
0
 private void AppendGroup(StringBuilder result)
 {
     if (_group != null)
     {
         if (!_tags.Any() ||
             _attribute == null ||
             Equals(_tags.Last().GetType(), _attribute.DeclaringType)
             )
         {
             result.Append("_" + _group.GetType().Name);
         }
         AppendTag(result);
     }
 }
        public TagGroupDocumentation(ResourceKeyStack messagePath, ITagGroup tagGroup, IList <Func <ITag, TagDocumentation, bool> > specials, Dictionary <int, TagDocumentation> tagDictionary)
        {
            _messagePath   = messagePath.BranchFor(tagGroup);
            _name          = tagGroup.Name;
            _specials      = specials;
            _tagDictionary = tagDictionary;
            _tags          = new List <int>();
            var tagGroupType = tagGroup.GetType();

            _description = DescriptionAttribute.Harvest(tagGroupType) ?? _messagePath.Description;

            _title = TitleAttribute.HarvestTagLibrary(tagGroupType);
            foreach (ITag _tag in tagGroup)
            {
                var hash = _tag.GetType().GetHashCode();
                if (!_tagDictionary.ContainsKey(hash))
                {
                    _tagDictionary[hash] = null;
                    var tagDoc = new TagDocumentation(_messagePath, _tag, _specials, _tagDictionary);
                    _tagDictionary[hash] = tagDoc;
                }
                _tags.Add(hash);
            }
            if (ExampleAttribute.Harvest(tagGroupType))
            {
                _examples.AddRange(ExampleAttribute.HarvestTags(tagGroupType));
            }
            if (HasExample.Has(tagGroupType))
            {
                _examples.Add(new ExampleAttribute(_messagePath.Example));
            }
            if (NoteAttribute.Harvest(tagGroupType))
            {
                _notes.AddRange(NoteAttribute.HarvestTags(tagGroupType));
            }
            if (HasNote.Has(tagGroupType))
            {
                _notes.Add(new NoteAttribute(_messagePath.Note));
            }
        }