juicelang-theme 0.3.4 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/_includes/nav.html +1 -1
- data/_includes/nav_list.html +2 -2
- data/_includes/previous_and_next.html +23 -0
- data/_includes/toc.html +9 -0
- data/_layouts/default.html +8 -8
- data/_layouts/fullwidth_page.html +2 -1
- data/_layouts/page.html +2 -0
- data/_sass/syntax-highlighting.scss +49 -49
- data/assets/css/default.scss +53 -1
- data/lib/custom_filters.rb +53 -5
- data/lib/custom_tags.rb +36 -0
- data/lib/juicelang-theme.rb +1 -0
- data/lib/markdown_toc.rb +13 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e2847460c2f70f83c540e7eae4abd5ea93e6adcd3c028f99416b8849747301b
|
4
|
+
data.tar.gz: bb018cf890e58bbc704d5c9ba9f45099904a0f40e7d6c1b6ba941882295c2e85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d5ce05ffc73eb2af02ecd25a98b9fe9c5ee796161084c4c7ed42ac6bda0a5647ed08e38ae6387f6c55283dfe1e179099fc34df6ffca897594c17b1614c3561
|
7
|
+
data.tar.gz: d7cf5e0e84e02d7bba18fd2174bf48d4ac1396a0397f707ece42edf693adb604de74a79a22f5d16491e01d5bf755a535fa471d29ba192802b8b898d223dfcc8e
|
data/README.md
CHANGED
@@ -8,28 +8,34 @@ This is the theme of the website of the *juice* programming language ([juicelang
|
|
8
8
|
Add this line to your Jekyll site's `Gemfile`:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem "juicelang-theme"
|
11
|
+
gem "juicelang-theme", "~> 0.4", group: :jekyll_plugins
|
12
12
|
```
|
13
13
|
|
14
|
-
And add
|
14
|
+
And add the following lines to your Jekyll site's `_config.yml`:
|
15
15
|
|
16
16
|
```yaml
|
17
17
|
theme: juicelang-theme
|
18
|
+
plugins:
|
19
|
+
- juicelang-theme
|
18
20
|
```
|
19
21
|
|
20
|
-
|
22
|
+
Then execute:
|
21
23
|
|
22
|
-
|
24
|
+
```bash
|
25
|
+
$ bundle install
|
26
|
+
```
|
23
27
|
|
24
|
-
Or install
|
28
|
+
Or install the gem yourself using:
|
25
29
|
|
26
|
-
|
30
|
+
```bash
|
31
|
+
$ gem install juicelang-theme
|
32
|
+
```
|
27
33
|
|
28
34
|
## Development
|
29
35
|
|
30
36
|
To set up your environment to develop this theme, run `bundle install`.
|
31
37
|
|
32
|
-
|
38
|
+
To test this theme, run `bundle exec jekyll serve --watch` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test this theme's contents. As you make modifications to this theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
|
33
39
|
|
34
40
|
## License
|
35
41
|
|
data/_includes/nav.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<ul class="uk-nav-default" uk-nav='{"toggle": "> a.nav-parent-toggle"}''>
|
4
4
|
{% assign navigation = site.data.navigation[include.navigation] %}
|
5
5
|
{% assign indexPage = site.pages | find: "path", navigation.index_path %}
|
6
|
-
<li class="uk-nav-header"><a href="{{ indexPage
|
6
|
+
<li class="uk-nav-header"><a href="{{ indexPage | url_without_ext }}">{{ navigation.title }}</a></li>
|
7
7
|
{% include nav_list.html menu=navigation.menu accordion=true %}
|
8
8
|
</ul>
|
9
9
|
</div>
|
data/_includes/nav_list.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
{% if item.children %}
|
4
4
|
{% assign active = itemPage | is_active?: item.children %}
|
5
5
|
<li class="uk-parent{% if active %} uk-active uk-open{% endif %} uk-grid-collapse" uk-grid>
|
6
|
-
<a href="{{ itemPage
|
6
|
+
<a href="{{ itemPage | url_without_ext }}">{{ itemPage.title }}</a>
|
7
7
|
{% if include.accordion %}
|
8
8
|
<a href="#" class="nav-parent-toggle uk-width-expand"{% if active %} aria-expanded="true"{% endif %}><span uk-nav-parent-icon></span></a>
|
9
9
|
{% endif %}
|
@@ -14,7 +14,7 @@
|
|
14
14
|
{% else %}
|
15
15
|
{% assign active = itemPage | is_active? %}
|
16
16
|
<li{% if active %} class="uk-active"{% endif %}>
|
17
|
-
<a href="{{ itemPage
|
17
|
+
<a href="{{ itemPage | url_without_ext }}">{{ itemPage.title }}</a>
|
18
18
|
</li>
|
19
19
|
{% endif %}
|
20
20
|
{% endfor %}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{% if page.nav %}
|
2
|
+
{% assign previousAndNext = page | previous_and_next: site.data.navigation[page.nav] %}
|
3
|
+
{% assign previous = previousAndNext['previous'] %}
|
4
|
+
{% assign next = previousAndNext['next'] %}
|
5
|
+
<div class="uk-container uk-container-small uk-margin-medium-top">
|
6
|
+
<ul class="uk-pagination">
|
7
|
+
{% if previous %}
|
8
|
+
<li>
|
9
|
+
<a href="{{ previous | url_without_ext }}">
|
10
|
+
<span class="uk-margin-small-right" uk-pagination-previous></span> Previous
|
11
|
+
</a>
|
12
|
+
</li>
|
13
|
+
{% endif %}
|
14
|
+
{% if next %}
|
15
|
+
<li class="uk-margin-auto-left">
|
16
|
+
<a href="{{ next | url_without_ext }}">
|
17
|
+
Next <span class="uk-margin-small-left" uk-pagination-next></span>
|
18
|
+
</a>
|
19
|
+
</li>
|
20
|
+
{% endif %}
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
{% endif %}
|
data/_includes/toc.html
ADDED
data/_layouts/default.html
CHANGED
@@ -10,20 +10,20 @@
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
11
11
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
12
12
|
|
13
|
-
<link rel="apple-touch-icon" sizes="180x180" href="{{ '/assets/images/icons/apple-touch-icon.png' |
|
14
|
-
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/assets/images/icons/favicon-32x32.png' |
|
15
|
-
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/assets/images/icons/favicon-16x16.png' |
|
16
|
-
<link rel="manifest" href="{{ '/assets/images/icons/site.webmanifest' |
|
17
|
-
<link rel="mask-icon" href="{{ '/assets/images/icons/safari-pinned-tab.svg' |
|
18
|
-
<link rel="shortcut icon" href="{{ '/assets/images/icons/favicon.ico' |
|
13
|
+
<link rel="apple-touch-icon" sizes="180x180" href="{{ '/assets/images/icons/apple-touch-icon.png' | absolute_url }}">
|
14
|
+
<link rel="icon" type="image/png" sizes="32x32" href="{{ '/assets/images/icons/favicon-32x32.png' | absolute_url }}">
|
15
|
+
<link rel="icon" type="image/png" sizes="16x16" href="{{ '/assets/images/icons/favicon-16x16.png' | absolute_url }}">
|
16
|
+
<link rel="manifest" href="{{ '/assets/images/icons/site.webmanifest' | absolute_url }}">
|
17
|
+
<link rel="mask-icon" href="{{ '/assets/images/icons/safari-pinned-tab.svg' | absolute_url }}" color="#df8e15">
|
18
|
+
<link rel="shortcut icon" href="{{ '/assets/images/icons/favicon.ico' | absolute_url }}">
|
19
19
|
<meta name="apple-mobile-web-app-title" content="juicelang">
|
20
20
|
<meta name="application-name" content="juicelang">
|
21
21
|
<meta name="msapplication-TileColor" content="#df8e15">
|
22
|
-
<meta name="msapplication-config" content="{{ '/assets/images/icons/browserconfig.xml' |
|
22
|
+
<meta name="msapplication-config" content="{{ '/assets/images/icons/browserconfig.xml' | absolute_url }}">
|
23
23
|
<meta name="theme-color" content="#df8e15" media="(prefers-color-scheme: light)">
|
24
24
|
<meta name="theme-color" content="#02020b" media="(prefers-color-scheme: dark)">
|
25
25
|
|
26
|
-
<link href="{{ '/assets/css/default.css' |
|
26
|
+
<link href="{{ '/assets/css/default.css' | absolute_url }}" rel="stylesheet">
|
27
27
|
</head>
|
28
28
|
<body>
|
29
29
|
<nav class="uk-navbar-container uk-container uk-container-expand uk-navbar-transparent uk-light header" uk-navbar>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
layout: default
|
3
3
|
---
|
4
4
|
|
5
|
-
<div class="uk-container uk-container-expand content" uk-height-viewport="offset-top: true; offset-bottom: true">
|
5
|
+
<div class="uk-container uk-container-expand uk-padding-remove content" uk-height-viewport="offset-top: true; offset-bottom: true">
|
6
6
|
{{ content }}
|
7
|
+
{% include previous_and_next.html %}
|
7
8
|
</div>
|
data/_layouts/page.html
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$syntax-background-color: #
|
1
|
+
$syntax-background-color: #181e25;
|
2
2
|
$syntax-comment-color: #75715e;
|
3
3
|
$syntax-error-color: #960050;
|
4
4
|
$syntax-error-background-color: #1e0010;
|
@@ -30,11 +30,11 @@ $syntax-name-color: #a6e22e;
|
|
30
30
|
.k {
|
31
31
|
color: $syntax-keyword-color;
|
32
32
|
}
|
33
|
-
|
33
|
+
|
34
34
|
.l {
|
35
35
|
color: $syntax-literal-color;
|
36
36
|
}
|
37
|
-
|
37
|
+
|
38
38
|
.n {
|
39
39
|
color: $syntax-color-light;
|
40
40
|
}
|
@@ -66,7 +66,7 @@ $syntax-name-color: #a6e22e;
|
|
66
66
|
.ge {
|
67
67
|
font-style: italic
|
68
68
|
}
|
69
|
-
|
69
|
+
|
70
70
|
.gs {
|
71
71
|
font-weight: bold
|
72
72
|
}
|
@@ -74,91 +74,91 @@ $syntax-name-color: #a6e22e;
|
|
74
74
|
.kc {
|
75
75
|
color: $syntax-keyword-color;
|
76
76
|
}
|
77
|
-
|
77
|
+
|
78
78
|
.kd {
|
79
79
|
color: $syntax-keyword-color;
|
80
80
|
}
|
81
|
-
|
81
|
+
|
82
82
|
.kn {
|
83
83
|
color: $syntax-operator-color;
|
84
84
|
}
|
85
|
-
|
85
|
+
|
86
86
|
.kp {
|
87
87
|
color: $syntax-keyword-color;
|
88
88
|
}
|
89
|
-
|
89
|
+
|
90
90
|
.kr {
|
91
91
|
color: $syntax-keyword-color;
|
92
92
|
}
|
93
|
-
|
93
|
+
|
94
94
|
.kt {
|
95
95
|
color: $syntax-keyword-color;
|
96
96
|
}
|
97
|
-
|
97
|
+
|
98
98
|
.ld {
|
99
99
|
color: $syntax-string-literal-color;
|
100
100
|
}
|
101
|
-
|
101
|
+
|
102
102
|
.m {
|
103
103
|
color: $syntax-literal-color;
|
104
104
|
}
|
105
|
-
|
105
|
+
|
106
106
|
.s {
|
107
107
|
color: $syntax-string-literal-color;
|
108
108
|
}
|
109
|
-
|
109
|
+
|
110
110
|
.na {
|
111
111
|
color: $syntax-name-color;
|
112
112
|
}
|
113
|
-
|
113
|
+
|
114
114
|
.nb {
|
115
115
|
color: $syntax-color-light;
|
116
116
|
}
|
117
|
-
|
117
|
+
|
118
118
|
.nc {
|
119
119
|
color: $syntax-name-color;
|
120
120
|
}
|
121
|
-
|
121
|
+
|
122
122
|
.no {
|
123
123
|
color: $syntax-keyword-color;
|
124
124
|
}
|
125
|
-
|
125
|
+
|
126
126
|
.nd {
|
127
127
|
color: $syntax-name-color;
|
128
128
|
}
|
129
|
-
|
129
|
+
|
130
130
|
.ni {
|
131
131
|
color: $syntax-color-light;
|
132
132
|
}
|
133
|
-
|
133
|
+
|
134
134
|
.ne {
|
135
135
|
color: $syntax-name-color;
|
136
136
|
}
|
137
|
-
|
137
|
+
|
138
138
|
.nf {
|
139
139
|
color: $syntax-name-color;
|
140
140
|
}
|
141
|
-
|
141
|
+
|
142
142
|
.nl {
|
143
143
|
color: $syntax-color-light;
|
144
144
|
}
|
145
|
-
|
145
|
+
|
146
146
|
.nn {
|
147
147
|
color: $syntax-color-light;
|
148
148
|
}
|
149
|
-
|
149
|
+
|
150
150
|
.nx {
|
151
151
|
color: $syntax-name-color;
|
152
152
|
}
|
153
|
-
|
153
|
+
|
154
154
|
.py {
|
155
155
|
color: $syntax-color-light;
|
156
156
|
}
|
157
|
-
|
157
|
+
|
158
158
|
.nt {
|
159
159
|
color: $syntax-operator-color;
|
160
160
|
}
|
161
|
-
|
161
|
+
|
162
162
|
.nv {
|
163
163
|
color: $syntax-color-light;
|
164
164
|
}
|
@@ -166,87 +166,87 @@ $syntax-name-color: #a6e22e;
|
|
166
166
|
.ow {
|
167
167
|
color: $syntax-operator-color;
|
168
168
|
}
|
169
|
-
|
169
|
+
|
170
170
|
.w {
|
171
171
|
color: $syntax-color-light;
|
172
172
|
}
|
173
|
-
|
173
|
+
|
174
174
|
.mf {
|
175
175
|
color: $syntax-literal-color;
|
176
176
|
}
|
177
|
-
|
177
|
+
|
178
178
|
.mh {
|
179
179
|
color: $syntax-literal-color;
|
180
180
|
}
|
181
|
-
|
181
|
+
|
182
182
|
.mi {
|
183
183
|
color: $syntax-literal-color;
|
184
184
|
}
|
185
|
-
|
185
|
+
|
186
186
|
.mo {
|
187
187
|
color: $syntax-literal-color;
|
188
188
|
}
|
189
|
-
|
189
|
+
|
190
190
|
.sb {
|
191
191
|
color: $syntax-string-literal-color;
|
192
192
|
}
|
193
|
-
|
193
|
+
|
194
194
|
.sc {
|
195
195
|
color: $syntax-string-literal-color;
|
196
196
|
}
|
197
|
-
|
197
|
+
|
198
198
|
.sd {
|
199
199
|
color: $syntax-string-literal-color;
|
200
200
|
}
|
201
|
-
|
201
|
+
|
202
202
|
.s2 {
|
203
203
|
color: $syntax-string-literal-color;
|
204
204
|
}
|
205
|
-
|
205
|
+
|
206
206
|
.se {
|
207
207
|
color: $syntax-literal-color;
|
208
208
|
}
|
209
|
-
|
209
|
+
|
210
210
|
.sh {
|
211
211
|
color: $syntax-string-literal-color;
|
212
212
|
}
|
213
|
-
|
213
|
+
|
214
214
|
.si {
|
215
215
|
color: $syntax-string-literal-color;
|
216
216
|
}
|
217
|
-
|
217
|
+
|
218
218
|
.sx {
|
219
219
|
color: $syntax-string-literal-color;
|
220
220
|
}
|
221
|
-
|
221
|
+
|
222
222
|
.sr {
|
223
223
|
color: $syntax-string-literal-color;
|
224
224
|
}
|
225
|
-
|
225
|
+
|
226
226
|
.s1 {
|
227
227
|
color: $syntax-string-literal-color;
|
228
228
|
}
|
229
|
-
|
229
|
+
|
230
230
|
.ss {
|
231
231
|
color: $syntax-string-literal-color;
|
232
232
|
}
|
233
|
-
|
233
|
+
|
234
234
|
.bp {
|
235
235
|
color: $syntax-color-light;
|
236
236
|
}
|
237
|
-
|
237
|
+
|
238
238
|
.vc {
|
239
239
|
color: $syntax-color-light;
|
240
240
|
}
|
241
|
-
|
241
|
+
|
242
242
|
.vg {
|
243
243
|
color: $syntax-color-light;
|
244
244
|
}
|
245
|
-
|
245
|
+
|
246
246
|
.vi {
|
247
247
|
color: $syntax-color-light;
|
248
248
|
}
|
249
|
-
|
249
|
+
|
250
250
|
.il {
|
251
251
|
color: $syntax-literal-color;
|
252
252
|
}
|
@@ -254,11 +254,11 @@ $syntax-name-color: #a6e22e;
|
|
254
254
|
.gu {
|
255
255
|
color: $syntax-comment-color;
|
256
256
|
}
|
257
|
-
|
257
|
+
|
258
258
|
.gd {
|
259
259
|
color: $syntax-operator-color;
|
260
260
|
}
|
261
|
-
|
261
|
+
|
262
262
|
.gi {
|
263
263
|
color: $syntax-name-color;
|
264
264
|
}
|
data/assets/css/default.scss
CHANGED
@@ -14,6 +14,8 @@ $base-heading-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI
|
|
14
14
|
$navbar-nav-item-font-family: $base-heading-font-family;
|
15
15
|
$logo-font-family: $base-heading-font-family;
|
16
16
|
|
17
|
+
$global-secondary-background: #181e25;
|
18
|
+
|
17
19
|
$inverse-logo-hover-color: rgba(white, .85);
|
18
20
|
$logo-font-size: 4rem;
|
19
21
|
$navbar-gap: 0;
|
@@ -236,6 +238,56 @@ $languages: "ebnf", "juice";
|
|
236
238
|
margin-top: $margin-large-margin;
|
237
239
|
}
|
238
240
|
|
241
|
+
.sidebar-right {
|
242
|
+
position: absolute;
|
243
|
+
left: unquote('calc(50% + #{$half-container-small-width} + 25px)');
|
244
|
+
right: 10px;
|
245
|
+
top: 0;
|
246
|
+
max-width: 250px;
|
247
|
+
|
248
|
+
ul.uk-nav {
|
249
|
+
& > li {
|
250
|
+
& > a {
|
251
|
+
position: relative;
|
252
|
+
|
253
|
+
&::before, &::after {
|
254
|
+
content: "";
|
255
|
+
position: absolute;
|
256
|
+
top: 100%;
|
257
|
+
bottom: 0;
|
258
|
+
left: -5px;
|
259
|
+
transition: all .2s ease-in-out;
|
260
|
+
}
|
261
|
+
|
262
|
+
&::before {
|
263
|
+
width: 0;
|
264
|
+
border-left: 1px solid #df8e15;
|
265
|
+
}
|
266
|
+
|
267
|
+
&::after {
|
268
|
+
right: 0;
|
269
|
+
background: linear-gradient(to right, rgba(#df8e15, .3), transparent);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
&.uk-active {
|
274
|
+
& > a {
|
275
|
+
&::before, &::after {
|
276
|
+
top: 0;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
& ~ li:not(.uk-active) > a {
|
281
|
+
&::before, &::after {
|
282
|
+
top: 0;
|
283
|
+
bottom: 100%;
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
}
|
289
|
+
}
|
290
|
+
|
239
291
|
.highlighter-rouge {
|
240
292
|
position: relative;
|
241
293
|
|
@@ -256,7 +308,7 @@ $languages: "ebnf", "juice";
|
|
256
308
|
}
|
257
309
|
|
258
310
|
.header {
|
259
|
-
background: #
|
311
|
+
background: #181e25;
|
260
312
|
|
261
313
|
.header-nav {
|
262
314
|
color: #ee5a16;
|
data/lib/custom_filters.rb
CHANGED
@@ -13,13 +13,48 @@ module Jekyll
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def find(input, property, targetValue = nil)
|
16
|
-
|
17
|
-
|
16
|
+
first(where(input, property, targetValue))
|
17
|
+
end
|
18
|
+
|
19
|
+
def previous_and_next(pageHash, nav)
|
20
|
+
result = {'previous' => nil, 'next' => nil}
|
21
|
+
page = pageFromHash(pageHash)
|
22
|
+
|
23
|
+
indexPage = pageFromHash(nav, 'index_path')
|
24
|
+
|
25
|
+
if page.equal? indexPage
|
26
|
+
result['next'] = pageFromHash(nav['menu'].first)
|
27
|
+
return result
|
28
|
+
end
|
29
|
+
|
30
|
+
flattenedMenu = flattenMenu(nav['menu'])
|
31
|
+
|
32
|
+
for i in 0...flattenedMenu.count
|
33
|
+
pageI = flattenedMenu[i]
|
34
|
+
|
35
|
+
if page.equal? pageI
|
36
|
+
result['previous'] = i == 0 ? indexPage : flattenedMenu[i - 1]
|
37
|
+
result['next'] = flattenedMenu[i + 1] unless i == flattenedMenu.count - 1
|
38
|
+
return result
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
45
|
+
def url_without_ext(pageHash)
|
46
|
+
page = pageFromHash(pageHash)
|
47
|
+
url = absolute_url(page.url)
|
48
|
+
|
49
|
+
return url.sub /\.x?html?$/, ''
|
18
50
|
end
|
19
51
|
|
20
52
|
|
21
53
|
private
|
22
54
|
|
55
|
+
include Liquid::StandardFilters
|
56
|
+
include Jekyll::Filters::URLFilters
|
57
|
+
|
23
58
|
def currentPage
|
24
59
|
pageFromHash(@context.registers[:page])
|
25
60
|
end
|
@@ -28,10 +63,10 @@ module Jekyll
|
|
28
63
|
@context.registers[:site]
|
29
64
|
end
|
30
65
|
|
31
|
-
def pageFromHash(hash)
|
66
|
+
def pageFromHash(hash, pathKey = 'path')
|
32
67
|
site.pages.find { |page|
|
33
|
-
page.path == hash[
|
34
|
-
}
|
68
|
+
page.path == hash[pathKey]
|
69
|
+
} unless hash.nil?
|
35
70
|
end
|
36
71
|
|
37
72
|
def isActiveRecursion?(children)
|
@@ -39,6 +74,19 @@ module Jekyll
|
|
39
74
|
pageFromHash(item).equal?(currentPage) || isActiveRecursion?(item['children'])
|
40
75
|
}
|
41
76
|
end
|
77
|
+
|
78
|
+
def flattenMenu(menu)
|
79
|
+
result = []
|
80
|
+
|
81
|
+
for item in menu
|
82
|
+
result.push(pageFromHash(item))
|
83
|
+
if item['children']
|
84
|
+
result.concat(flattenMenu(item['children']))
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
result
|
89
|
+
end
|
42
90
|
end
|
43
91
|
end
|
44
92
|
|
data/lib/custom_tags.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'jekyll'
|
4
|
+
require 'kramdown'
|
5
|
+
require 'liquid'
|
6
|
+
|
7
|
+
require_relative 'markdown_toc'
|
8
|
+
|
9
|
+
|
10
|
+
class ToCTag < Liquid::Tag
|
11
|
+
def initialize(tag_name, input, tokens)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def render(context)
|
16
|
+
toc = Kramdown::Document.new(context.registers[:page]['content'], {
|
17
|
+
input: "GFM"
|
18
|
+
}).to_ToC
|
19
|
+
build_list(toc.select { |item| item[0] == 2 }, toc.first[1])
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def build_list(toc, topLink)
|
25
|
+
result = '<li class="uk-active"><a href="#' + topLink + '">Top</a></li>' + "\n"
|
26
|
+
|
27
|
+
for i in 0...toc.count
|
28
|
+
item = toc[i]
|
29
|
+
result += '<li><a href="#' + item[1] + '">' + item[2][0].value + "</a></li>\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
result
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
Liquid::Template.register_tag('toc', ToCTag)
|
data/lib/juicelang-theme.rb
CHANGED
data/lib/markdown_toc.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: juicelang-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Zoller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -92,6 +92,8 @@ files:
|
|
92
92
|
- _includes/logo.html
|
93
93
|
- _includes/nav.html
|
94
94
|
- _includes/nav_list.html
|
95
|
+
- _includes/previous_and_next.html
|
96
|
+
- _includes/toc.html
|
95
97
|
- _layouts/default.html
|
96
98
|
- _layouts/fullwidth_page.html
|
97
99
|
- _layouts/page.html
|
@@ -268,10 +270,12 @@ files:
|
|
268
270
|
- assets/images/juice.svg
|
269
271
|
- assets/js/default.js
|
270
272
|
- lib/custom_filters.rb
|
273
|
+
- lib/custom_tags.rb
|
271
274
|
- lib/ebnf_lexer.rb
|
272
275
|
- lib/juice_lexer.rb
|
273
276
|
- lib/juicelang-theme.rb
|
274
277
|
- lib/markdown.rb
|
278
|
+
- lib/markdown_toc.rb
|
275
279
|
homepage: https://github.com/juice-lang/juicelang-theme
|
276
280
|
licenses:
|
277
281
|
- MIT
|