private void TypeEntry(TypeDefinition type, TextWriter tw) { var memdoc = UnityDocumentation.MemDocFor(type); if (memdoc == null) { return; } var baseTypeName = (type.BaseType == null) ? "" : type.BaseType.Name; tw.Write(@" <div class='text'> <article> <h1 class='type'>"); WriteTypeSignature(tw, type); tw.Write("</h1>"); WriteSummaryAndTextBlocksFor(tw, memdoc); tw.Write("<p>"); TableOfContentsFor(tw, type); tw.Write("</p>"); tw.Write(@" </article> </div> "); }
private void MemberEntry(MemberReference memberReference, TextWriter tw) { var memdoc = UnityDocumentation.MemDocFor(memberReference); if (memdoc == null) { return; } tw.Write(@"<a name='{0}'></a> <div class='text' ><article>", memberReference.Name, CssTypeFor(memberReference)); tw.Write(@" <h1 class='signature'>{0}</h1> ", _signatureProvider.SignatureFor(memberReference, true)); WriteSummaryAndTextBlocksFor(tw, memdoc); WriteEditLink(tw, memberReference); tw.Write(@" </article> </div> "); }
public static void All() { var assemblies = new[] { AssemblyDefinition.ReadAssembly(DocumentationRoot() + "/content/UnityEngine.dll"), AssemblyDefinition.ReadAssembly(DocumentationRoot() + "/content/UnityEditor.dll") }; var namespaces = new HashSet <string>(); EnsureDirectoryExists(ScriptApiOutputDirectory()); File.Copy(DocumentationRoot() + "/layout/docs.css", ScriptApiOutputDirectory() + "/docs.css", true); foreach (var t in assemblies.Select(a => a.MainModule).SelectMany(m => m.Types).Where(UnityDocumentation.IsDocumentedType)) { Console.WriteLine("t:" + t.FullName); namespaces.Add(t.Namespace); var output = ScriptApiOutputDirectory() + "/" + UnityDocumentation.HtmlNameFor(t); var stringWriter = new StringWriter(); new TypePageGenerator().GeneratePageFor(t, assemblies, stringWriter); File.WriteAllText(output, stringWriter.ToString()); } foreach (var namespaze in namespaces) { var result = new NamespacePageGenerator().GeneratePageFor(namespaze, assemblies); File.WriteAllText(ScriptApiOutputDirectory() + "/" + UnityDocumentation.HtmlNameFor(namespaze), result); } }
private static bool HaveDocsFor(TypeReference t) { if (!t.Namespace.StartsWith("Unity")) { return(false); } return(UnityDocumentation.MemDocFor(t) != null); }
private IEnumerable <Tuple <string, bool> > GetParentNamespaces(string namespaze) { var accumulated = ""; bool first = true; foreach (string s in namespaze.Split('.')) { if (!first) { accumulated += "."; } accumulated += s; yield return(new Tuple <string, bool>(accumulated, UnityDocumentation.IsDocumentedNamespace(s))); first = false; } }
public string GeneratePageFor(string namespaze, AssemblyDefinition[] assemblyDefinitions) { var types = assemblyDefinitions.Select(a => a.MainModule).SelectMany(m => m.Types).Where( t => t.Namespace == namespaze && UnityDocumentation.IsDocumentedType(t)); var sb = new StringBuilder(); sb.Append(PageHeader()); sb.AppendFormat(@" <div class='text'> <article>"); sb.Append("<h1>"); var htmlbuilder = new HtmlBuilder(); htmlbuilder.AddKeyword("namespace"); htmlbuilder.Add(" "); htmlbuilder.AddNamespaceReference(namespaze, HtmlBuilder.NamespaceHyperlinkMode.LinkOnlyParentNamespaces); sb.Append(htmlbuilder); sb.Append("</h1>"); sb.Append("<ul>"); foreach (var type in types) { sb.Append("<li>"); var memdoc = UnityDocumentation.MemDocFor(type); var html = new HtmlBuilder(); html.AddTypeReference(type, true); sb.Append(html); sb.Append(" "); if (memdoc != null) { sb.Append(memdoc.Summary); } sb.Append("<br>"); sb.Append("</li>"); } sb.Append("</ul>"); sb.AppendFormat(@" </div></article>"); return(sb.ToString()); }
private object UrlFor(MemberReference memberReference) { var arrayType = memberReference as ArrayType; if (arrayType != null) { return(UrlFor(arrayType.GetElementType())); } if (memberReference is TypeDefinition) { return(UnityDocumentation.HtmlNameFor((TypeDefinition)memberReference)); } var declaringType = memberReference.DeclaringType; if (declaringType == null) { return("nourl"); } return(UrlFor(declaringType) + "#" + memberReference.Name); }
private string UrlForNamespace(string namespaze) { return(UnityDocumentation.HtmlNameFor(namespaze)); }