Skip to content

Commit d5a0831

Browse files
committed
reduce duplicated code, fix links to anchors
1 parent bce4cf1 commit d5a0831

File tree

6 files changed

+65
-237
lines changed

6 files changed

+65
-237
lines changed

lib/src/html_generator.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ class Templates {
8686
'styles_and_scripts',
8787
'readable_writable',
8888
'documentation',
89-
'name_summary'
89+
'name_summary',
90+
'sidebar_for_class'
9091
];
9192

9293
for (var partial in partials) {

lib/templates/_sidebar_for_class.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<ol id="sidebar">
2+
{{#class.hasConstants}}
3+
<li class="section-title"><a href="{{class.href}}#constants">Constants</a></li>
4+
{{#class.constants}}
5+
<li><a href="{{href}}">{{name}}</a></li>
6+
{{/class.constants}}
7+
{{/class.hasConstants}}
8+
9+
{{#class.hasStaticProperties}}
10+
<li class="section-title"><a href="{{class.href}}#static-properties">Static properties</a></li>
11+
{{#class.staticProperties}}
12+
<li><a href="{{href}}">{{name}}</a></li>
13+
{{/class.staticProperties}}
14+
{{/class.hasStaticProperties}}
15+
16+
{{#class.hasStaticMethods}}
17+
<li class="section-title"><a href="{{class.href}}#static-methods">Static methods</a></li>
18+
{{#class.staticMethods}}
19+
<li><a href="{{href}}">{{name}}</a></li>
20+
{{/class.staticMethods}}
21+
{{/class.hasStaticMethods}}
22+
23+
{{#class.hasInstanceProperties}}
24+
<li class="section-title"><a href="{{class.href}}#instance-properties">Properties</a></li>
25+
{{#class.instanceProperties}}
26+
<li><a href="{{href}}">{{name}}</a></li>
27+
{{/class.instanceProperties}}
28+
{{#class.inheritedProperties}}
29+
<li><a href="{{href}}">{{name}}</a></li>
30+
{{/class.inheritedProperties}}
31+
{{/class.hasInstanceProperties}}
32+
33+
{{#class.hasConstructors}}
34+
<li class="section-title"><a href="{{class.href}}#constructors">Constructors</a></li>
35+
{{#class.constructors}}
36+
<li><a href="{{href}}">{{shortName}}</a></li>
37+
{{/class.constructors}}
38+
{{/class.hasConstructors}}
39+
40+
{{#class.hasOperators}}
41+
<li class="section-title"><a href="{{class.href}}#operators">Operators</a></li>
42+
{{#class.operators}}
43+
<li><a href="{{href}}">{{name}}</a></li>
44+
{{/class.operators}}
45+
{{#class.inheritedOperators}}
46+
<li><a href="{{href}}">{{name}}</a></li>
47+
{{/class.inheritedOperators}}
48+
{{/class.hasOperators}}
49+
50+
{{#class.hasMethods}}
51+
<li class="section-title"><a href="{{class.href}}#methods">Methods</a></li>
52+
{{#class.instanceMethods}}
53+
<li><a href="{{href}}">{{name}}</a></li>
54+
{{/class.instanceMethods}}
55+
{{#class.inheritedMethods}}
56+
<li><a href="{{href}}">{{name}}</a></li>
57+
{{/class.inheritedMethods}}
58+
{{/class.hasMethods}}
59+
</ol>

lib/templates/class.html

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,7 @@
33
<div class="row row-offcanvas row-offcanvas-left">
44

55
<div class="col-xs-6 col-sm-3 sidebar-offcanvas">
6-
<ol id="sidebar">
7-
{{#class.hasConstants}}
8-
<li class="section-title"><a href="#constants">Constants</a></li>
9-
{{#class.constants}}
10-
<li><a href="{{href}}">{{name}}</a></li>
11-
{{/class.constants}}
12-
{{/class.hasConstants}}
13-
14-
{{#class.hasStaticProperties}}
15-
<li class="section-title"><a href="#static-properties">Static properties</a></li>
16-
{{#class.staticProperties}}
17-
<li><a href="{{href}}">{{name}}</a></li>
18-
{{/class.staticProperties}}
19-
{{/class.hasStaticProperties}}
20-
21-
{{#class.hasStaticMethods}}
22-
<li class="section-title"><a href="#static-methods">Static methods</a></li>
23-
{{#class.staticMethods}}
24-
<li><a href="{{href}}">{{name}}</a></li>
25-
{{/class.staticMethods}}
26-
{{/class.hasStaticMethods}}
27-
28-
{{#class.hasInstanceProperties}}
29-
<li class="section-title"><a href="#instance-properties">Properties</a></li>
30-
{{#class.instanceProperties}}
31-
<li><a href="{{href}}">{{name}}</a></li>
32-
{{/class.instanceProperties}}
33-
{{#class.inheritedProperties}}
34-
<li><a href="{{href}}">{{name}}</a></li>
35-
{{/class.inheritedProperties}}
36-
{{/class.hasInstanceProperties}}
37-
38-
{{#class.hasConstructors}}
39-
<li class="section-title"><a href="#constructors">Constructors</a></li>
40-
{{#class.constructors}}
41-
<li><a href="{{href}}">{{shortName}}</a></li>
42-
{{/class.constructors}}
43-
{{/class.hasConstructors}}
44-
45-
{{#class.hasOperators}}
46-
<li class="section-title"><a href="#operators">Operators</a></li>
47-
{{#class.operators}}
48-
<li><a href="{{href}}">{{name}}</a></li>
49-
{{/class.operators}}
50-
{{#class.inheritedOperators}}
51-
<li><a href="{{href}}">{{name}}</a></li>
52-
{{/class.inheritedOperators}}
53-
{{/class.hasOperators}}
54-
55-
{{#class.hasMethods}}
56-
<li class="section-title"><a href="#methods">Methods</a></li>
57-
{{#class.instanceMethods}}
58-
<li><a href="{{href}}">{{name}}</a></li>
59-
{{/class.instanceMethods}}
60-
{{#class.inheritedMethods}}
61-
<li><a href="{{href}}">{{name}}</a></li>
62-
{{/class.inheritedMethods}}
63-
{{/class.hasMethods}}
64-
</ol>
6+
{{>sidebar_for_class}}
657
</div><!--/.sidebar-offcanvas-->
668

679
<div class="col-xs-12 col-sm-9">

lib/templates/constructor.html

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,7 @@
66

77
<h5>{{{class.linkedName}}}</h5>
88

9-
<ol id="sidebar">
10-
{{#class.hasConstants}}
11-
<li class="section-title"><a href="#constants">Constants</a></li>
12-
{{#class.constants}}
13-
<li><a href="{{href}}">{{name}}</a></li>
14-
{{/class.constants}}
15-
{{/class.hasConstants}}
16-
17-
{{#class.hasStaticProperties}}
18-
<li class="section-title"><a href="#static-properties">Static properties</a></li>
19-
{{#class.staticProperties}}
20-
<li><a href="{{href}}">{{name}}</a></li>
21-
{{/class.staticProperties}}
22-
{{/class.hasStaticProperties}}
23-
24-
{{#class.hasStaticMethods}}
25-
<li class="section-title"><a href="#static-methods">Static methods</a></li>
26-
{{#class.staticMethods}}
27-
<li><a href="{{href}}">{{name}}</a></li>
28-
{{/class.staticMethods}}
29-
{{/class.hasStaticMethods}}
30-
31-
{{#class.hasInstanceProperties}}
32-
<li class="section-title"><a href="#instance-properties">Properties</a></li>
33-
{{#class.instanceProperties}}
34-
<li><a href="{{href}}">{{name}}</a></li>
35-
{{/class.instanceProperties}}
36-
{{#class.inheritedProperties}}
37-
<li><a href="{{href}}">{{name}}</a></li>
38-
{{/class.inheritedProperties}}
39-
{{/class.hasInstanceProperties}}
40-
41-
{{#class.hasConstructors}}
42-
<li class="section-title"><a href="#constructors">Constructors</a></li>
43-
{{#class.constructors}}
44-
<li><a href="{{href}}">{{shortName}}</a></li>
45-
{{/class.constructors}}
46-
{{/class.hasConstructors}}
47-
48-
{{#class.hasOperators}}
49-
<li class="section-title"><a href="#operators">Operators</a></li>
50-
{{#class.operators}}
51-
<li><a href="{{href}}">{{name}}</a></li>
52-
{{/class.operators}}
53-
{{#class.inheritedOperators}}
54-
<li><a href="{{href}}">{{name}}</a></li>
55-
{{/class.inheritedOperators}}
56-
{{/class.hasOperators}}
57-
58-
{{#class.hasMethods}}
59-
<li class="section-title"><a href="#methods">Methods</a></li>
60-
{{#class.instanceMethods}}
61-
<li><a href="{{href}}">{{name}}</a></li>
62-
{{/class.instanceMethods}}
63-
{{#class.inheritedMethods}}
64-
<li><a href="{{href}}">{{name}}</a></li>
65-
{{/class.inheritedMethods}}
66-
{{/class.hasMethods}}
67-
</ol>
9+
{{>sidebar_for_class}}
6810

6911
</div><!--/.sidebar-offcanvas-->
7012

lib/templates/method.html

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,7 @@
66

77
<h5>{{{class.linkedName}}}</h5>
88

9-
<ol id="sidebar">
10-
{{#class.hasConstants}}
11-
<li class="section-title"><a href="#constants">Constants</a></li>
12-
{{#class.constants}}
13-
<li><a href="{{href}}">{{name}}</a></li>
14-
{{/class.constants}}
15-
{{/class.hasConstants}}
16-
17-
{{#class.hasStaticProperties}}
18-
<li class="section-title"><a href="#static-properties">Static properties</a></li>
19-
{{#class.staticProperties}}
20-
<li><a href="{{href}}">{{name}}</a></li>
21-
{{/class.staticProperties}}
22-
{{/class.hasStaticProperties}}
23-
24-
{{#class.hasStaticMethods}}
25-
<li class="section-title"><a href="#static-methods">Static methods</a></li>
26-
{{#class.staticMethods}}
27-
<li><a href="{{href}}">{{name}}</a></li>
28-
{{/class.staticMethods}}
29-
{{/class.hasStaticMethods}}
30-
31-
{{#class.hasInstanceProperties}}
32-
<li class="section-title"><a href="#instance-properties">Properties</a></li>
33-
{{#class.instanceProperties}}
34-
<li><a href="{{href}}">{{name}}</a></li>
35-
{{/class.instanceProperties}}
36-
{{#class.inheritedProperties}}
37-
<li><a href="{{href}}">{{name}}</a></li>
38-
{{/class.inheritedProperties}}
39-
{{/class.hasInstanceProperties}}
40-
41-
{{#class.hasConstructors}}
42-
<li class="section-title"><a href="#constructors">Constructors</a></li>
43-
{{#class.constructors}}
44-
<li><a href="{{href}}">{{shortName}}</a></li>
45-
{{/class.constructors}}
46-
{{/class.hasConstructors}}
47-
48-
{{#class.hasOperators}}
49-
<li class="section-title"><a href="#operators">Operators</a></li>
50-
{{#class.operators}}
51-
<li><a href="{{href}}">{{name}}</a></li>
52-
{{/class.operators}}
53-
{{#class.inheritedOperators}}
54-
<li><a href="{{href}}">{{name}}</a></li>
55-
{{/class.inheritedOperators}}
56-
{{/class.hasOperators}}
57-
58-
{{#class.hasMethods}}
59-
<li class="section-title"><a href="#methods">Methods</a></li>
60-
{{#class.instanceMethods}}
61-
<li><a href="{{href}}">{{name}}</a></li>
62-
{{/class.instanceMethods}}
63-
{{#class.inheritedMethods}}
64-
<li><a href="{{href}}">{{name}}</a></li>
65-
{{/class.inheritedMethods}}
66-
{{/class.hasMethods}}
67-
</ol>
9+
{{>sidebar_for_class}}
6810

6911
</div><!--/.sidebar-offcanvas-->
7012

lib/templates/property.html

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,65 +6,7 @@
66

77
<h5>{{{class.linkedName}}}</h5>
88

9-
<ol id="sidebar">
10-
{{#class.hasConstants}}
11-
<li class="section-title"><a href="#constants">Constants</a></li>
12-
{{#class.constants}}
13-
<li><a href="{{href}}">{{name}}</a></li>
14-
{{/class.constants}}
15-
{{/class.hasConstants}}
16-
17-
{{#class.hasStaticProperties}}
18-
<li class="section-title"><a href="#static-properties">Static properties</a></li>
19-
{{#class.staticProperties}}
20-
<li><a href="{{href}}">{{name}}</a></li>
21-
{{/class.staticProperties}}
22-
{{/class.hasStaticProperties}}
23-
24-
{{#class.hasStaticMethods}}
25-
<li class="section-title"><a href="#static-methods">Static methods</a></li>
26-
{{#class.staticMethods}}
27-
<li><a href="{{href}}">{{name}}</a></li>
28-
{{/class.staticMethods}}
29-
{{/class.hasStaticMethods}}
30-
31-
{{#class.hasInstanceProperties}}
32-
<li class="section-title"><a href="#instance-properties">Properties</a></li>
33-
{{#class.instanceProperties}}
34-
<li><a href="{{href}}">{{name}}</a></li>
35-
{{/class.instanceProperties}}
36-
{{#class.inheritedProperties}}
37-
<li><a href="{{href}}">{{name}}</a></li>
38-
{{/class.inheritedProperties}}
39-
{{/class.hasInstanceProperties}}
40-
41-
{{#class.hasConstructors}}
42-
<li class="section-title"><a href="#constructors">Constructors</a></li>
43-
{{#class.constructors}}
44-
<li><a href="{{href}}">{{shortName}}</a></li>
45-
{{/class.constructors}}
46-
{{/class.hasConstructors}}
47-
48-
{{#class.hasOperators}}
49-
<li class="section-title"><a href="#operators">Operators</a></li>
50-
{{#class.operators}}
51-
<li><a href="{{href}}">{{name}}</a></li>
52-
{{/class.operators}}
53-
{{#class.inheritedOperators}}
54-
<li><a href="{{href}}">{{name}}</a></li>
55-
{{/class.inheritedOperators}}
56-
{{/class.hasOperators}}
57-
58-
{{#class.hasMethods}}
59-
<li class="section-title"><a href="#methods">Methods</a></li>
60-
{{#class.instanceMethods}}
61-
<li><a href="{{href}}">{{name}}</a></li>
62-
{{/class.instanceMethods}}
63-
{{#class.inheritedMethods}}
64-
<li><a href="{{href}}">{{name}}</a></li>
65-
{{/class.inheritedMethods}}
66-
{{/class.hasMethods}}
67-
</ol>
9+
{{>sidebar_for_class}}
6810

6911
</div><!--/.sidebar-offcanvas-->
7012

0 commit comments

Comments
 (0)