juicelang-theme 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d73b2f6ebdca5313c0cc02930600bbb6c32e3e331599b33c7f3da0c5daec3f3
4
- data.tar.gz: 3907168273b4eef95b3fc3465dc1f785163803dd00aefb194f196bfdb824c695
3
+ metadata.gz: 611c546d0004cfb41f3627c1fa188ab79cf2ff4f864be6e67ab934bb5ae4ae5c
4
+ data.tar.gz: 7bb3f001686c7a4fb858a40951cc11f1428ac05b4f2d4cb35f300a8602abd2c3
5
5
  SHA512:
6
- metadata.gz: 3ea9fd205da69b65afc67dff6379448f3f17b7f9dfca58ffdc9c3a5dc3e0399eb863d640327b84844894566361ae8a1ede91a0f84c63bc68b45f01720734af97
7
- data.tar.gz: 4d626bab5570639a8325d39fd7d8fbb217b49252976ba2458ea4b7188526649d6956fc853fd0fa300c8b98bece0d477904789c3ae15ec5a36546b994def9b5ea
6
+ metadata.gz: '08837dd2c714ff87d9b6758448bf7f0275fb968cba6d764cd7c956feafcc9c1de28881a4d445d2970fcb8781875f3d760c8ac5db9f9f613d4adb90d1bbb4440d'
7
+ data.tar.gz: 3a2ca51818a9a649a440bfd07552bb4ad25398eac1cf27b743386e0ad63d59d7f9da753a5747c17aefcc255694694ea45226c5bd2ea04d44c712a03bc9bef9cd
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.url | absolute_url }}">{{ navigation.title }}</a></li>
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>
@@ -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.url | absolute_url }}">{{ itemPage.title }}</a>
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.url | absolute_url }}">{{ itemPage.title }}</a>
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 %}
@@ -0,0 +1,7 @@
1
+ <div class="sidebar-right uk-visible@l">
2
+ <div uk-sticky="offset: 175">
3
+ <ul class="uk-nav uk-nav-default" uk-scrollspy-nav="closest: li; scroll: true; offset: 175">
4
+ {% toc %}
5
+ </ul>
6
+ </div>
7
+ </div>
@@ -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' | relative_url }}">
14
- <link rel="icon" type="image/png" sizes="32x32" href="{{ '/assets/images/icons/favicon-32x32.png' | relative_url }}">
15
- <link rel="icon" type="image/png" sizes="16x16" href="{{ '/assets/images/icons/favicon-16x16.png' | relative_url }}">
16
- <link rel="manifest" href="{{ '/assets/images/icons/site.webmanifest' | relative_url }}">
17
- <link rel="mask-icon" href="{{ '/assets/images/icons/safari-pinned-tab.svg' | relative_url }}" color="#df8e15">
18
- <link rel="shortcut icon" href="{{ '/assets/images/icons/favicon.ico' | relative_url }}">
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' | relative_url }}">
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' | relative_url }}" rel="stylesheet">
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>
@@ -4,4 +4,5 @@ layout: default
4
4
 
5
5
  <div class="uk-container uk-container-expand 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
@@ -4,4 +4,6 @@ layout: default
4
4
 
5
5
  <div class="uk-container uk-container-small content" uk-height-viewport="offset-top: true; offset-bottom: true">
6
6
  {{ content }}
7
+ {% include toc.html %}
8
+ {% include previous_and_next.html %}
7
9
  </div>
@@ -1,4 +1,4 @@
1
- $syntax-background-color: #272822;
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
  }
@@ -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: #181E25;
311
+ background: #181e25;
260
312
 
261
313
  .header-nav {
262
314
  color: #ee5a16;
@@ -13,13 +13,48 @@ module Jekyll
13
13
  end
14
14
 
15
15
  def find(input, property, targetValue = nil)
16
- standardFilters = Class.new.extend(Liquid::StandardFilters)
17
- standardFilters.first(standardFilters.where(input, property, targetValue))
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['path']
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
 
@@ -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)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'custom_filters'
4
+ require_relative 'custom_tags'
4
5
  require_relative 'ebnf_lexer'
5
6
  require_relative 'juice_lexer'
6
7
  require_relative 'markdown'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'jekyll'
4
+ require 'kramdown'
5
+
6
+ class Kramdown::Converter::ToC < Kramdown::Converter::Html
7
+ def convert(el, indent = -@indent)
8
+ result = super
9
+ return result unless el.type == :root
10
+
11
+ @toc
12
+ end
13
+ end
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.3.4
4
+ version: 0.4.0
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-08-30 00:00:00.000000000 Z
11
+ date: 2022-08-31 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