Index: pkg/analysis_server/tool/spec/to_html.dart |
diff --git a/pkg/analysis_server/tool/spec/to_html.dart b/pkg/analysis_server/tool/spec/to_html.dart |
index b17cdfe178d2958831d59827b21497f932bfcf08..d71fa64f1b68a595698245edccd32cf5aca7bddd 100644 |
--- a/pkg/analysis_server/tool/spec/to_html.dart |
+++ b/pkg/analysis_server/tool/spec/to_html.dart |
@@ -116,9 +116,6 @@ a:focus, a:hover { |
/* Styles for index */ |
-.subindex { |
-} |
- |
.subindex ul { |
padding-left: 0; |
margin-left: 0; |
@@ -196,6 +193,7 @@ abstract class HtmlMixin { |
void head(void callback()) => element('head', {}, callback); |
void html(void callback()) => element('html', {}, callback); |
void i(void callback()) => element('i', {}, callback); |
+ void li(void callback()) => element('li', {}, callback); |
void link(String id, void callback()) { |
element('a', {'href': '#$id'}, callback); |
} |
@@ -204,6 +202,7 @@ abstract class HtmlMixin { |
void pre(void callback()) => element('pre', {}, callback); |
void title(void callback()) => element('title', {}, callback); |
void tt(void callback()) => element('tt', {}, callback); |
+ void ul(void callback()) => element('ul', {}, callback); |
} |
/** |
@@ -270,6 +269,22 @@ class ToHtmlVisitor extends HierarchicalApiVisitor |
} |
} |
+ void generateTableOfContents() { |
+ ul(() { |
+ writeln(); |
+ |
+ for (var domain in api.domains.where((domain) => !domain.experimental)) { |
+ write(' '); |
+ li(() { |
+ link('domain_${domain.name}', () { |
+ write(_toTitleCase(domain.name)); |
+ }); |
+ }); |
+ writeln(); |
+ } |
+ }); |
+ } |
+ |
void generateIndex() { |
h3(() => write('Domains')); |
for (var domain in api.domains) { |
@@ -425,6 +440,9 @@ class ToHtmlVisitor extends HierarchicalApiVisitor |
case 'version': |
translateHtml(node, squashParagraphs: squashParagraphs); |
break; |
+ case 'toc': |
+ generateTableOfContents(); |
+ break; |
case 'index': |
generateIndex(); |
break; |
@@ -769,3 +787,8 @@ class TypeVisitor extends HierarchicalApiVisitor |
} |
} |
} |
+ |
+String _toTitleCase(String str) { |
+ if (str.isEmpty) return str; |
+ return str.substring(0, 1).toUpperCase() + str.substring(1); |
+} |