Inheritance: DocumentationDataBase
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n");
            this.Write("\r\n{\r\n\t");
            
            #line 19 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\MemberData.tt"

	var properties = new List<string>();
	properties.Add($"\"id\": \"{Member.Identifier}\"");
	properties.Add($"\"urlId\": \"{Member.Identifier.RemoveIllegalHtmlIdChars()}\"");
	properties.Add($"\"type\": \"{MemberType}\""); 
	properties.Add($"\"accessibility\": \"{Member.Accessibility}\"");

	if(Member is SDMethod) {
		var sdMethod = (SDMethod)Member;
		properties.Add($"\"name\": \"{sdMethod.Signature}\"");

		if(!sdMethod.IsSequenceDiagramEmpty()) {
			properties.Add($"\"diagramId\": \"{sdMethod.Guid}\"");
			properties.Add($"\"sequenceDiagram\": \"{sdMethod.GetSequenceDiagram(Repository).ToSvg().Transform(Helper.TransformLinkToken).ToObjectString()}\"");
		}
	} else {
		properties.Add($"\"name\": \"{Member.Name}\"");
	}

	if(Member is SDField && !string.IsNullOrEmpty(((SDField)Member).ConstantValue)) {
		properties.Add($"\"constantValue\": \"{((SDField)Member).ConstantValue.ToObjectString()}\"");
	}

	if(Member.Region != null){
		properties.Add($"\"region\": {{\"start\": \"{Member.Region.StartLine}\", \"end\": \"{Member.Region.EndLine}\", \"filename\": \"{Member.Region.Filename.ToObjectString()}\"}}");
	}	

	var documentation = Member.Documentations.GetElementOrDefault(StepInput.CurrentLanguage);
	if(documentation != null){
		var documentationTemplate = new DocumentationData { Documentation = documentation };
		var documentationText = documentationTemplate.TransformText();
		if(!string.IsNullOrWhiteSpace(documentationText)) properties.Add(documentationText);
	}

	properties.Add($"\"syntax\": \"{Member.Syntax}\"");
	properties.Add($"\"linkedSyntax\": \"{Member.SyntaxTemplate.Transform(Helper.TransformLinkToken).ToObjectString()}\"");
	
            
            #line default
            #line hidden
            this.Write("\t");
            
            #line 56 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\MemberData.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",", properties)));
            
            #line default
            #line hidden
            this.Write("\t\t\r\n}\r\n\r\n");
            return this.GenerationEnvironment.ToString();
        }
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n");
            this.Write("\r\n\"");

            #line 16 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\TypeData.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(TargetFx.Name));

            #line default
            #line hidden
            this.Write("\": { \r\n\t\t");

            #line 17 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\TypeData.tt"

            var properties = new List <string>();
            properties.Add($"\"name\": \"{Type.Name}\"");
            properties.Add($"\"namespace\": \"{Type.Namespace.Fullname}\"");
            properties.Add($"\"syntax\": \"{Type.Syntax}\"");
            properties.Add($"\"linkedSyntax\": \"{Type.SyntaxTemplate.Transform(Helper.TransformLinkToken).ToObjectString()}\"");

            if (!Type.IsClassDiagramEmpty())
            {
                var height = Type.GetClassDiagram().GetSvgSize().Height;
                height = height > 300 ? 375 : height + 75;

                properties.Add($"\"classDiagram\": \"{Type.GetClassDiagram().ToSvg().Transform(Helper.TransformLinkToken).ToObjectString()}\"");
                properties.Add($"\"classDiagramHeight\": \"{height}\"");
                properties.Add($"\"fit\": \"{height == 375}\"");
            }
            if (Type.BaseTypes.Count > 0)
            {
                var baseTypes = string.Join(",", Type.BaseTypes.Select(baseType =>
                                                                       string.Format("{{\"id\": \"{0}\",\"name\": \"{1}\"}}", baseType.Type.Identifier, baseType.Type.Fullname)));

                properties.Add($"\"baseTypes\": [ {baseTypes} ]");
            }
            if (Type.ImplementedInterfaces.Count > 0)
            {
                var implements = string.Join(",", Type.ImplementedInterfaces.Select(implementedInterface =>
                                                                                    string.Format("{{\"id\": \"{0}\",\"name\": \"{1}\"}}", implementedInterface.Type.Identifier, implementedInterface.Type.Fullname)));

                properties.Add($"\"implements\": [ {implements} ]");
            }

            if (Type.Regions.Count > 0 && StepInput.HtmlConfig.ShowCode)
            {
                var allRegions = new List <string>();
                foreach (var region in Type.Regions)
                {
                    allRegions.Add($"{{\"start\": \"{region.StartLine}\", \"end\": \"{region.EndLine}\", \"filepath\": \"{region.FilePath.ToObjectString()}\", \"filename\": \"{region.Filename.ToObjectString()}\", \"content\": \"{region.Content.ToObjectString().Replace("\t", "    ")}\"}}");
                }
                properties.Add($"\"regions\": [{string.Join(",", allRegions)}]");
            }

            var documentation = Type.Documentations.GetElementOrDefault(StepInput.CurrentLanguage);
            if (documentation != null)
            {
                var documentationTemplate = new DocumentationData {
                    Documentation = documentation
                };
                var documentationText = documentationTemplate.TransformText();
                if (!string.IsNullOrWhiteSpace(documentationText))
                {
                    properties.Add(documentationText);
                }
            }

            if (Type.Fields.Count > 0)
            {
                properties.Add(string.Format("\"fields\": [{0}]", string.Join(",", Type.Fields.Select(sdField => new MemberData {
                    Member = sdField, MemberType = "field", Repository = Repository
                }.TransformText()))));
            }
            if (Type.Constructors.Count > 0)
            {
                properties.Add(string.Format("\"constructors\": [{0}]", string.Join(",", Type.Constructors.Select(sdContructor => new MemberData {
                    Member = sdContructor, MemberType = "method", Repository = Repository
                }.TransformText()))));
            }
            if (Type.Methods.Count > 0)
            {
                properties.Add(string.Format("\"methods\": [{0}]", string.Join(",", Type.Methods.Select(sdMethod => new MemberData {
                    Member = sdMethod, MemberType = "method", Repository = Repository
                }.TransformText()))));
            }
            if (Type.Events.Count > 0)
            {
                properties.Add(string.Format("\"events\": [{0}]", string.Join(",", Type.Events.Select(sdEvent => new MemberData {
                    Member = sdEvent, MemberType = "event", Repository = Repository
                }.TransformText()))));
            }
            if (Type.Properties.Count > 0)
            {
                properties.Add(string.Format("\"properties\": [{0}]", string.Join(",", Type.Properties.Select(sdProperty => new MemberData {
                    Member = sdProperty, MemberType = "property", Repository = Repository
                }.TransformText()))));
            }

            #line default
            #line hidden
            this.Write("\r\n\t\t");

            #line 76 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\TypeData.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",", properties)));

            #line default
            #line hidden
            this.Write("\t\r\n\t}\r\n\r\n");
            return(this.GenerationEnvironment.ToString());
        }
Beispiel #3
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n");
            this.Write("\r\n{\r\n\t");

            #line 19 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\MemberData.tt"

            var properties = new List <string>();
            properties.Add($"\"id\": \"{Member.Identifier}\"");
            properties.Add($"\"urlId\": \"{Member.Identifier.RemoveIllegalHtmlIdChars()}\"");
            properties.Add($"\"type\": \"{MemberType}\"");
            properties.Add($"\"accessibility\": \"{Member.Accessibility}\"");

            if (Member is SDMethod)
            {
                var sdMethod = (SDMethod)Member;
                properties.Add($"\"name\": \"{sdMethod.Signature}\"");

                if (!sdMethod.IsSequenceDiagramEmpty())
                {
                    properties.Add($"\"diagramId\": \"{sdMethod.Guid}\"");
                    properties.Add($"\"sequenceDiagram\": \"{sdMethod.GetSequenceDiagram(Repository).ToSvg().Transform(Helper.TransformLinkToken).ToObjectString()}\"");
                }
            }
            else
            {
                properties.Add($"\"name\": \"{Member.Name}\"");
            }

            if (Member is SDField && !string.IsNullOrEmpty(((SDField)Member).ConstantValue))
            {
                properties.Add($"\"constantValue\": \"{((SDField)Member).ConstantValue.ToObjectString()}\"");
            }

            if (Member.Region != null)
            {
                properties.Add($"\"region\": {{\"start\": \"{Member.Region.StartLine}\", \"end\": \"{Member.Region.EndLine}\", \"filename\": \"{Member.Region.Filename.ToObjectString()}\"}}");
            }

            var documentation = Member.Documentations.GetElementOrDefault(StepInput.CurrentLanguage);
            if (documentation != null)
            {
                var documentationTemplate = new DocumentationData {
                    Documentation = documentation
                };
                var documentationText = documentationTemplate.TransformText();
                if (!string.IsNullOrWhiteSpace(documentationText))
                {
                    properties.Add(documentationText);
                }
            }

            properties.Add($"\"syntax\": \"{Member.Syntax}\"");
            properties.Add($"\"linkedSyntax\": \"{Member.SyntaxTemplate.Transform(Helper.TransformLinkToken).ToObjectString()}\"");


            #line default
            #line hidden
            this.Write("\t");

            #line 56 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\MemberData.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",", properties)));

            #line default
            #line hidden
            this.Write("\t\t\r\n}\r\n\r\n");
            return(this.GenerationEnvironment.ToString());
        }
Beispiel #4
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("\r\n");
            this.Write("\r\n\"");
            
            #line 16 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\TypeData.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(TargetFx.Name));
            
            #line default
            #line hidden
            this.Write("\": { \r\n\t\t");
            
            #line 17 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\TypeData.tt"

		var properties = new List<string>();
		properties.Add($"\"name\": \"{Type.Name}\"");
		properties.Add($"\"namespace\": \"{Type.Namespace.Fullname}\"");
		properties.Add($"\"syntax\": \"{Type.Syntax}\"");
		properties.Add($"\"linkedSyntax\": \"{Type.SyntaxTemplate.Transform(Helper.TransformLinkToken).ToObjectString()}\"");

		if(!Type.IsClassDiagramEmpty()) { 
			var height = Type.GetClassDiagram().GetSvgSize().Height;
			height = height > 300 ? 375 : height + 75;

			properties.Add($"\"classDiagram\": \"{Type.GetClassDiagram().ToSvg().Transform(Helper.TransformLinkToken).ToObjectString()}\"");
			properties.Add($"\"classDiagramHeight\": \"{height}\"");
			properties.Add($"\"fit\": \"{height == 375}\"");
		}
		if(Type.BaseTypes.Count > 0) {
			var baseTypes = string.Join(",", Type.BaseTypes.Select(baseType => 
				string.Format("{{\"id\": \"{0}\",\"name\": \"{1}\"}}", baseType.Type.Identifier, baseType.Type.Fullname)));

			properties.Add($"\"baseTypes\": [ {baseTypes} ]");
		} 
		if(Type.ImplementedInterfaces.Count > 0) {
			var implements = string.Join(",", Type.ImplementedInterfaces.Select(implementedInterface => 
				string.Format("{{\"id\": \"{0}\",\"name\": \"{1}\"}}", implementedInterface.Type.Identifier, implementedInterface.Type.Fullname)));

			properties.Add($"\"implements\": [ {implements} ]");
		}

		if(Type.Regions.Count > 0 && StepInput.HtmlConfig.ShowCode){
			var allRegions = new List<string>();
			foreach(var region in Type.Regions){
				allRegions.Add($"{{\"start\": \"{region.StartLine}\", \"end\": \"{region.EndLine}\", \"filepath\": \"{region.FilePath.ToObjectString()}\", \"filename\": \"{region.Filename.ToObjectString()}\", \"content\": \"{region.Content.ToObjectString().Replace("\t", "    ")}\"}}");
			}
			properties.Add($"\"regions\": [{string.Join(",", allRegions)}]");
		}		

		var documentation = Type.Documentations.GetElementOrDefault(StepInput.CurrentLanguage);
		if(documentation != null){
			var documentationTemplate = new DocumentationData { Documentation = documentation };
			var documentationText = documentationTemplate.TransformText();
			if(!string.IsNullOrWhiteSpace(documentationText)) properties.Add(documentationText);
		}
		
		if(Type.Fields.Count > 0) {
			properties.Add(string.Format("\"fields\": [{0}]", string.Join(",", Type.Fields.Select(sdField => new MemberData { Member = sdField, MemberType = "field", Repository = Repository }.TransformText()))));
		} 
		if(Type.Constructors.Count > 0) {
			properties.Add(string.Format("\"constructors\": [{0}]", string.Join(",", Type.Constructors.Select(sdContructor => new MemberData { Member = sdContructor, MemberType = "method", Repository = Repository }.TransformText()))));
		}
		if(Type.Methods.Count > 0) {
			properties.Add(string.Format("\"methods\": [{0}]", string.Join(",", Type.Methods.Select(sdMethod => new MemberData { Member = sdMethod, MemberType = "method", Repository = Repository }.TransformText()))));
		}
		if(Type.Events.Count > 0) {
			properties.Add(string.Format("\"events\": [{0}]", string.Join(",", Type.Events.Select(sdEvent => new MemberData { Member = sdEvent, MemberType = "event", Repository = Repository }.TransformText()))));
		}
		if(Type.Properties.Count > 0){
			properties.Add(string.Format("\"properties\": [{0}]", string.Join(",", Type.Properties.Select(sdProperty => new MemberData { Member = sdProperty, MemberType = "property", Repository = Repository }.TransformText()))));	
		} 
            
            #line default
            #line hidden
            this.Write("\r\n\t\t");
            
            #line 76 "D:\Github\SharpDox.Plugins.Html\src\SharpDox.Plugins.Html\Templates\Repository\TypeData.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(string.Join(",", properties)));
            
            #line default
            #line hidden
            this.Write("\t\r\n\t}\r\n\r\n");
            return this.GenerationEnvironment.ToString();
        }