private async Task WriteTocAsync(RenderingState state) { if (state.Document.TableOfContents.Count == 0) { return; } state.AppendString($"<section class=\"table-of-contents\">"); state.AppendString($"<input class=\"advance-items\" type=\"checkbox\"><span class=\"advance-items-label\">Show Uno properties and methods</span>"); if (state.Document.Entity.Id.Type == "Namespace" || state.Document.Entity.Id.Type == "Root") { // Handle root namespace pages differently than others; // Instead of grouping things based on where they are inherited from, we instead show everything // in a single table split by entity type. var byType = _tocOrganizer.SplitByType(state.Document.TableOfContents); await WriteTocByTypeAsync(byType, state); } else { // Split elements within each group based on where they are inherited from var byDeclaredIn = _tocOrganizer.SplitByDeclaredIn(state.Document.Entity, state.Document.TableOfContents); await WriteTocByDeclaredInAsync(byDeclaredIn, state); } state.AppendString($"</section>"); }
void OnValidate() { if (Application.isPlaying && m_SpatialMappingManager && m_SpatialUnderstandingCustomMesh) { CurrentRenderingState = m_CurrentRenderingState; } }
public void Build() { _logger.LogInformation($"Generating report at {_path}"); var state = new RenderingState(); state.Append($"<!DOCTYPE html>"); state.Append($"<html lang=\"en\">"); state.Append($"<head>"); state.Append($"<meta charset=\"utf-8\">"); state.Append($"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">"); state.Append($"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"); state.Append($"<title>Generator report</title>"); state.Append($"<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" crossorigin=\"anonymous\">"); state.Append($"</head>"); state.Append($"<body>"); state.Append($"<div class=\"container\">"); state.Append($"<div class=\"jumbotron\">"); state.AppendTitle($"Generator report"); state.Append($"<p class=\"lead\">Generated at {DateTime.Now.ToString("G")}</p>"); state.Append($"</div>"); AppendLowQualityTypes(state); AppendLowQualityArticles(state); AppendReferenceMapReport(state); state.Append($"</div>"); state.Append($"</body>"); state.Append($"</html>"); File.WriteAllText(_path, state.Builder.ToString()); }
private async Task WriteSeeAlsoAsync(RenderingState state) { if ((state.Document.Entity.Comment?.Attributes?.SeeAlso?.Count ?? 0) == 0) { return; } var tocItems = new List <ApiReferenceTocItem>(); foreach (var item in state.Document.Entity.Comment.Attributes.SeeAlso) { // Use the raw referenced entity if if an entity with the right id exists, // otherwise attempt to look up the keyword using the reference map var key = item; if (!state.EntityCache.ContainsKey(key)) { key = _referenceMap.GetTarget(item); } if (string.IsNullOrWhiteSpace(key) || !state.EntityCache.ContainsKey(key)) { _logger.LogError($"Unable to resolve seealso entry for {state.Document.Entity.Uri.Href} - no match in file system nor reference map: '{item}'"); continue; } var cached = state.EntityCache[key]; tocItems.Add(new ApiReferenceTocItem { Id = cached.Id, Uri = cached.Uri, Titles = cached.Titles, Comment = cached.Comment, Returns = cached.Returns, Parameters = cached.Parameters, Flags = cached.Flags }); } if (tocItems.Count == 0) { return; } _logger.LogInformation($"adding seealso to {state.Document.Entity.Uri.Href}"); state.AppendString($"<section class=\"see-also\">"); state.AppendString($"<section class=\"table-of-contents\">"); state.AppendString($"<section class=\"table-of-contents-section\">"); state.AppendString($"<h4 id=\"section-see-also\">See Also</h4>"); foreach (var item in tocItems) { var result = await _tocRenderer.RenderAsync(item.Id, item.Uri, item.Titles, item.Comment, state.EntityCache, state.Document.Entity.Uri.Href, false); state.MarkdownDeferredIds.AddRange(result.DeferredMarkdownIds); state.AppendString(result.Html); } state.AppendString($"</section>"); state.AppendString($"</section>"); state.AppendString($"</section>"); }
public async Task <ApiTocRenderingResult> RenderAsync(ApiReferenceId id, ApiReferenceUri uri, ApiReferenceTitle title, ApiReferenceFlags flags, ApiReferenceReturns returns, ApiReferenceComment comment, Dictionary <string, ApiReferenceEntity> entityCache, string currentPath, bool isAdvanced) { var state = new RenderingState(new StringBuilder(), id, uri, title, flags, returns, comment, entityCache, currentPath); var cssClasses = new List <string> { "table-of-contents-item" }; if (isAdvanced) { cssClasses.Add("is-advanced"); } state.AppendString($"<article class=\"{string.Join(" ", cssClasses)}\">"); WriteType(state); WriteLink(state); await WriteCommentAsync(state); state.AppendString($"</article>"); return(new ApiTocRenderingResult(state.Builder.ToString(), state.DeferredMarkdownIds, state.NumberOfCommentLines)); }
private void Update() { isInvalidated = false; if (!form.Visible || !form.CanFocus) { return; } float delta = Mathf.Clamp((float)stopwatch.Elapsed.TotalSeconds, 0, Application.MaxDelta); stopwatch.Restart(); if (this == Application.MainWindow && Application.MainMenu != null) { Application.MainMenu.Refresh(); } // Refresh mouse position of every frame to make HitTest work properly if mouse is outside of the screen. RefreshMousePosition(); RaiseUpdating(delta); AudioSystem.Update(); Input.CopyKeysState(); Input.ProcessPendingKeyEvents(delta); Input.TextInput = null; if (renderingState == RenderingState.RenderDeferred) { Invalidate(); } renderingState = RenderingState.Updated; }
private void WriteLanguage(RenderingState state) { string language; switch (state.Id.Type.ToLowerInvariant()) { case "jsmodule": case "jsproperty": case "jsevent": case "jsmethod": language = "js"; break; case "uxclass": case "uxproperty": case "uxevent": case "attacheduxproperty": case "attacheduxevent": language = "ux"; break; default: language = "uno"; break; } var cssClasses = new List <string> { "table-of-contents-item-language", $"table-of-contents-item-language-{language}" }; state.AppendString($"<span class=\"{string.Join(" ", cssClasses)}\">{EscapeHtml(language)}</span>"); }
private void WriteReturns(RenderingState state) { if (state.Id.Type == "JsMethod" || state.Returns == null) { return; } state.AppendString($"<span class=\"table-of-contents-item-inline-returns\"> : "); if (!string.IsNullOrWhiteSpace(state.Returns.Href) && !state.Returns.IsVirtual) { state.AppendString($"<a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.CurrentPath, state.Returns.Href, "html"))}\">"); } var title = state.Returns.Title; // If this is a List<T> or IList<T>, transform the return value to read "List of T" or "IList of T" if (title.StartsWith("List<") || title.StartsWith("IList<")) { var prefix = title.Substring(0, title.IndexOf("<")); var generics = title.Substring(prefix.Length + 1).TrimEnd('>'); title = $"{prefix} of {generics}"; } state.AppendString(EscapeHtml(title)); if (!string.IsNullOrWhiteSpace(state.Returns.Href) && !state.Returns.IsVirtual) { state.AppendString($"</a>"); } state.AppendString($"</span>"); }
private void WriteAttachedBy(RenderingState state) { if (!state.Id.Type.StartsWith("AttachedUx")) { return; } if (!state.EntityCache.ContainsKey(state.Uri.Href)) { throw new ArgumentException($"TOC item {state.Uri.Href} was not found in entity cache"); } var underlyingEntity = state.EntityCache[state.Uri.Href]; if (!state.EntityCache.ContainsKey(underlyingEntity.Id.ParentId)) { throw new ArgumentException($"Parent of TOC item {state.Id.Id} ({underlyingEntity.Id.ParentId} was not found in entity cache"); } var attachedBy = state.EntityCache[underlyingEntity.Id.ParentId]; var attachedByName = attachedBy.Titles.IndexTitle; var attachedByHref = attachedBy.Uri.Href; state.AppendString($"<span class=\"table-of-contents-item-inline-attached-by\">"); state.AppendString($"(attached by <a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.CurrentPath, attachedByHref, "html"))}\">{EscapeHtml(attachedByName)}</a>)"); state.AppendString($"</span>"); }
private async Task WriteValuesAsync(RenderingState state) { if ((state.Document.Entity.Values?.Count ?? 0) == 0) { return; } state.AppendString($"<section class=\"values\">"); state.AppendString($"<h3 id=\"section-values\">Possible Values</h3>"); state.AppendString($"<dl>"); foreach (var value in state.Document.Entity.Values) { state.AppendString($"<dt>"); state.AppendString($"<a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.Document.Entity.Uri.Href, value.Uri, "html"))}\">"); state.AppendString(EscapeHtml(value.Title)); state.AppendString($"</a>"); state.AppendString($"</dt>"); state.AppendString($"<dd>"); if (!string.IsNullOrWhiteSpace(value.Comment?.Brief)) { var result = await RenderMarkdownAsync(value.Comment.Brief); state.MarkdownDeferredIds.Add(result.Id); state.AppendString(result.Html); } state.AppendString($"</dd>"); } state.AppendString($"</dl>"); state.AppendString($"</section>"); }
private async Task WriteRemarksAsync(RenderingState state) { if (string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Remarks)) { return; } await WriteMarkdownSectionAsync(state, "remarks", "Remarks", state.Document.Entity.Comment.Remarks); }
private async Task WriteUxAsync(RenderingState state) { if (string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Ux)) { return; } await WriteMarkdownSectionAsync(state, "ux", "UX", state.Document.Entity.Comment.Ux); }
private async Task WriteExamplesAsync(RenderingState state) { if (string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Examples)) { return; } await WriteMarkdownSectionAsync(state, "examples", "Examples", state.Document.Entity.Comment.Examples); }
void Start() { m_SpatialMappingManager = SpatialMappingManager.Instance; m_SpatialUnderstandingCustomMesh = SpatialUnderstanding.Instance.UnderstandingCustomMesh; m_SpatialMappingDefaultMaterial = m_SpatialMappingManager.SurfaceMaterials; m_SpatialUnderstandingDefaultMaterial = m_SpatialUnderstandingCustomMesh.MeshMaterials; CurrentRenderingState = m_CurrentRenderingState; }
private async Task WriteParametersAsync(RenderingState state) { var parameters = BuildParameterCollection(state.Document.Entity); if (parameters.Count == 0) { return; } state.AppendString($"<section class=\"parameters\">"); state.AppendString($"<h3 id=\"section-parameters\">Parameters</h3>"); state.AppendString($"<dl>"); foreach (var param in parameters) { state.AppendString($"<dt>{EscapeHtml(param.Name)}</dt>"); state.AppendString($"<dd>"); if (!string.IsNullOrWhiteSpace(param.ReturnsTitle)) { state.AppendString($"<p>"); if (!string.IsNullOrWhiteSpace(param.ReturnsHref)) { state.AppendString($"<a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.Document.Entity.Uri.Href, param.ReturnsHref, "html"))}\">"); } state.AppendString(EscapeHtml(param.ReturnsTitle)); if (!string.IsNullOrWhiteSpace(param.ReturnsHref)) { state.AppendString($"</a>"); } state.AppendString("</p>"); } else if (!string.IsNullOrWhiteSpace(param.TypeHint)) { state.AppendString($"<p>{EscapeHtml(param.TypeHint)}</p>"); } if (!string.IsNullOrWhiteSpace(param.Comment)) { var result = await RenderMarkdownAsync(param.Comment); state.MarkdownDeferredIds.Add(result.Id); state.AppendString(result.Html); } state.AppendString($"</dd>"); } state.AppendString($"</dl>"); state.AppendString($"</section>"); }
public override void Set(RenderingState State) { ConstantBufferLayout Buffer; Buffer.TransformMatrix = State.TransformMatrix; Buffer.RoomGridLineWidth = State.RoomGridLineWidth; Buffer.RoomGridForce = State.RoomGridForce ? 1 : 0; Buffer.RoomDisableVertexColors = State.RoomDisableVertexColors ? 1 : 0; Buffer.ShowExtraBlendingModes = State.ShowExtraBlendingModes ? 1 : 0; Buffer.ShowLightingWhiteTextureOnly = State.ShowLightingWhiteTextureOnly ? 1 : 0; Context.UpdateSubresource(ref Buffer, ConstantBuffer); }
private void WriteType(RenderingState state) { var cssClasses = new List <string> { "table-of-contents-item-type", $"table-of-contents-item-type-{state.Id.Type.ToLowerInvariant()}", "fa", $"fa-{GetTypeIcon(state)}" }; state.AppendString($"<span class=\"{string.Join(" ", cssClasses)}\" title=\"{EscapeHtml(state.Id.Type)}\"></span>"); }
private void WriteTitle(RenderingState state) { var title = GetPageTitle(state.Document, state.EntityCache); var subTitle = ""; var hasToc = (state.Document.TableOfContents?.Count ?? 0) > 0; var onlyAdvanced = state.Document.TableOfContents.HasOnlyAdvancedItems(state.Document.Entity.Id); // Allow topic comment to override the title, and use the existing title as a subtitle instead if (!string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Attributes?.Topic)) { subTitle = title; title = state.Document.Entity.Comment.Attributes.Topic; } state.AppendString($"<header class=\"page-header\">"); state.AppendString($"<h2 id=\"section-introduction\">"); state.AppendString(EscapeHtml(title)); if (!string.IsNullOrWhiteSpace(subTitle)) { state.AppendString($"<span class=\"sub-title\">{EscapeHtml(subTitle)}</span>"); } state.AppendString($"</h2>"); if (hasToc) { state.AppendString($"<form class=\"advanced-toggle\">"); state.AppendString($"<div class=\"form-check\">"); if (onlyAdvanced) { state.AppendString($"<input class=\"form-check-input\" type=\"checkbox\" id=\"showAdvancedCheckbox\" checked />"); } else { state.AppendString($"<input class=\"form-check-input\" type=\"checkbox\" id=\"showAdvancedCheckbox\" />"); } state.AppendString($"<label class=\"form-check-label\" for=\"showAdvancedCheckbox\">"); state.AppendString($"Show advanced things"); state.AppendString($"</label>"); state.AppendString($"</div>"); state.AppendString($"</form>"); } state.AppendString($"</header>"); if (hasToc && onlyAdvanced) { state.AppendString($"<div class=\"alert alert-info alert-api-advanced-only\">"); state.AppendString($"This page contains documentation for advanced Fuse features, so we have "); state.AppendString($"taken the liberty to tick the \"Show advanced things\" checkbox above for "); state.AppendString($"you in advance to be able to provide you with some additional information."); state.AppendString($"</div>"); } }
private async Task WriteMarkdownSectionAsync(RenderingState state, string className, string title, string markdown) { var markdownResult = await _preformatter.ApplyPreformattingAsync(markdown, state.Document.Entity.Uri.Href); state.MarkdownDeferredIds.AddRange(markdownResult.DeferredMarkdownIds); var result = await RenderMarkdownAsync(markdownResult.Markdown); state.MarkdownDeferredIds.Add(result.Id); state.AppendString($"<section class=\"documentation-{className}\">"); state.AppendString($"<h3 id=\"section-{className}\">{EscapeHtml(title)}</h3>"); state.AppendString(result.Html); state.AppendString($"</section>"); }
private void AppendLowQualityArticles(RenderingState state) { state.AppendSubTitle($"Low quality articles"); var report = _articleRenderer.GetQualityReport() .Where(e => e.NumberOfLines < MinArticleLineThreshold) .ToList(); if (report.Count == 0) { state.Append($"<div class=\"alert alert-success\">No low quality articles found.</div>"); } else { state.Append($"<div class=\"alert alert-warning\">{report.Count} articles had low quality content.</div>"); state.Append($"<table class=\"table table-bordered table-striped table-condensed\">"); state.Append($"<thead>"); state.Append($"<tr>"); state.Append($"<th>Path</th>"); state.Append($"<th>Quality Info</th>"); state.Append($"</tr>"); state.Append($"</thead>"); state.Append($"<tbody>"); foreach (var item in report) { state.Append($"<tr>"); state.Append($"<td>"); state.Append($"<a href=\"generated/{EscapeHtml(item.Path)}\">{EscapeHtml(item.Path)}</a>"); state.Append($"</td>"); state.Append($"<td>"); state.Append($"<ul>"); if (item.NumberOfLines == 0) { state.Append($"<li>No content available.</li>"); } else if (item.NumberOfLines < MinArticleLineThreshold) { state.Append($"<li>Only {item.NumberOfLines} lines of content available.</li>"); } state.Append($"</ul>"); state.Append($"</td>"); state.Append($"</tr>"); } state.Append($"</tbody>"); state.Append($"</table>"); } }
private async Task WriteCommentAsync(RenderingState state) { if (string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Full)) { return; } state.Quality.NumberOfCommentLines = CountNumberOfLines(state.Document.Entity.Comment.Full); var comment = await _preformatter.ApplyPreformattingAsync(state.Document.Entity.Comment.Full, state.Document.Entity.Uri.Href); state.MarkdownDeferredIds.AddRange(comment.DeferredMarkdownIds); var parserResult = await RenderMarkdownAsync(comment.Markdown); state.MarkdownDeferredIds.Add(parserResult.Id); state.AppendString(parserResult.Html); }
private void WriteLink(RenderingState state) { var title = ApiRenderingHelper.GetTitle(state.Id, state.Title, state.Comment, null, null, new Dictionary <string, ApiReferenceEntity>(), true); if (string.IsNullOrWhiteSpace(title)) { throw new ArgumentException($"No title could be generated for {state.Id.Id} in {state.CurrentPath} (type {state.Id.Type})"); } state.AppendString($"<h5>"); state.AppendString($"<a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.CurrentPath, state.Uri.Href, "html"))}\">"); state.AppendString(EscapeHtml(title)); state.AppendString($"</a>"); WriteAttachedBy(state); WriteReturns(state); WriteLanguage(state); state.AppendString($"</h5>"); }
private void WriteAttachedAttributeDetails(RenderingState state) { var attachedInfo = ApiRenderingHelper.GetAttachedAttributeInfo(state.Document.Entity.Id, state.Document.Entity.Titles, state.Document.Entity.Parameters, state.Document.Entity.Attributes, state.EntityCache); if (attachedInfo == null) { return; } state.AppendString($"<p><em>"); state.AppendString($"Attached by <a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.Document.Entity.Uri.Href, attachedInfo.AttachedByHref, "html"))}\">{EscapeHtml(attachedInfo.AttachedByType)}</a>."); state.AppendString($"Use full name <code>{EscapeHtml(attachedInfo.FullName)}</code> in UX markup if ambiguous."); state.AppendString("</em></p>"); }
private async Task RenderDocumentAsync(ApiReferenceDocument document, Dictionary <string, ApiReferenceEntity> entityCache) { // Don't render documents for swizzler types if (document.Entity.Id.Type == "SwizzlerType") { return; } var filename = NormalizePath($"{document.Entity.Uri.Href}.html"); // Hack: If this is the root document, renname it to root-ns.html so we can use another // index document within the articles directory. if (document.Entity.Id.Type == "Root" && document.Entity.Id.Id == "__root__") { filename = "root-ns.html"; } var state = new RenderingState(filename, new StringBuilder(), document, entityCache); WriteMetaData(state); WriteTitle(state); WriteSubsectionLinks(state); WriteNotifications(state); WriteAttachedAttributeDetails(state); await WriteCommentAsync(state); await WriteUxAsync(state); WriteLocation(state); await WriteParametersAsync(state); await WriteReturnsAsync(state); await WriteValuesAsync(state); await WriteTocAsync(state); await WriteInterfacesAsync(state); await WriteRemarksAsync(state); await WriteExamplesAsync(state); await WriteSeeAlsoAsync(state); await _outputPath.WriteContentAsync(filename, document.SourceFileLastModifiedAt, state.Builder.ToString(), (p, i) => ApplyDocumentPostProcessingAsync(p, i, state.MarkdownDeferredIds)); _qualityReports.Add(new ApiDocumentQualityReport(document, state.Quality.NumberOfCommentLines, state.Quality.TableOfContentsCommentLines)); }
private void Update() { var wasInvalidated = isInvalidated; isInvalidated = false; if (!form.Visible || !form.CanFocus) { return; } UnclampedDelta = (float)stopwatch.Elapsed.TotalSeconds; float delta = Mathf.Clamp(UnclampedDelta, 0, Application.MaxDelta); stopwatch.Restart(); if (this == Application.MainWindow && Application.MainMenu != null) { Application.MainMenu.Refresh(); } fpsCounter.Refresh(); // Refresh mouse position of every frame to make HitTest work properly if mouse is outside of the screen. RefreshMousePosition(); RaiseUpdating(delta); AudioSystem.Update(); if (active || Input.IsSimulationRunning) { Input.CopyKeysState(); Input.ProcessPendingKeyEvents(delta); Input.TextInput = null; } if (wasInvalidated || renderingState == RenderingState.RenderDeferred) { glControl.Invalidate(); } renderingState = RenderingState.Updated; if (AsyncRendering) { renderCompleted.WaitOne(); renderCompleted.Reset(); } RaiseSync(); if (AsyncRendering) { renderReady.Set(); } }
private async Task WriteReturnsAsync(RenderingState state) { var returns = BuildReturns(state.Document.Entity); if (returns == null) { return; } state.AppendString($"<section class=\"returns\">"); state.AppendString($"<h3 id=\"section-returns\">Returns</h3>"); state.AppendString($"<p>"); if (!string.IsNullOrWhiteSpace(returns.ReturnsTitle)) { if (!string.IsNullOrWhiteSpace(returns.ReturnsHref)) { state.AppendString($"<a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.Document.Entity.Uri.Href, returns.ReturnsHref, "html"))}\">"); } state.AppendString(EscapeHtml(returns.ReturnsTitle)); if (!string.IsNullOrWhiteSpace(returns.ReturnsHref)) { state.AppendString($"</a>"); } } else if (!string.IsNullOrWhiteSpace(returns.TypeHint)) { state.AppendString(EscapeHtml(returns.TypeHint)); } state.AppendString($"</p>"); if (!string.IsNullOrWhiteSpace(returns.Comment)) { var result = await RenderMarkdownAsync(returns.Comment); state.MarkdownDeferredIds.Add(result.Id); state.AppendString(result.Html); } state.AppendString($"</section>"); }
private async Task WriteTocByTypeAsync(List <TocTypeGroup> groups, RenderingState state) { foreach (var group in groups) { state.AppendString($"<h3 id=\"section-table-of-contents\">{EscapeHtml(group.Title)}</h3>"); state.AppendString($"<section class=\"table-of-contents-section\">"); foreach (var item in group.Items) { var result = await _tocRenderer.RenderAsync(item, state.EntityCache, state.Document.Entity.Uri.Href, item.IsAdvanced(state.Document.Entity.Id)); state.MarkdownDeferredIds.AddRange(result.DeferredMarkdownIds); state.AppendString(result.Html); state.Quality.TableOfContentsCommentLines.Add(item.Uri.IdUri, result.NumberOfCommentLines); } state.AppendString($"</section>"); } }
private void WriteNotifications(RenderingState state) { if (state.Document.Entity.Comment?.Attributes?.Deprecated ?? false) { state.AppendString($"<section class=\"notifications\">"); state.AppendString($"<div class=\"alert alert-warning alert-api-deprecated\">"); state.AppendString($"This entity is deprecated and will be removed in a future release."); state.AppendString($"</div>"); state.AppendString($"</section>"); } else if (state.Document.Entity.Comment?.Attributes?.Experimental ?? false) { state.AppendString($"<section class=\"notifications\">"); state.AppendString($"<div class=\"alert alert-warning alert-api-experimental\">"); state.AppendString($"This entity is experimental and might be changed or removed in a future release."); state.AppendString($"</div>"); state.AppendString($"</section>"); } }
private void WriteSubsectionLinks(RenderingState state) { var sections = new List <KeyValuePair <string, string> >(); if (!string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Ux)) { sections.Add(new KeyValuePair <string, string>("ux", "UX")); } if (state.Document.TableOfContents.Count > 0) { sections.Add(new KeyValuePair <string, string>("table-of-contents", "Table of Contents")); } if (!string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Remarks)) { sections.Add(new KeyValuePair <string, string>("remarks", "Remarks")); } if (!string.IsNullOrWhiteSpace(state.Document.Entity.Comment?.Examples)) { sections.Add(new KeyValuePair <string, string>("examples", "Examples")); } if ((state.Document.Entity.Comment?.Attributes?.SeeAlso?.Count ?? 0) > 0) { sections.Add(new KeyValuePair <string, string>("see-also", "See Also")); } if (sections.Count == 0) { return; } state.AppendString($"<section class=\"section-jump\">"); state.AppendString($"<ul class=\"nav nav-pills\">"); state.AppendString($"<li class=\"nav-item\"><a href=\"#\" class=\"nav-link disabled\">Jump to:</a></li>"); foreach (var section in sections) { state.AppendString($"<li class=\"nav-item\"><a href=\"#section-{EscapeHtml(section.Key)}\" class=\"nav-link\">{EscapeHtml(section.Value)}</a></li>"); } state.AppendString($"</ul>"); state.AppendString($"</section>"); }
private void WriteLocation(RenderingState state) { if (string.IsNullOrWhiteSpace(state.Document.Entity.Location?.NamespaceUri) && string.IsNullOrWhiteSpace(state.Document.Entity.Location?.PackageName)) { return; } var cssClasses = new List <string> { "type-location" }; if (state.Document.TableOfContents.Count == 0) { cssClasses.Add("type-location-leaf"); } state.AppendString($"<section class=\"{string.Join(" ", cssClasses)}\">"); state.AppendString($"<h3 id=\"section-location\">Location</h3>"); state.AppendString($"<dl>"); if (!string.IsNullOrWhiteSpace(state.Document.Entity.Location.NamespaceUri)) { state.AppendString($"<dt>Namespace</dt>"); state.AppendString($"<dd>"); state.AppendString($"<a href=\"{EscapeHtml(RelativePathHelper.GetRelativePath(state.Document.Entity.Uri.Href, state.Document.Entity.Location.NamespaceUri, "html"))}\">"); state.AppendString(EscapeHtml(state.Document.Entity.Location.NamespaceTitle)); state.AppendString($"</a>"); state.AppendString($"</dd>"); } if (!string.IsNullOrWhiteSpace(state.Document.Entity.Location.PackageName)) { state.AppendString($"<dt>Package</dt>"); state.AppendString($"<dd>{EscapeHtml(state.Document.Entity.Location.PackageName + " " + state.Document.Entity.Location.PackageVersion)}</dd>"); } state.AppendString($"</dl>"); state.AppendString($"</section>"); }
public static void SetRenderingState(RenderingState state) { currentState = state; }
public static void SetRenderingState(DependencyObject obj, RenderingState value) { obj.SetValue(RenderingStateProperty, value); }
protected override void LoadContent() { renderingState = new RenderingState(Content); base.LoadContent(); }