jekyll-theme-switch 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/_data/i18n.yaml +42 -0
  4. data/_includes/date.html +1 -4
  5. data/_includes/footer.html +42 -13
  6. data/_includes/footer_text.html +5 -0
  7. data/_includes/head.html +37 -40
  8. data/_includes/month.html +7 -14
  9. data/_includes/page_title.html +1 -0
  10. data/_includes/paginator_nav.html +24 -0
  11. data/_includes/post_item.html +34 -0
  12. data/_includes/post_list.html +7 -0
  13. data/_includes/post_meta.html +9 -0
  14. data/_includes/post_nav.html +22 -0
  15. data/_includes/rss/channel.html +3 -0
  16. data/_includes/rss/post.html +1 -1
  17. data/_includes/youtube.html +1 -1
  18. data/_layouts/archive.html +1 -1
  19. data/_layouts/category_page.html +2 -37
  20. data/_layouts/default.html +2 -0
  21. data/_layouts/home.html +2 -69
  22. data/_layouts/monthly_archive.html +2 -2
  23. data/_layouts/post.html +1 -22
  24. data/_layouts/rss.html +1 -2
  25. data/_layouts/series_post.html +2 -2
  26. data/_layouts/tag_page.html +2 -36
  27. data/_layouts/yearly_archive.html +2 -1
  28. data/_sass/jekyll-theme-switch/_base.scss +61 -40
  29. data/_sass/jekyll-theme-switch/_dark.scss +5 -1
  30. data/_sass/jekyll-theme-switch/_image-effects.scss +1 -1
  31. data/_sass/jekyll-theme-switch/_layout.scss +53 -12
  32. metadata +16 -16
  33. data/_plugins/blog_series_plugin.rb +0 -16
  34. data/_plugins/category_tag_filter.rb +0 -36
  35. data/_plugins/filesize_filter.rb +0 -13
  36. data/_plugins/normalize_whitespace_filter.rb +0 -10
  37. data/_plugins/songlink_tag_plugin.rb +0 -18
  38. data/_plugins/video_tag_plugin.rb +0 -62
  39. data/_plugins/vimeo_tag_plugin.rb +0 -23
  40. data/_plugins/yearly_archive_plugin.rb +0 -81
@@ -3,41 +3,7 @@ layout: wrapped
3
3
  ---
4
4
 
5
5
  <div class="tag-index">
6
- <h1 class="page-heading">{{ page.title | capitalize | replace: "Ij", "IJ" }}</h1>
6
+ <h1 class="page-heading">{{ site.data.i18n.tag }}: {{ page.title | capitalize | replace: "Ij", "IJ" }}</h1>
7
7
 
8
- <ul class="post-list">
9
- {% for post in page.posts %}
10
- {% if post.lead_image %}
11
- <style type="text/css" scoped>
12
- li#post-{{ post.id | slugify }} {
13
- background-image: linear-gradient(90deg, rgba(255,255,255,1) 50%, rgba(255,255,255,0.7) 80%),
14
- url('{{ post.lead_image | prepend: site.baseurl | prepend: site.url }}');
15
- background-size: cover;
16
- background-repeat: no-repeat;
17
- background-position-x: right;
18
- }
19
-
20
- @media (prefers-color-scheme: dark) {
21
- li#post-{{ post.id | slugify }} {
22
- background-image: linear-gradient(90deg, rgba(31,31,31,1) 50%, rgba(31,31,31,0.7) 80%),
23
- url('{{ post.lead_image | prepend: site.baseurl | prepend: site.url }}');
24
- }
25
- }
26
- </style>
27
- {% endif %}
28
- <li id="post-{{ post.id | slugify }}">
29
- <article>
30
- {% include post_meta.html post=post %}
31
-
32
- <h2>
33
- <a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
34
- </h2>
35
- <div>
36
- {{ post.excerpt }}
37
- </div>
38
- <a href="{{ post.url | prepend: site.baseurl }}">lees verder</a>
39
- </article>
40
- </li>
41
- {% endfor %}
42
- </ul>
8
+ {% include post_list.html posts=page.posts %}
43
9
  </div>
@@ -3,7 +3,8 @@ layout: wrapped
3
3
  ---
4
4
  <div class="yearly-archive">
5
5
  <div>
6
- <h1 class="title">Jaararchief voor <time datetime="{{ page.date | date: '%Y' }}">{{ page.date | date: "%Y" }}</time></h1>
6
+ {% capture year %}<time datetime="{{ page.date | date: '%Y' }}">{{ page.date | date: "%Y" }}</time>{% endcapture %}
7
+ <h1 class="title">{{ site.data.i18n.archives.yearly_header | params: year: year }}</h1>
7
8
  </div>
8
9
  <div>
9
10
  {% assign posts = page.posts | group_by_exp: "post", "post.date | date: '%-m'" %}
@@ -9,7 +9,6 @@ dl, dd, ol, ul, figure {
9
9
  }
10
10
 
11
11
 
12
-
13
12
  /**
14
13
  * Basic styling
15
14
  */
@@ -24,7 +23,6 @@ body {
24
23
  }
25
24
 
26
25
 
27
-
28
26
  /**
29
27
  * Set `margin-bottom` to maintain vertical rhythm
30
28
  */
@@ -32,11 +30,10 @@ h1, h2, h3, h4, h5, h6,
32
30
  p, blockquote, pre,
33
31
  ul, ol, dl, figure,
34
32
  %vertical-rhythm {
35
- margin-bottom: $spacing-unit / 2;
33
+ margin-bottom: calc($spacing-unit / 2);
36
34
  }
37
35
 
38
36
 
39
-
40
37
  /**
41
38
  * Images
42
39
  */
@@ -46,33 +43,65 @@ img {
46
43
  }
47
44
 
48
45
  article {
49
- img {
50
- float: left;
51
- margin-right: 1em;
52
- }
46
+ img, iframe {
47
+ border-radius: 4px;
48
+ @include BoxShadow(1);
49
+
50
+ &.center {
53
51
 
54
- p.center {
55
- clear: both;
56
- text-align: center;
52
+ }
53
+
54
+ &.width-75 {
55
+ max-width: 75%;
56
+ }
57
57
 
58
- img {
59
- float: none;
58
+ &.width-50 {
59
+ max-width: 50%;
60
+ }
60
61
  }
61
- }
62
62
 
63
- p.fill {
64
- text-align: center;
63
+ .embed-container {
64
+ position: relative;
65
+ padding-bottom: 56.25%;
66
+ margin-bottom: 1em;
67
+ height: 0;
68
+ overflow: hidden;
69
+ max-width: 100%;
70
+ clear: both;
71
+
72
+ iframe,
73
+ object,
74
+ embed {
75
+ position: absolute;
76
+ top: 0;
77
+ left: 0;
78
+ width: 100%;
79
+ height: 100%;
80
+ }
81
+ }
65
82
 
66
- img {
67
- float: none;
68
- width: 90%;
83
+ p.center {
84
+ clear: both;
85
+ text-align: center;
86
+
87
+ img {
88
+ float: none;
89
+ }
69
90
  }
70
- }
71
91
 
72
- p.small,
73
- div.footnotes {
74
- font-size: 0.75em;
75
- }
92
+ p.fill {
93
+ text-align: center;
94
+
95
+ img {
96
+ float: none;
97
+ width: 90%;
98
+ }
99
+ }
100
+
101
+ p.small,
102
+ div.footnotes {
103
+ font-size: 0.75em;
104
+ }
76
105
  }
77
106
 
78
107
  video {
@@ -93,7 +122,6 @@ figcaption {
93
122
  }
94
123
 
95
124
 
96
-
97
125
  /**
98
126
  * Lists
99
127
  */
@@ -104,12 +132,11 @@ ul, ol {
104
132
  li {
105
133
  > ul,
106
134
  > ol {
107
- margin-bottom: 0;
135
+ margin-bottom: 0;
108
136
  }
109
137
  }
110
138
 
111
139
 
112
-
113
140
  /**
114
141
  * Headings
115
142
  */
@@ -118,7 +145,6 @@ h1, h2, h3, h4, h5, h6 {
118
145
  }
119
146
 
120
147
 
121
-
122
148
  /**
123
149
  * Links
124
150
  */
@@ -126,7 +152,7 @@ a {
126
152
  color: $brand-color;
127
153
 
128
154
  &:visited {
129
- color: adjust-hue($brand-color, +120deg);
155
+ color: adjust-hue($brand-color, +120deg);
130
156
  }
131
157
 
132
158
  &:hover {
@@ -136,13 +162,12 @@ a {
136
162
  }
137
163
 
138
164
 
139
-
140
165
  /**
141
166
  * Blockquotes
142
167
  */
143
168
  blockquote {
144
- border-left: ($spacing-unit / 8) solid $grey-color;
145
- padding-left: $spacing-unit / 2;
169
+ border-left: calc($spacing-unit / 8) solid $grey-color;
170
+ padding-left: calc($spacing-unit / 2);
146
171
  font-style: italic;
147
172
 
148
173
  > :last-child {
@@ -151,7 +176,6 @@ blockquote {
151
176
  }
152
177
 
153
178
 
154
-
155
179
  /**
156
180
  * Code formatting
157
181
  */
@@ -179,13 +203,12 @@ pre {
179
203
  }
180
204
 
181
205
 
182
-
183
206
  /**
184
207
  * Wrapper
185
208
  */
186
209
  .wrapper {
187
210
  max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit} * 2));
188
- max-width: calc(#{$content-width} - (#{$spacing-unit} * 2));
211
+ max-width: calc(#{$content-width} - (#{$spacing-unit} * 2));
189
212
  margin-right: auto;
190
213
  margin-left: auto;
191
214
  padding-right: $spacing-unit;
@@ -194,14 +217,13 @@ pre {
194
217
 
195
218
  @include media-query($on-laptop) {
196
219
  max-width: -webkit-calc(#{$content-width} - (#{$spacing-unit}));
197
- max-width: calc(#{$content-width} - (#{$spacing-unit}));
198
- padding-right: $spacing-unit / 2;
199
- padding-left: $spacing-unit / 2;
220
+ max-width: calc(#{$content-width} - (#{$spacing-unit}));
221
+ padding-right: calc($spacing-unit / 2);
222
+ padding-left: calc($spacing-unit / 2);
200
223
  }
201
224
  }
202
225
 
203
226
 
204
-
205
227
  /**
206
228
  * Clearfix
207
229
  */
@@ -215,7 +237,6 @@ pre {
215
237
  }
216
238
 
217
239
 
218
-
219
240
  /**
220
241
  * Icons
221
242
  */
@@ -15,7 +15,6 @@
15
15
 
16
16
  body,
17
17
  .page-content,
18
- .post-content,
19
18
  {
20
19
  background-color: $background-color-dark;
21
20
  }
@@ -33,6 +32,11 @@
33
32
  background-color: lighten($background-color-dark, 5%);
34
33
  }
35
34
 
35
+ .category-index ul.post-list > li article a.read-more, .tag-index ul.post-list > li article a.read-more, .home ul.post-list > li article a.read-more {
36
+ background: lighten($background-color-dark, 5%);
37
+ box-shadow: 0 -12px 50px 50px lighten($background-color-dark, 5%);
38
+ }
39
+
36
40
  .post-content {
37
41
  td, th {
38
42
  border-bottom-color: $brand-color-dark;
@@ -2,7 +2,7 @@
2
2
  img.askew_left {
3
3
  transform: matrix3d(1, 0, 0, 0.0006, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
4
4
  border: red 2px solid;
5
- width: $content-width / 4;
5
+ width: calc($content-width / 4);
6
6
  }
7
7
 
8
8
  img.reflect,
@@ -82,6 +82,46 @@
82
82
  }
83
83
 
84
84
 
85
+ .category-index,
86
+ .tag-index,
87
+ .home {
88
+ padding: $spacing-unit;
89
+
90
+ ul.post-list {
91
+ display: flex;
92
+ flex-wrap: wrap;
93
+ flex-direction: row;
94
+ column-gap: $spacing-unit;
95
+ row-gap: $spacing-unit;
96
+
97
+ & > li {
98
+ flex-grow: 1;
99
+ //width: 300px;
100
+ height: 350px;
101
+ overflow: hidden;
102
+
103
+ article {
104
+ display: flex;
105
+ flex-direction: column;
106
+ justify-items: stretch;
107
+ height: 100%;
108
+
109
+ div.post-content {
110
+ flex-shrink: 1;
111
+ flex-grow: 1;
112
+ overflow: hidden;
113
+ }
114
+
115
+ a.read-more {
116
+ background: $background-color;
117
+ box-shadow: 0 -12px 50px 50px $background-color;
118
+ padding-top: 8px;
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+
85
125
 
86
126
  /**
87
127
  * Site footer
@@ -93,7 +133,7 @@
93
133
 
94
134
  .footer-heading {
95
135
  font-size: 18px;
96
- margin-bottom: $spacing-unit / 2;
136
+ margin-bottom: calc($spacing-unit / 2);
97
137
  }
98
138
 
99
139
  .contact-list,
@@ -109,14 +149,14 @@
109
149
  .footer-col-wrapper {
110
150
  font-size: 15px;
111
151
  color: $grey-color;
112
- margin-left: -$spacing-unit / 2;
152
+ margin-left: calc(-1 * $spacing-unit / 2);
113
153
  @extend %clearfix;
114
154
  }
115
155
 
116
156
  .footer-col {
117
157
  float: left;
118
- margin-bottom: $spacing-unit / 2;
119
- padding-left: $spacing-unit / 2;
158
+ margin-bottom: calc($spacing-unit / 2);
159
+ padding-left: calc($spacing-unit / 2);
120
160
  }
121
161
 
122
162
  .footer-col-1 {
@@ -125,13 +165,13 @@
125
165
  }
126
166
 
127
167
  .footer-col-2 {
128
- width: -webkit-calc(25% - (#{$spacing-unit} / 2));
129
- width: calc(25% - (#{$spacing-unit} / 2));
168
+ width: -webkit-calc(30% - (#{$spacing-unit} / 2));
169
+ width: calc(30% - (#{$spacing-unit} / 2));
130
170
  }
131
171
 
132
172
  .footer-col-3 {
133
- width: -webkit-calc(45% - (#{$spacing-unit} / 2));
134
- width: calc(45% - (#{$spacing-unit} / 2));
173
+ width: -webkit-calc(40% - (#{$spacing-unit} / 2));
174
+ width: calc(40% - (#{$spacing-unit} / 2));
135
175
  }
136
176
 
137
177
  @include media-query($on-laptop) {
@@ -176,7 +216,6 @@
176
216
  > li {
177
217
  background-color: white;
178
218
  padding: $spacing-unit;
179
- margin: $spacing-unit 0;
180
219
  border-radius: 4px;
181
220
  @include BoxShadow(1);
182
221
 
@@ -248,6 +287,8 @@
248
287
  }
249
288
 
250
289
  .post-content {
290
+ h1, h2, h3, h4 { clear: both; }
291
+
251
292
  h2 {
252
293
  font-size: 32px;
253
294
 
@@ -294,7 +335,7 @@
294
335
 
295
336
  th, td {
296
337
  text-align: left;
297
- padding: $spacing-unit / 2;
338
+ padding: calc($spacing-unit / 2);
298
339
  border-bottom: thin solid $brand-color;
299
340
  }
300
341
 
@@ -386,8 +427,8 @@ a.button:hover,
386
427
  .align-right { text-align: right; }
387
428
  .align-left { text-align: left; }
388
429
 
389
- .left { float: left; }
390
- .right { float: right; }
430
+ .left { float: left; margin-right: 1em }
431
+ .right { float: right; margin-left: 1em; }
391
432
 
392
433
  div.post.candid-strategies-md
393
434
  article
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-switch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Luijten
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2024-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -122,7 +122,7 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 1.4.0
125
- description:
125
+ description:
126
126
  email:
127
127
  - christian@luijten.org
128
128
  executables: []
@@ -131,15 +131,23 @@ extra_rdoc_files: []
131
131
  files:
132
132
  - LICENSE.txt
133
133
  - README.md
134
+ - _data/i18n.yaml
134
135
  - _includes/date.html
135
136
  - _includes/disqus.html
136
137
  - _includes/footer.html
138
+ - _includes/footer_text.html
137
139
  - _includes/head.html
138
140
  - _includes/header.html
139
141
  - _includes/holidays_contents.html
140
142
  - _includes/holidays_ul.html
141
143
  - _includes/month.html
144
+ - _includes/page_title.html
145
+ - _includes/paginator_nav.html
146
+ - _includes/post_item.html
147
+ - _includes/post_list.html
142
148
  - _includes/post_meta.html
149
+ - _includes/post_nav.html
150
+ - _includes/rss/channel.html
143
151
  - _includes/rss/post.html
144
152
  - _includes/section_nav.html
145
153
  - _includes/vimeo.html
@@ -158,14 +166,6 @@ files:
158
166
  - _layouts/tag_page.html
159
167
  - _layouts/wrapped.html
160
168
  - _layouts/yearly_archive.html
161
- - _plugins/blog_series_plugin.rb
162
- - _plugins/category_tag_filter.rb
163
- - _plugins/filesize_filter.rb
164
- - _plugins/normalize_whitespace_filter.rb
165
- - _plugins/songlink_tag_plugin.rb
166
- - _plugins/video_tag_plugin.rb
167
- - _plugins/vimeo_tag_plugin.rb
168
- - _plugins/yearly_archive_plugin.rb
169
169
  - _sass/jekyll-theme-switch/_base.scss
170
170
  - _sass/jekyll-theme-switch/_dark.scss
171
171
  - _sass/jekyll-theme-switch/_image-effects.scss
@@ -177,11 +177,11 @@ files:
177
177
  - assets/image/fabian-betto-d3npqyXkaGI-unsplash.jpg
178
178
  - assets/image/jonatan-pie-g6tqHx0ME1o-unsplash.jpg
179
179
  - assets/image/marek-piwnicki-NPct-Mxw-64-unsplash.jpg
180
- homepage: https://luijten.org/
180
+ homepage: https://islandsvinur.gitlab.io/jekyll-theme-switch/
181
181
  licenses:
182
182
  - MIT
183
183
  metadata: {}
184
- post_install_message:
184
+ post_install_message:
185
185
  rdoc_options: []
186
186
  require_paths:
187
187
  - lib
@@ -196,8 +196,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
196
  - !ruby/object:Gem::Version
197
197
  version: '0'
198
198
  requirements: []
199
- rubygems_version: 3.0.3.1
200
- signing_key:
199
+ rubygems_version: 3.3.26
200
+ signing_key:
201
201
  specification_version: 4
202
202
  summary: The theme for Logging the Switch.
203
203
  test_files: []
@@ -1,16 +0,0 @@
1
-
2
-
3
- Jekyll::Hooks.register :site, :pre_render do |site|
4
-
5
- seriesIndexes = site.posts.docs
6
- .select { |p| p.data.key? 'series_slug' }
7
- .reduce(Hash.new {|h,k| h[k] = []} ) { |series, post| series[post.data['series_slug']] << post; series }
8
-
9
- seriesPosts = site.posts.docs
10
- .select { |p| p.data.key? 'series' }
11
- .reduce(Hash.new {|h,k| h[k] = []}) { |series, post| series[post.data['series']] << post; series }
12
-
13
- seriesIndexes.each { |slug, posts| posts.each {|post| post.data['series_posts'] = seriesPosts[slug] }}
14
- seriesPosts.each { |slug, posts| posts.each {|post| post.data['series_index'] = seriesIndexes[slug] }}
15
- end
16
-
@@ -1,36 +0,0 @@
1
-
2
- module Jekyll
3
- module CategoryTagFilter
4
- def taglinks(input)
5
- site = @context.registers[:site]
6
- input.map do |tag|
7
- "<a href=\"#{site.baseurl}/#{site.config['tag_dir']}/#{tag}\">#{tag}</a>"
8
- end
9
- end
10
-
11
- def categorylinks(input)
12
- site = @context.registers[:site]
13
- input.map do |cat|
14
- "<a href=\"#{site.baseurl}/#{site.config['category_dir']}/#{cat}\">#{cat}</a>"
15
- end
16
- end
17
- end
18
-
19
- class CategoryLinkTag < Liquid::Tag
20
- def initialize(tag_name, text, tokens)
21
- super
22
- @text = text
23
- end
24
-
25
- def render(context)
26
- @context = context
27
- site = context.registers[:site]
28
- dir = site.config['category_dir'] || 'categories'
29
-
30
- "/#{dir}/#{@text}"
31
- end
32
- end
33
- end
34
-
35
- Liquid::Template.register_tag('category_link', Jekyll::CategoryLinkTag)
36
- Liquid::Template.register_filter(Jekyll::CategoryTagFilter)
@@ -1,13 +0,0 @@
1
-
2
- module Jekyll
3
- module FilesizeFilter
4
- def filesize(input)
5
- site = @context.registers[:site]
6
- file = site.static_files.find {|f| f.path.end_with?(input) }
7
-
8
- File.size(file.path)
9
- end
10
- end
11
- end
12
-
13
- Liquid::Template.register_filter(Jekyll::FilesizeFilter)
@@ -1,10 +0,0 @@
1
-
2
- module Jekyll
3
- module NormalizeWhitespaceFilter
4
- def normalize_whitespace(input)
5
- input.gsub(/\s+/, ' ')
6
- end
7
- end
8
- end
9
-
10
- Liquid::Template.register_filter(Jekyll::NormalizeWhitespaceFilter)
@@ -1,18 +0,0 @@
1
-
2
- module Jekyll
3
- class SonglinkTag < Liquid::Tag
4
- @songlink = ''
5
-
6
- def initialize(tag_name, markup, tokens)
7
- @songlink = markup.split(' ').first
8
- end
9
-
10
- def render(context)
11
- output = super
12
- url = "https://embed.song.link/?url=#{@songlink}&theme=light"
13
- songlink = "<iframe width='100%' height='414' src='#{url}' frameborder='0' allowfullscreen sandbox='allow-same-origin allow-scripts allow-presentation allow-popups allow-popups-to-escape-sandbox'></iframe>"
14
- end
15
- end
16
- end
17
-
18
- Liquid::Template.register_tag('songlink', Jekyll::SonglinkTag)
@@ -1,62 +0,0 @@
1
- # Title: Simple Video tag for Jekyll
2
- # Author: Brandon Mathis http://brandonmathis.com
3
- # Description: Easily output MPEG4 HTML5 video with a flash backup.
4
- #
5
- # Syntax {% video url/to/video [width height] [url/to/poster] %}
6
- #
7
- # Example:
8
- # {% video http://site.com/video.mp4 720 480 http://site.com/poster-frame.jpg %}
9
- #
10
- # Output:
11
- # <video width='720' height='480' preload='none' controls poster='http://site.com/poster-frame.jpg'>
12
- # <source src='http://site.com/video.mp4' type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'/>
13
- # </video>
14
- #
15
-
16
- module Jekyll
17
-
18
- class VideoTag < Liquid::Tag
19
- @video = nil
20
- @poster = ''
21
- @height = ''
22
- @width = ''
23
-
24
- def initialize(tag_name, markup, tokens)
25
- @videos = markup.scan(/((https?:\/\/|\/)\S+\.(webm|ogv|mp4)\S*)/i).map(&:first).compact
26
- @poster = markup.scan(/((https?:\/\/|\/)\S+\.(png|gif|jpe?g)\S*)/i).map(&:first).compact.first
27
- @sizes = markup.scan(/\s(\d\S+)/i).map(&:first).compact
28
- super
29
- end
30
-
31
- def render(context)
32
- output = super
33
- types = {
34
- '.mp4' => "type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'",
35
- '.ogv' => "type='video/ogg; codecs=theora, vorbis'",
36
- '.webm' => "type='video/webm; codecs=vp8, vorbis'"
37
- }
38
- if @videos.size > 0
39
- video = "<video #{sizes} preload='metadata' controls #{poster}>"
40
- @videos.each do |v|
41
- video << "<source src='#{v}' #{types[File.extname(v)]}>"
42
- end
43
- video += "</video>"
44
- else
45
- "Error processing input, expected syntax: {% video url/to/video [url/to/video] [url/to/video] [width height] [url/to/poster] %}"
46
- end
47
- end
48
-
49
- def poster
50
- "poster='#{@poster}'" if @poster
51
- end
52
-
53
- def sizes
54
- attrs = "width='#{@sizes[0]}'" if @sizes[0]
55
- attrs += " height='#{@sizes[1]}'" if @sizes[1]
56
- attrs
57
- end
58
- end
59
- end
60
-
61
- Liquid::Template.register_tag('video', Jekyll::VideoTag)
62
-