yard-api-slatelike 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yard-api-slatelike/version.rb +1 -1
- data/templates/api/fulldoc/html/css/monokai.css +128 -0
- data/templates/api/fulldoc/html/css/slatelike.css +212 -0
- data/templates/api/fulldoc/html/css/vroom.css +144 -0
- data/templates/api/fulldoc/html/js/scrollspy.js +59 -0
- data/templates/api/fulldoc/html/js/slatelike/nav.js +60 -0
- data/templates/api/fulldoc/html/js/slatelike/nav_scrollspy.js +13 -0
- data/templates/api/fulldoc/html/js/slatelike.js +120 -0
- data/yard-api-slatelike.gemspec +1 -1
- metadata +8 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40e1e661f1183fe9e86a3350f02845214bd21913
|
4
|
+
data.tar.gz: 9e15a029bf925c55918225254fa9a87a49a70823
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10cb5c13ff28db62350a6245df812df1ded266462478565fc8be21171ef8b08942d7106a73af7510ec087448c6f3336bc7c54fbf9f56a7fe11b7baaa67256134
|
7
|
+
data.tar.gz: 4e25eb0369efca7a79b039e1d8de90872a8d9e3da5482152576e62bc48e62fb90d757bc427711bb68d21eea4d57a3b08cffb3f006e1f31ad35a2d87a2f0eb5fd
|
@@ -0,0 +1,128 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
Monokai style - ported by Luigi Maselli - http://grigio.org
|
4
|
+
*/
|
5
|
+
|
6
|
+
.hljs {
|
7
|
+
display: block;
|
8
|
+
overflow-x: auto;
|
9
|
+
padding: 0.5em;
|
10
|
+
background: #272822;
|
11
|
+
-webkit-text-size-adjust: none;
|
12
|
+
}
|
13
|
+
|
14
|
+
.hljs-tag,
|
15
|
+
.hljs-tag .hljs-title,
|
16
|
+
.hljs-keyword,
|
17
|
+
.hljs-literal,
|
18
|
+
.hljs-strong,
|
19
|
+
.hljs-change,
|
20
|
+
.hljs-winutils,
|
21
|
+
.hljs-flow,
|
22
|
+
.nginx .hljs-title,
|
23
|
+
.tex .hljs-special {
|
24
|
+
color: #f92672;
|
25
|
+
}
|
26
|
+
|
27
|
+
.hljs {
|
28
|
+
color: #ddd;
|
29
|
+
}
|
30
|
+
|
31
|
+
.hljs .hljs-constant,
|
32
|
+
.asciidoc .hljs-code {
|
33
|
+
color: #66d9ef;
|
34
|
+
}
|
35
|
+
|
36
|
+
.hljs-code,
|
37
|
+
.hljs-class .hljs-title,
|
38
|
+
.hljs-header {
|
39
|
+
color: white;
|
40
|
+
}
|
41
|
+
|
42
|
+
.hljs-link_label,
|
43
|
+
.hljs-attribute,
|
44
|
+
.hljs-symbol,
|
45
|
+
.hljs-symbol .hljs-string,
|
46
|
+
.hljs-value,
|
47
|
+
.hljs-regexp {
|
48
|
+
color: #bf79db;
|
49
|
+
}
|
50
|
+
|
51
|
+
.hljs-link_url,
|
52
|
+
.hljs-tag .hljs-value,
|
53
|
+
.hljs-string,
|
54
|
+
.hljs-bullet,
|
55
|
+
.hljs-subst,
|
56
|
+
.hljs-title,
|
57
|
+
.hljs-emphasis,
|
58
|
+
.hljs-type,
|
59
|
+
.hljs-preprocessor,
|
60
|
+
.hljs-pragma,
|
61
|
+
.ruby .hljs-class .hljs-parent,
|
62
|
+
.hljs-built_in,
|
63
|
+
.django .hljs-template_tag,
|
64
|
+
.django .hljs-variable,
|
65
|
+
.smalltalk .hljs-class,
|
66
|
+
.hljs-javadoc,
|
67
|
+
.django .hljs-filter .hljs-argument,
|
68
|
+
.smalltalk .hljs-localvars,
|
69
|
+
.smalltalk .hljs-array,
|
70
|
+
.hljs-attr_selector,
|
71
|
+
.hljs-pseudo,
|
72
|
+
.hljs-addition,
|
73
|
+
.hljs-stream,
|
74
|
+
.hljs-envvar,
|
75
|
+
.apache .hljs-tag,
|
76
|
+
.apache .hljs-cbracket,
|
77
|
+
.tex .hljs-command,
|
78
|
+
.hljs-prompt {
|
79
|
+
color: #a6e22e;
|
80
|
+
}
|
81
|
+
|
82
|
+
.hljs-comment,
|
83
|
+
.hljs-annotation,
|
84
|
+
.smartquote,
|
85
|
+
.hljs-blockquote,
|
86
|
+
.hljs-horizontal_rule,
|
87
|
+
.hljs-decorator,
|
88
|
+
.hljs-template_comment,
|
89
|
+
.hljs-pi,
|
90
|
+
.hljs-doctype,
|
91
|
+
.hljs-deletion,
|
92
|
+
.hljs-shebang,
|
93
|
+
.apache .hljs-sqbracket,
|
94
|
+
.tex .hljs-formula {
|
95
|
+
color: #75715e;
|
96
|
+
}
|
97
|
+
|
98
|
+
.hljs-keyword,
|
99
|
+
.hljs-literal,
|
100
|
+
.css .hljs-id,
|
101
|
+
.hljs-phpdoc,
|
102
|
+
.hljs-dartdoc,
|
103
|
+
.hljs-title,
|
104
|
+
.hljs-header,
|
105
|
+
.hljs-type,
|
106
|
+
.vbscript .hljs-built_in,
|
107
|
+
.rsl .hljs-built_in,
|
108
|
+
.smalltalk .hljs-class,
|
109
|
+
.diff .hljs-header,
|
110
|
+
.hljs-chunk,
|
111
|
+
.hljs-winutils,
|
112
|
+
.bash .hljs-variable,
|
113
|
+
.apache .hljs-tag,
|
114
|
+
.tex .hljs-special,
|
115
|
+
.hljs-request,
|
116
|
+
.hljs-status {
|
117
|
+
font-weight: bold;
|
118
|
+
}
|
119
|
+
|
120
|
+
.coffeescript .javascript,
|
121
|
+
.javascript .xml,
|
122
|
+
.tex .hljs-formula,
|
123
|
+
.xml .javascript,
|
124
|
+
.xml .vbscript,
|
125
|
+
.xml .css,
|
126
|
+
.xml .hljs-cdata {
|
127
|
+
opacity: 0.5;
|
128
|
+
}
|
@@ -0,0 +1,212 @@
|
|
1
|
+
#content h1 {
|
2
|
+
font-size: 30px;
|
3
|
+
padding-top: 0.5em;
|
4
|
+
padding-bottom: 0.5em;
|
5
|
+
border: 1px solid #ddd;
|
6
|
+
border-bottom: 1px solid #ccc;
|
7
|
+
margin-bottom: 21px;
|
8
|
+
margin-top: 2em;
|
9
|
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fff), color-stop(100%, #f9f9f9));
|
10
|
+
background-image: -webkit-linear-gradient(top, #fff, #f9f9f9);
|
11
|
+
background-image: -moz-linear-gradient(top, #fff, #f9f9f9);
|
12
|
+
background-image: -o-linear-gradient(top, #fff, #f9f9f9);
|
13
|
+
background-image: linear-gradient(top, #ffffff,#f9f9f9);
|
14
|
+
}
|
15
|
+
|
16
|
+
#sidebar .subnav {
|
17
|
+
margin: 0;
|
18
|
+
padding: 0;
|
19
|
+
list-style: none;
|
20
|
+
}
|
21
|
+
|
22
|
+
#sidebar a, #sidebar a:visited {
|
23
|
+
color: inherit;
|
24
|
+
}
|
25
|
+
|
26
|
+
#sidebar a:hover {
|
27
|
+
color: #aaa;
|
28
|
+
}
|
29
|
+
|
30
|
+
body {
|
31
|
+
background-color: #eaf2f6;
|
32
|
+
}
|
33
|
+
|
34
|
+
#sidebar {
|
35
|
+
background-color: #393939;
|
36
|
+
color: white;
|
37
|
+
padding: 0;
|
38
|
+
position: fixed;
|
39
|
+
left: 0;
|
40
|
+
width: 240px;
|
41
|
+
text-align: left;
|
42
|
+
}
|
43
|
+
|
44
|
+
#sidebar h1 {
|
45
|
+
margin: 0;
|
46
|
+
padding: 0;
|
47
|
+
background: #2a2a2a;
|
48
|
+
}
|
49
|
+
|
50
|
+
#sidebar h1 a {
|
51
|
+
padding: 20px;
|
52
|
+
}
|
53
|
+
|
54
|
+
#sidebar a {
|
55
|
+
padding-left: 20px;
|
56
|
+
padding-right: 20px;
|
57
|
+
}
|
58
|
+
|
59
|
+
#sidebar nav {
|
60
|
+
margin: 20px 0;
|
61
|
+
}
|
62
|
+
|
63
|
+
#sidebar .subnav {
|
64
|
+
padding-left: 20px;
|
65
|
+
background: #2a2a2a;
|
66
|
+
margin-left: -20px;
|
67
|
+
width: 260px;
|
68
|
+
text-shadow: 0 1px 0 rgba(0,0,0,0.75);
|
69
|
+
}
|
70
|
+
|
71
|
+
#sidebar .subnav a {
|
72
|
+
font-weight: normal;
|
73
|
+
}
|
74
|
+
|
75
|
+
#sidebar a.active {
|
76
|
+
background: #2467af;
|
77
|
+
color: white;
|
78
|
+
}
|
79
|
+
|
80
|
+
#sidebar .subnav a.active {
|
81
|
+
background: none;
|
82
|
+
color: green;
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
/*
|
87
|
+
Monokai style - ported by Luigi Maselli - http://grigio.org
|
88
|
+
*/
|
89
|
+
|
90
|
+
.hljs {
|
91
|
+
display: block;
|
92
|
+
overflow-x: auto;
|
93
|
+
padding: 0.5em;
|
94
|
+
background: #272822;
|
95
|
+
-webkit-text-size-adjust: none;
|
96
|
+
}
|
97
|
+
|
98
|
+
.hljs-tag,
|
99
|
+
.hljs-tag .hljs-title,
|
100
|
+
.hljs-keyword,
|
101
|
+
.hljs-literal,
|
102
|
+
.hljs-strong,
|
103
|
+
.hljs-change,
|
104
|
+
.hljs-winutils,
|
105
|
+
.hljs-flow,
|
106
|
+
.nginx .hljs-title,
|
107
|
+
.tex .hljs-special {
|
108
|
+
color: #f92672;
|
109
|
+
}
|
110
|
+
|
111
|
+
.hljs {
|
112
|
+
color: #ddd;
|
113
|
+
}
|
114
|
+
|
115
|
+
.hljs .hljs-constant,
|
116
|
+
.asciidoc .hljs-code {
|
117
|
+
color: #66d9ef;
|
118
|
+
}
|
119
|
+
|
120
|
+
.hljs-code,
|
121
|
+
.hljs-class .hljs-title,
|
122
|
+
.hljs-header {
|
123
|
+
color: white;
|
124
|
+
}
|
125
|
+
|
126
|
+
.hljs-link_label,
|
127
|
+
.hljs-attribute,
|
128
|
+
.hljs-symbol,
|
129
|
+
.hljs-symbol .hljs-string,
|
130
|
+
.hljs-value,
|
131
|
+
.hljs-regexp {
|
132
|
+
color: #bf79db;
|
133
|
+
}
|
134
|
+
|
135
|
+
.hljs-link_url,
|
136
|
+
.hljs-tag .hljs-value,
|
137
|
+
.hljs-string,
|
138
|
+
.hljs-bullet,
|
139
|
+
.hljs-subst,
|
140
|
+
.hljs-title,
|
141
|
+
.hljs-emphasis,
|
142
|
+
.hljs-type,
|
143
|
+
.hljs-preprocessor,
|
144
|
+
.hljs-pragma,
|
145
|
+
.ruby .hljs-class .hljs-parent,
|
146
|
+
.hljs-built_in,
|
147
|
+
.django .hljs-template_tag,
|
148
|
+
.django .hljs-variable,
|
149
|
+
.smalltalk .hljs-class,
|
150
|
+
.hljs-javadoc,
|
151
|
+
.django .hljs-filter .hljs-argument,
|
152
|
+
.smalltalk .hljs-localvars,
|
153
|
+
.smalltalk .hljs-array,
|
154
|
+
.hljs-attr_selector,
|
155
|
+
.hljs-pseudo,
|
156
|
+
.hljs-addition,
|
157
|
+
.hljs-stream,
|
158
|
+
.hljs-envvar,
|
159
|
+
.apache .hljs-tag,
|
160
|
+
.apache .hljs-cbracket,
|
161
|
+
.tex .hljs-command,
|
162
|
+
.hljs-prompt {
|
163
|
+
color: #a6e22e;
|
164
|
+
}
|
165
|
+
|
166
|
+
.hljs-comment,
|
167
|
+
.hljs-annotation,
|
168
|
+
.smartquote,
|
169
|
+
.hljs-blockquote,
|
170
|
+
.hljs-horizontal_rule,
|
171
|
+
.hljs-decorator,
|
172
|
+
.hljs-template_comment,
|
173
|
+
.hljs-pi,
|
174
|
+
.hljs-doctype,
|
175
|
+
.hljs-deletion,
|
176
|
+
.hljs-shebang,
|
177
|
+
.apache .hljs-sqbracket,
|
178
|
+
.tex .hljs-formula {
|
179
|
+
color: #75715e;
|
180
|
+
}
|
181
|
+
|
182
|
+
.hljs-keyword,
|
183
|
+
.hljs-literal,
|
184
|
+
.css .hljs-id,
|
185
|
+
.hljs-phpdoc,
|
186
|
+
.hljs-dartdoc,
|
187
|
+
.hljs-title,
|
188
|
+
.hljs-header,
|
189
|
+
.hljs-type,
|
190
|
+
.vbscript .hljs-built_in,
|
191
|
+
.rsl .hljs-built_in,
|
192
|
+
.smalltalk .hljs-class,
|
193
|
+
.diff .hljs-header,
|
194
|
+
.hljs-chunk,
|
195
|
+
.hljs-winutils,
|
196
|
+
.bash .hljs-variable,
|
197
|
+
.apache .hljs-tag,
|
198
|
+
.tex .hljs-special,
|
199
|
+
.hljs-request,
|
200
|
+
.hljs-status {
|
201
|
+
font-weight: bold;
|
202
|
+
}
|
203
|
+
|
204
|
+
.coffeescript .javascript,
|
205
|
+
.javascript .xml,
|
206
|
+
.tex .hljs-formula,
|
207
|
+
.xml .javascript,
|
208
|
+
.xml .vbscript,
|
209
|
+
.xml .css,
|
210
|
+
.xml .hljs-cdata {
|
211
|
+
opacity: 0.5;
|
212
|
+
}
|
@@ -0,0 +1,144 @@
|
|
1
|
+
body {
|
2
|
+
font: 16px/1.6 Helvetica, arial, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
3
|
+
}
|
4
|
+
|
5
|
+
#content h1 {
|
6
|
+
}
|
7
|
+
|
8
|
+
#sidebar a, #sidebar a:visited {
|
9
|
+
color: inherit;
|
10
|
+
}
|
11
|
+
|
12
|
+
#sidebar a:hover {
|
13
|
+
color: #888;
|
14
|
+
}
|
15
|
+
|
16
|
+
#sidebar {
|
17
|
+
background-color: #f4f4f4;
|
18
|
+
padding: 0;
|
19
|
+
text-align: left;
|
20
|
+
border-right-color: #ddd;
|
21
|
+
}
|
22
|
+
|
23
|
+
#sidebar h1 {
|
24
|
+
margin-right: 20px;
|
25
|
+
}
|
26
|
+
.onefile #sidebar h1 {
|
27
|
+
margin: 0;
|
28
|
+
padding: 0;
|
29
|
+
background: #eee;
|
30
|
+
border-bottom-color: #ddd;
|
31
|
+
}
|
32
|
+
|
33
|
+
#sidebar h1 a {
|
34
|
+
padding: 20px;
|
35
|
+
font-size: inherit;
|
36
|
+
}
|
37
|
+
|
38
|
+
#sidebar h2 {
|
39
|
+
padding: 0 20px;
|
40
|
+
color: #777;
|
41
|
+
}
|
42
|
+
|
43
|
+
#sidebar h2:first-of-type {
|
44
|
+
margin-top: 20px;
|
45
|
+
}
|
46
|
+
|
47
|
+
#sidebar a {
|
48
|
+
padding-left: 20px;
|
49
|
+
padding-right: 20px;
|
50
|
+
}
|
51
|
+
|
52
|
+
#sidebar nav {
|
53
|
+
margin: 20px 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
#sidebar .subnav {
|
57
|
+
margin: 0;
|
58
|
+
padding: 0;
|
59
|
+
list-style: none;
|
60
|
+
padding-left: 40px;
|
61
|
+
margin-left: -20px;
|
62
|
+
}
|
63
|
+
|
64
|
+
#sidebar .subnav a {
|
65
|
+
font-weight: normal;
|
66
|
+
}
|
67
|
+
|
68
|
+
#sidebar a.active {
|
69
|
+
background: #3498db;
|
70
|
+
color: white;
|
71
|
+
}
|
72
|
+
|
73
|
+
#sidebar .subnav a.active {
|
74
|
+
background: none;
|
75
|
+
color: inherit;
|
76
|
+
font-weight: bold;
|
77
|
+
}
|
78
|
+
|
79
|
+
#sidebar .subnav a.active:before {
|
80
|
+
display: inline-block;
|
81
|
+
content: '';
|
82
|
+
position: absolute;
|
83
|
+
margin-left: -12px;
|
84
|
+
margin-top: 4px;
|
85
|
+
width: 0;
|
86
|
+
height: 0;
|
87
|
+
border-style: solid;
|
88
|
+
border-width: 5px 0 5px 8.7px;
|
89
|
+
border-color: transparent transparent transparent #3498db;
|
90
|
+
}
|
91
|
+
|
92
|
+
code {
|
93
|
+
border: none;
|
94
|
+
padding: 0;
|
95
|
+
}
|
96
|
+
|
97
|
+
#sidebar a.active.api_resource_link:after {
|
98
|
+
color: #ccc;
|
99
|
+
}
|
100
|
+
|
101
|
+
#sidebar .api_resource_link:after {
|
102
|
+
content: "API";
|
103
|
+
color: #888;
|
104
|
+
font-weight: bold;
|
105
|
+
margin-left: 5px;
|
106
|
+
}
|
107
|
+
|
108
|
+
.hljs, .method_details h3.endpoint {
|
109
|
+
background-color: #f4f4f4;
|
110
|
+
}
|
111
|
+
|
112
|
+
pre.code, div.syntaxhighlighter {
|
113
|
+
/*background-color: inherit;*/
|
114
|
+
border: none;
|
115
|
+
font-size: inherit;
|
116
|
+
line-height: inherit;
|
117
|
+
overflow: auto;
|
118
|
+
/*padding: inherit;*/
|
119
|
+
border-radius: 0;
|
120
|
+
font-family: monospace, Monaco, Consolas, Courier;
|
121
|
+
}
|
122
|
+
|
123
|
+
table {
|
124
|
+
border-collapse: collapse;
|
125
|
+
border-spacing: 0;
|
126
|
+
width: 100%;
|
127
|
+
}
|
128
|
+
|
129
|
+
th {
|
130
|
+
text-align: left;
|
131
|
+
background: #f4f4f4;
|
132
|
+
font-weight: bold;
|
133
|
+
}
|
134
|
+
|
135
|
+
td, th {
|
136
|
+
border: 1px solid #ddd;
|
137
|
+
padding: 6px 13px;
|
138
|
+
vertical-align: top;
|
139
|
+
}
|
140
|
+
|
141
|
+
td ul.argument-values {
|
142
|
+
margin: 0;
|
143
|
+
padding: 0 0 0 15px;
|
144
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
(function($) {
|
2
|
+
var $window = $(window);
|
3
|
+
var guid = 0;
|
4
|
+
var defaults = { defer: undefined };
|
5
|
+
|
6
|
+
$.fn.scrollSpy = function(options) {
|
7
|
+
if (!options) {
|
8
|
+
options = defaults;
|
9
|
+
}
|
10
|
+
|
11
|
+
var lastId;
|
12
|
+
var focalNodes = $(this).toArray().map(function(node) {
|
13
|
+
var $node = $(node);
|
14
|
+
|
15
|
+
return {
|
16
|
+
id: node.id,
|
17
|
+
$node: $node,
|
18
|
+
top: parseInt($node.offset().top, 10) + ($node.outerHeight()/2)
|
19
|
+
};
|
20
|
+
}).sort(function(a,b) {
|
21
|
+
return a.top - b.top;
|
22
|
+
});
|
23
|
+
|
24
|
+
var trigger = function(nodeEntry) {
|
25
|
+
nodeEntry.$node.triggerHandler('scrollSpy', [ nodeEntry.id, lastId ]);
|
26
|
+
};
|
27
|
+
|
28
|
+
$window.on('scroll.scrollSpy_' + (++guid), function() {
|
29
|
+
var scrollTop = $window.scrollTop();
|
30
|
+
var nodeEntry, i;
|
31
|
+
|
32
|
+
for (i = 0; i < focalNodes.length; ++i) {
|
33
|
+
if (focalNodes[i].top > scrollTop) {
|
34
|
+
if (focalNodes[i].top - scrollTop < $window.outerHeight()) {
|
35
|
+
nodeEntry = focalNodes[i];
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
if (nodeEntry && lastId !== nodeEntry.id) {
|
42
|
+
if (options.defer !== undefined) {
|
43
|
+
setTimeout(trigger.bind(null, nodeEntry), options.defer);
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
trigger(nodeEntry);
|
47
|
+
}
|
48
|
+
|
49
|
+
lastId = nodeEntry.id;
|
50
|
+
}
|
51
|
+
});
|
52
|
+
|
53
|
+
return {
|
54
|
+
reset: function() {
|
55
|
+
lastId = null;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
};
|
59
|
+
}(jQuery));
|
@@ -0,0 +1,60 @@
|
|
1
|
+
$(function() {
|
2
|
+
var scrollSpySelector = $('h1');
|
3
|
+
var $sidebar = $('#sidebar');
|
4
|
+
var $staticPages = $sidebar.find('#static_pages');
|
5
|
+
|
6
|
+
var guid = 1;
|
7
|
+
var sanitizeText = function(text) {
|
8
|
+
return text
|
9
|
+
.toLowerCase()
|
10
|
+
.replace(/\s+/g, ' ')
|
11
|
+
.replace(/\W+/g, '_')
|
12
|
+
.trim();
|
13
|
+
};
|
14
|
+
|
15
|
+
// Make sure all headings have an id so we can anchor to them
|
16
|
+
$('h1:not([id]), h2:not([id])').each(function() {
|
17
|
+
this.id = ['auto', (++guid), sanitizeText(this.innerText) ].join('_');
|
18
|
+
});
|
19
|
+
|
20
|
+
var mainHeaders = $('h1').toArray().map(function(h1) {
|
21
|
+
var $h1 = $(h1);
|
22
|
+
|
23
|
+
return {
|
24
|
+
id: h1.id,
|
25
|
+
comparator: sanitizeText($h1.text()),
|
26
|
+
children: $h1.nextAll('h2').toArray()
|
27
|
+
};
|
28
|
+
});
|
29
|
+
|
30
|
+
console.log(mainHeaders);
|
31
|
+
|
32
|
+
mainHeaders.forEach(function(header) {
|
33
|
+
var $subLinks;
|
34
|
+
var sidebarLink = $staticPages.find('a').filter(function() {
|
35
|
+
return sanitizeText($(this).text()) === header.comparator;
|
36
|
+
})[0];
|
37
|
+
|
38
|
+
if (!sidebarLink) {
|
39
|
+
console.warn('Unable to find sidebar entry for header %s', header.comparator);
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
|
43
|
+
$subLinks = $('<ul />');
|
44
|
+
|
45
|
+
header.children.forEach(function(el) {
|
46
|
+
var $el = $(el);
|
47
|
+
var $anchor = $('<a />', {
|
48
|
+
href: '#' + $el.attr('id')
|
49
|
+
}).text($el.text());
|
50
|
+
|
51
|
+
$('<li />').append($anchor).appendTo($subLinks);
|
52
|
+
});
|
53
|
+
|
54
|
+
$(sidebarLink).after($subLinks);
|
55
|
+
|
56
|
+
// finally, change the original anchor that points to the article file
|
57
|
+
// to point to the bookmark in the current page
|
58
|
+
sidebarLink.href = '#' + header.id;
|
59
|
+
});
|
60
|
+
});
|
@@ -0,0 +1,13 @@
|
|
1
|
+
$(function() {
|
2
|
+
var scrollSpySelector = $('#content h1');
|
3
|
+
|
4
|
+
$(scrollSpySelector).on('scrollSpy:enter', function() {
|
5
|
+
console.log('enter:', $(this).attr('id'));
|
6
|
+
});
|
7
|
+
|
8
|
+
$(scrollSpySelector).on('scrollSpy:exit', function() {
|
9
|
+
console.log('exit:', $(this).attr('id'));
|
10
|
+
});
|
11
|
+
|
12
|
+
$(scrollSpySelector).scrollSpy();
|
13
|
+
});
|
@@ -0,0 +1,120 @@
|
|
1
|
+
$(function() {
|
2
|
+
// =========================================================================
|
3
|
+
// Sidebar navigation
|
4
|
+
// =========================================================================
|
5
|
+
(function linkifyHeaders() {
|
6
|
+
var $staticPages = $('#static_pages');
|
7
|
+
|
8
|
+
var guid = 1;
|
9
|
+
var sanitizeText = function(text) {
|
10
|
+
return text
|
11
|
+
.replace(/\sAPI$/, '')
|
12
|
+
.toLowerCase()
|
13
|
+
.replace(/\s+/g, ' ')
|
14
|
+
.replace(/\W+/g, '-')
|
15
|
+
.trim();
|
16
|
+
};
|
17
|
+
|
18
|
+
// Make sure all headings have an id so we can anchor to them
|
19
|
+
$('#content').find('h1:not([id]), h2:not([id])').each(function() {
|
20
|
+
this.id = [ sanitizeText(this.innerText) ].join('_');
|
21
|
+
});
|
22
|
+
|
23
|
+
var mainHeaders = $('#content h1[id]').toArray().map(function(h1) {
|
24
|
+
var $h1 = $(h1);
|
25
|
+
var text;
|
26
|
+
var subSections;
|
27
|
+
|
28
|
+
if ($h1.next().is('article')) {
|
29
|
+
subSections = $h1.nextAll('.method_details_list').find('h2');
|
30
|
+
} else {
|
31
|
+
subSections = $h1.nextAll('h2');
|
32
|
+
}
|
33
|
+
|
34
|
+
return {
|
35
|
+
id: h1.id,
|
36
|
+
comparator: sanitizeText(h1.innerText),
|
37
|
+
children: subSections.toArray()
|
38
|
+
};
|
39
|
+
});
|
40
|
+
|
41
|
+
mainHeaders.forEach(function(header) {
|
42
|
+
var $subLinks;
|
43
|
+
var sidebarLink = $staticPages.find('a').filter(function() {
|
44
|
+
return sanitizeText(this.innerText) === header.comparator;
|
45
|
+
})[0];
|
46
|
+
|
47
|
+
if (!sidebarLink) {
|
48
|
+
console.warn('Unable to find sidebar entry for header %s', header.comparator);
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
|
52
|
+
$subLinks = $('<ul />', { class: 'subnav' });
|
53
|
+
|
54
|
+
header.children.forEach(function(el) {
|
55
|
+
var $el = $(el);
|
56
|
+
var text;
|
57
|
+
if ($el.find('a').length) {
|
58
|
+
text = $el.find('a:first')[0].innerText;
|
59
|
+
}
|
60
|
+
else {
|
61
|
+
text = $el[0].innerText;
|
62
|
+
}
|
63
|
+
|
64
|
+
var $anchor = $('<a />', {
|
65
|
+
href: '#' + $el.attr('id')
|
66
|
+
}).text(text);
|
67
|
+
|
68
|
+
$('<li />').append($anchor).appendTo($subLinks);
|
69
|
+
});
|
70
|
+
|
71
|
+
$(sidebarLink).after($subLinks.hide());
|
72
|
+
|
73
|
+
// finally, change the original anchor that points to the article file
|
74
|
+
// to point to the bookmark in the current page
|
75
|
+
sidebarLink.href = '#' + header.id;
|
76
|
+
});
|
77
|
+
}());
|
78
|
+
|
79
|
+
// =========================================================================
|
80
|
+
// Scroll spying
|
81
|
+
// =========================================================================
|
82
|
+
(function installScrollSpy() {
|
83
|
+
var $staticPages = $('#static_pages');
|
84
|
+
var findLink = function(header) {
|
85
|
+
return $staticPages.find('a[href="#' + header.id + '"]');
|
86
|
+
};
|
87
|
+
var findSubnav = function(header) {
|
88
|
+
return findLink(header).next('.subnav');
|
89
|
+
};
|
90
|
+
|
91
|
+
var highlightSection = function($subnav) {
|
92
|
+
$staticPages.find('> a.active').removeClass('active');
|
93
|
+
$staticPages.find('.subnav:visible').hide();
|
94
|
+
$subnav.show().prev('a').addClass('active');
|
95
|
+
};
|
96
|
+
|
97
|
+
var highlightSubsection = function($link) {
|
98
|
+
$staticPages.find('.subnav a.active').removeClass('active');
|
99
|
+
$link.addClass('active');
|
100
|
+
highlightSection($link.closest('.subnav'));
|
101
|
+
};
|
102
|
+
|
103
|
+
var updateLocation = function(href) {
|
104
|
+
history.pushState(null, null, '#'+href);
|
105
|
+
};
|
106
|
+
|
107
|
+
$('#content h1').on('scrollSpy', function() {
|
108
|
+
highlightSection(findSubnav(this));
|
109
|
+
updateLocation(this.id);
|
110
|
+
});
|
111
|
+
|
112
|
+
$('#content h2').on('scrollSpy', function() {
|
113
|
+
highlightSubsection(findLink(this));
|
114
|
+
updateLocation(this.id);
|
115
|
+
});
|
116
|
+
|
117
|
+
$('#content h1').scrollSpy();
|
118
|
+
$('#content h2').scrollSpy({ defer: 0 });
|
119
|
+
}(this));
|
120
|
+
});
|
data/yard-api-slatelike.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.authors = ["Ahmad Amireh"]
|
12
12
|
s.email = 'ahmad@instructure.com'
|
13
13
|
s.homepage = 'https://github.com/amireh/yard-api-slatelike'
|
14
|
-
s.files = Dir.glob("{lib,spec,templates}
|
14
|
+
s.files = Dir.glob("{config,lib,spec,templates}/**/*") +
|
15
15
|
['LICENSE', 'README.md', '.rspec', __FILE__]
|
16
16
|
s.has_rdoc = 'yard'
|
17
17
|
s.license = 'AGPL3'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-api-slatelike
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmad Amireh
|
@@ -79,6 +79,13 @@ files:
|
|
79
79
|
- lib/yard-api-slatelike.rb
|
80
80
|
- lib/yard-api-slatelike/options.rb
|
81
81
|
- lib/yard-api-slatelike/version.rb
|
82
|
+
- templates/api/fulldoc/html/css/monokai.css
|
83
|
+
- templates/api/fulldoc/html/css/slatelike.css
|
84
|
+
- templates/api/fulldoc/html/css/vroom.css
|
85
|
+
- templates/api/fulldoc/html/js/scrollspy.js
|
86
|
+
- templates/api/fulldoc/html/js/slatelike.js
|
87
|
+
- templates/api/fulldoc/html/js/slatelike/nav.js
|
88
|
+
- templates/api/fulldoc/html/js/slatelike/nav_scrollspy.js
|
82
89
|
- templates/api/layout/html/_styles.erb
|
83
90
|
- templates/api/layout/html/setup.rb
|
84
91
|
- yard-api-slatelike.gemspec
|