public static XElement BuildDocumentation(DocumentationType documentation)
        {
            PageDocument.StatusColor color;

            switch (documentation)
            {
            case DocumentationType.Full:
                color = PageDocument.StatusColor.Green;
                break;

            case DocumentationType.Partial:
                color = PageDocument.StatusColor.Yellow;
                break;

            default:
                color = PageDocument.StatusColor.Grey;
                break;
            }

            return(PageDocument.BuildStatus(documentation.ToString(), color, true));
        }
Esempio n. 2
0
        public static string GetName(this DocumentationType type)
        {
            var name = type.ToString();

            return(name.Substring(0, 1) + name[1..].ToLower());
		public static XElement BuildDocumentation(DocumentationType documentation)
		{
			PageDocument.StatusColor color;

			switch (documentation)
			{
				case DocumentationType.Full:
					color = PageDocument.StatusColor.Green;
					break;

				case DocumentationType.Partial:
					color = PageDocument.StatusColor.Yellow;
					break;

				default:
					color = PageDocument.StatusColor.Grey;
					break;
			}

			return PageDocument.BuildStatus(documentation.ToString(), color, true);
		}
Esempio n. 4
0
        /// <summary>
        /// Returns the passed documentation type for this member or null if it is not defined.
        /// </summary>
        /// <param name="documentationType">The documentation type.</param>
        /// <param name="documentationCollection">A documentation collection to resolve see-tags.</param>
        /// <returns>The documentation as string or null if not found.</returns>
        public string Get(DocumentationType documentationType, DocumentationCollection documentationCollection)
        {
            if (!contentByType.TryGetValue(documentationType.ToString().ToLower(), out var doc))
            {
                return(null);
            }
            if (documentationCollection == null)
            {
                return(doc);
            }

            var referenced = new Dictionary <string, string>();

            string Resolve(Func <string> getContent, Action <string> setContent)
            {
                var value = getContent();
                var found = new List <string>();

                while (true)
                {
                    var match = RegexSeeCref.Match(value);

                    if (!match.Success)
                    {
                        break;
                    }

                    var referencedId = match.Groups["id"].Value;

                    if (!referenced.TryGetValue(referencedId, out var referencedDoc))
                    {
                        referencedDoc            = documentationCollection.ForName(referencedId)?.Get(DocumentationType.Summary, null) ?? string.Empty;
                        referenced[referencedId] = referencedDoc;
                        found.Add(referencedId);
                    }

                    value = value.Replace(match.Value, $"Reference({referencedId})");
                }

                setContent(value);

                foreach (var item in found)
                {
                    Resolve(() => referenced[item], content => referenced[item] = content);
                }

                return(value);
            }

            var sb = new StringBuilder();

            sb.Append(Resolve(() => doc, content => { }));

            foreach (var reference in referenced)
            {
                sb.AppendLine();
                sb.AppendLine();
                sb.AppendLine($"START Reference({reference.Key})");
                sb.AppendLine($"{reference.Value}");
                sb.AppendLine($"END Reference({reference.Key})");
            }

            return(sb.ToString());
        }