Exemplo n.º 1
0
        static void InsertTagText(IEnumerable<XElement> members, Tag tag)
        {
            foreach (var member in members.Where(e => HasAttribute(e, tag.Attribute)))
            {
                // Clear the no-longer-needed attribute.
                member.SetAttributeValue(tag.Attribute, null);

                var summary = GetOrCreateElement(member, "summary");
                var remarks = GetOrCreateElement(member, "remarks");

                // If this doc entry has a plain text summary, we insert before that, but if
                // it already contains <p> formatting we want to go inside the paragraph block.
                var firstSummaryElement = summary.Elements().FirstOrDefault();

                if (firstSummaryElement != null && firstSummaryElement.Name == "p")
                {
                    summary = firstSummaryElement;
                }

                summary.AddFirst(new XElement("b", tag.Summary + " "));
                remarks.AddFirst(new XElement("p", new XElement("i", tag.Description)));
            }
        }
Exemplo n.º 2
0
 static void ValidateNoExplicitTags(XDocument doc, string filename, Tag tag)
 {
     if (doc.Descendants().Any(e => e.Value.Contains(tag.Summary)))
     {
         Console.WriteLine("{0}: warning: docsrc contains explicit {1} tag.", filename, tag.Summary);
     }
 }
Exemplo n.º 3
0
        static void PropagateTypeTagsToMembers(IEnumerable<XElement> members, Tag tag)
        {
            // Find all the types (classes, structs) that have this tag.
            var taggedTypes = (from member in members
                               where IsMemberType(member, 'T') && HasAttribute(member, tag.Attribute)
                               select MemberName(member) + '.').ToList();

            // Find members (methods, fields) of these types that should also be tagged.
            var membersToTag = from member in members
                               where taggedTypes.Any(type => MemberName(member).StartsWith(type))
                               select member;

            foreach (var member in membersToTag)
            {
                member.SetAttributeValue(tag.Attribute, true);
            }
        }