private void DoBuildHtml(IReportContext context, IScope scope) { var htmlconfig = new HtmlConfig(); bool standalone = context.Request.Standalone; if (standalone) { htmlconfig.DocHeader = RenderXml(context, scope, DocHeader, null, "DocHeader"); } htmlconfig.Header = RenderXml(context, scope, Header, null, "Header"); htmlconfig.Content = RenderXml(context, scope, Content, null, "Content"); var items = context.Data.arr("items"); IList<ItemXml> xitems = new List<ItemXml>(); if (null != items) { var i = 0; foreach (var item in items) { var itemScope = new Scope(scope); itemScope["_item"] = item; itemScope["_idx"] = i; var xitem = new ItemXml(); xitem.Before = RenderXml(context, itemScope, BeforeItem, item, "BeforeItem"); xitem.Item = RenderXml(context, itemScope, Item, item, "Item"); xitem.After = RenderXml(context, itemScope, AfterItem, item, "AfterItem"); if (null != (xitem.Before ?? xitem.After ?? xitem.Before)) { xitems.Add(xitem); } i++; } } htmlconfig.Items = xitems; htmlconfig.Footer = RenderXml(context, scope, Footer, null, "Footer"); XElement docfooter = null; if (standalone) { htmlconfig.DocFooter = RenderXml(context, scope, DocFooter, null, "DocFooter"); } var xmlhtml = CompileHtml(context, scope, htmlconfig); context.Write(xmlhtml.ToString()); }
public Config() { ConnectionStrings = new ConnectionStringsConfig(); Hosting = new HostingConfig(); MalApi = new MalApiConfig(); Recommendations = new RecommendationsConfig(); Html = new HtmlConfig(); }
public void WriteHtml(ReflectionDumper buffer, int numTabs) { var config = new HtmlConfig(); config.NumTabs = numTabs; WriteHtml(buffer, config); }
public static void InitStepinput(SDProject sdProject, string outputPath, string currentLanguage, HtmlStrings docStrings, HtmlStrings htmlStrings, HtmlConfig htmlConfig) { SDProject = sdProject; OutputPath = outputPath; CurrentLanguage = currentLanguage; DocStrings = docStrings; HtmlStrings = htmlStrings; HtmlConfig = htmlConfig; }
public H5DotJson_AssemblySettings() { Dependencies = new List <IModuleDependency>(); Reflection = new ReflectionConfig(); ReflectionInternal = new ReflectionConfig(); Assembly = new AssemblyConfig(); Resources = new ResourceConfig(); Loader = new ModuleLoader(); Output = DEFAULT_OUTPUT; SourceMap = new SourceMapConfig(); Html = new HtmlConfig(); Rules = new CompilerRule(); IgnoreDuplicateTypes = false; }
public AssemblyInfo() { Dependencies = new List <IPluginDependency>(); DefineConstants = new List <string>(); Reflection = new ReflectionConfig(); ReflectionInternal = new ReflectionConfig(); Assembly = new AssemblyConfig(); Resources = new ResourceConfig(); Loader = new ModuleLoader(); Output = DEFAULT_OUTPUT; SourceMap = new SourceMapConfig(); Html = new HtmlConfig(); Console = new ConsoleConfig(); Rules = new CompilerRule(); IgnoreDuplicateTypes = false; }
private void DoBuildHtml(IReportContext context, IScope scope) { var htmlconfig = new HtmlConfig(); bool standalone = context.Request.Standalone; if (standalone) { htmlconfig.DocHeader = RenderXml(context, scope, DocHeader, null, "DocHeader"); } htmlconfig.Header = RenderXml(context, scope, Header, null, "Header"); htmlconfig.Content = RenderXml(context, scope, Content, null, "Content"); var items = context.Data.arr("items"); IList <ItemXml> xitems = new List <ItemXml>(); if (null != items) { var i = 0; foreach (var item in items) { var itemScope = new Scope(scope); itemScope["_item"] = item; itemScope["_idx"] = i; var xitem = new ItemXml(); xitem.Before = RenderXml(context, itemScope, BeforeItem, item, "BeforeItem"); xitem.Item = RenderXml(context, itemScope, Item, item, "Item"); xitem.After = RenderXml(context, itemScope, AfterItem, item, "AfterItem"); if (null != (xitem.Before ?? xitem.After ?? xitem.Before)) { xitems.Add(xitem); } i++; } } htmlconfig.Items = xitems; htmlconfig.Footer = RenderXml(context, scope, Footer, null, "Footer"); XElement docfooter = null; if (standalone) { htmlconfig.DocFooter = RenderXml(context, scope, DocFooter, null, "DocFooter"); } var xmlhtml = CompileHtml(context, scope, htmlconfig); context.Write(xmlhtml.ToString()); }
private XElement CompileHtml(IReportContext context, IScope scope, HtmlConfig htmlconfig) { bool standalone = context.Request.Standalone; XElement root = null; XElement content = XElement.Parse("<section><header></header><main></main><footer></footer></section>"); if (standalone) { root = XElement.Parse("<html class='" + HtmlClass + $"'><head><meta charset='UTF-8' /></head><body class='{BodyClass}'></body></html>"); root.Element("body").Add(content); if (null != htmlconfig.DocHeader) { root.Element("head").Add(htmlconfig.DocHeader.Elements()); } } else { root = content; } if (null != htmlconfig.Header) { content.Element("header").ReplaceWith(htmlconfig.Header); } var main = content.Element("main"); if (null != htmlconfig.Content) { main.ReplaceWith(htmlconfig.Content); main = content.Element("main"); } if (null != htmlconfig.Items && 0 != htmlconfig.Items.Count) { foreach (var item in htmlconfig.Items) { if (null == item.Before && null == item.After) { var e = XElement.Parse("<div class='report_item'></div>"); if (null != item.Before) { e.Add(item.Before); } if (null != item.Item) { e.Add(item.Item); } if (null != item.After) { e.Add(item.After); } main.Add(e); } else if (null != item.Item) { main.Add(item.Item); } } } if (null != htmlconfig.Footer) { content.Element("footer").ReplaceWith(htmlconfig.Footer); } if (standalone) { if (null != htmlconfig.DocFooter) { root.Element("body").Add(htmlconfig.DocFooter); } } return(root); }
private XElement CompileHtml(IReportContext context, IScope scope, HtmlConfig htmlconfig) { bool standalone = context.Request.Standalone; XElement root = null; XElement content = XElement.Parse("<section><header></header><main></main><footer></footer></section>"); if (standalone) { root = XElement.Parse("<html class='" + HtmlClass + $"'><head><meta charset='UTF-8' /></head><body class='{BodyClass}'></body></html>"); root.Element("body").Add(content); if (null != htmlconfig.DocHeader) { root.Element("head").Add(htmlconfig.DocHeader.Elements()); } } else { root = content; } if (null != htmlconfig.Header) { content.Element("header").ReplaceWith(htmlconfig.Header); } var main = content.Element("main"); if (null != htmlconfig.Content) { main.ReplaceWith(htmlconfig.Content); main = content.Element("main"); } if (null != htmlconfig.Items && 0 != htmlconfig.Items.Count) { foreach (var item in htmlconfig.Items) { if (null == item.Before && null == item.After) { var e = XElement.Parse("<div class='report_item'></div>"); if (null != item.Before) { e.Add(item.Before); } if (null != item.Item) { e.Add(item.Item); } if (null != item.After) { e.Add(item.After); } main.Add(e); } else if (null != item.Item) { main.Add(item.Item); } } } if (null != htmlconfig.Footer) { content.Element("footer").ReplaceWith(htmlconfig.Footer); } if (standalone) { if (null != htmlconfig.DocFooter) { root.Element("body").Add(htmlconfig.DocFooter); } } return root; }
public void WriteHtml(ReflectionDumper buffer, HtmlConfig config = null) { if (config == null) { config = new HtmlConfig(); } int numTabs = config.NumTabs; string tagType = config.TagType; bool detailed = config.Detailed; bool diffMode = config.DiffMode; var tokens = GetTokens(detailed); tokens.Remove("DescriptorType"); string schema = GetSchema(detailed); string tagClass = DescriptorType; if (!diffMode && Tags.Contains("Deprecated")) { tagClass += " deprecated"; // The CSS will strike-through this. } if (!diffMode && DescriptorType != "Class" && DescriptorType != "Enum") { tagClass += " child"; } buffer.OpenClassTag(tagClass, numTabs, tagType); buffer.NextLine(); int search = 0; while (true) { int openToken = schema.IndexOf('{', search); if (openToken < 0) { break; } int closeToken = schema.IndexOf('}', openToken); if (closeToken < 0) { break; } string token = schema.Substring(openToken + 1, closeToken - openToken - 1); if (tokens.ContainsKey(token)) { if (token == "Tags") { Tags.WriteHtml(buffer, numTabs + 1); } else if (token == "Parameters" || token.EndsWith("Type")) { Type type = GetType(); foreach (FieldInfo info in type.GetFields()) { if (info.FieldType == typeof(Parameters) && token == "Parameters") { var parameters = info.GetValue(this) as Parameters; parameters.WriteHtml(buffer, numTabs + 1); break; } else if (info.FieldType == typeof(LuaType) && token.EndsWith("Type")) { var luaType = info.GetValue(this) as LuaType; luaType.WriteHtml(buffer, numTabs + 1); break; } } } else { string value = tokens[token] .ToString() .Replace("<", "<") .Replace(">", ">") .Trim(); if (value.Length > 0) { if (token == "ClassName") { token += " " + DescriptorType; } buffer.WriteElement(token, value, numTabs + 1); } } } search = closeToken + 1; } buffer.CloseClassTag(numTabs, tagType); }