jekyll-scouts_uk_2018 1.2.0 → 1.3.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: 64b07c319929cbe6d60418c4d67471784d9508ffcaf68320dd6decca431d1b60
4
- data.tar.gz: 34c0d36fa0520f66e02c4c9d206c67e7ff58db48175582776757ff0ee0135874
3
+ metadata.gz: 6f13a6c70ea2fe5c4718d566517fbf10b37704f03e0be93205b2170bb39c7bba
4
+ data.tar.gz: fed326a637a25ae28e3b8a1d3853b8d5d27e30de066c8fba6b0914b37520ae1a
5
5
  SHA512:
6
- metadata.gz: bce68c6958f7ee0f54af84eaad97e0aa6ee07e36fd1aeb68e321b89b201b04ce46df6064cfccd052bb15b3c54384a50e3d986c6a38df2afb3e8cc81741741c50
7
- data.tar.gz: 4cf935fb9c923eb2390e721ff8c0fa136422e8c45dd70ef8d27e13f7339577e896b15a32afaa5cf6325210209c7b194b2cabf850e892b8c76360b53d34d9f6d2
6
+ metadata.gz: 94e6db136730c4a9b89b2a1c1617997988d91f139f224b491dd85199e0dfc8c1ba9a895e5f1cbeabcc37ce92f415cc420f39edb35a0b7ddbafdbdeeccf1cfe5c
7
+ data.tar.gz: 30c772f509b4eb8d950c0d3f8a658fc7f10f7e4145f07e2cbe4e93c8457eb64731a000e5a6f79291abcf6b005b7e68db67c99bf3b0b5a94b14353c4338e7be7b
data/README.md CHANGED
@@ -8,7 +8,7 @@ A [Jekyll](https://jekyllrb.com/) template for the UK Scouts brand (2018). You c
8
8
  Add this line to your Jekyll site's Gemfile:
9
9
 
10
10
  ```ruby
11
- gem 'jekyll-scouts_uk_2018', '~> 1.1'
11
+ gem 'jekyll-scouts_uk_2018', '~> 1.3', group: 'jekyll_plugins'
12
12
  ```
13
13
 
14
14
  And add this line to your Jekyll site's _config.yml:
@@ -96,6 +96,34 @@ Then create your files in the _sections directory. A number of front matter sett
96
96
 
97
97
  ### Other things you get
98
98
 
99
+ #### Included Tags
100
+
101
+ The gem **MUST** be in the jekyll_plugins group to use the included tags.
102
+
103
+ ##### youth_approved
104
+
105
+ ```
106
+ {% youth_approved %}
107
+ ```
108
+ Will render an image of [Scout Scotland's Youth Approved](https://www.scouts.scot/members/youth-involvement/youth-approved-award/) seal, with the level chosen by:
109
+
110
+ * The value of the youth_approved.level front matter
111
+ * The generic Youth Approved logo
112
+
113
+ If the frontmatter youth_approved.expires is present and in the past then nothing will be rendered.
114
+
115
+ ```
116
+ {% youth_approved <level> %}
117
+ ```
118
+ Will render an image of Scout Scotland's Youth Approved seal at the passed level.
119
+
120
+ ```
121
+ {% youth_approved <level> <expires> %}
122
+ ```
123
+ Will render an image of Scout Scotland's Youth Approved seal at the passed level if the passed expires (format YYYY-MM-DD) has not passed.
124
+
125
+ In all cases the img has a class of youth-approved-seal and is enclosed by a link to the scheme on Scouts Scotland's website.
126
+
99
127
  #### Ability to display twitter content (provided by [jekyll-twitter-plugin](https://github.com/rob-murray/jekyll-twitter-plugin))
100
128
 
101
129
  If a section has a social_links.twitter value and the screen is wide enough then their last five tweets will be displayed at the side of the page.
@@ -108,4 +136,4 @@ If a section has a social_links.twitter value and the screen is wide enough then
108
136
  * FleurDeLis
109
137
  * [Tabler icons](https://tablericons.com/): assets/images/tabler-icons-sprite.svg
110
138
  * Scouts Scotland's Youth Approved seals: assets/images
111
- * Nunito Sans font: assets/fonts/NunitoSans
139
+ * Nunito Sans font: assets/fonts/NunitoSans
@@ -18,25 +18,13 @@ main_class: section
18
18
  <div id="content-footer">
19
19
  {%- assign social_links = page.social_links -%}
20
20
  {%- include social-links.html -%}
21
-
22
- {%- if page.youth_approved -%}
23
- {%- assign today = 'now' | date: '%Y-%m-%d' -%}
24
- {%- assign expires = page.youth_approved.expires | date: '%Y-%m-%d' -%}
25
- {%- if expires >= today -%}
26
- <a href="https://www.scouts.scot/members/youth-involvement/youth-approved-award/" rel="nofollow noopener" target="_blank">
27
- {%- assign logo = page.youth_approved.level | capitalize -%}
28
- {%- assign logo = "assets/images/YouthApproved" | append: logo | relative_url -%}
29
- {%- assign alt = "We've got the " | append: page.youth_approved.level | append: " Youth Approved award from Scouts Scotland." -%}
30
- <img class="youth-approved-seal" src="{{ logo }}.png" srcset="{{ logo }}-100.png 100w, {{ logo }}-320.png 320w, {{ logo }}-480.png 480w, {{ logo }}-640.png 640w" alt="{{ alt }}">
31
- </a>
32
- {%- endif -%}
33
- {%- endif -%}
21
+ {%- if page.youth_approved -%}{% youth_approved %}{%- endif -%}
34
22
  </div>
35
23
  </div>
36
24
 
37
25
  {%- if page.social_links.twitter -%}
38
26
  <div id="tweets">
39
27
  {% assign twitter_url = 'https://twitter.com/' | append: page.social_links.twitter %}
40
- {% twitternocache twitter_url limit=3 %}
28
+ {% twitter twitter_url limit=3 %}
41
29
  </div>
42
30
  {%- endif -%}
data/assets/css/main.scss CHANGED
@@ -154,6 +154,10 @@ ul.social-links {
154
154
  }
155
155
  }
156
156
 
157
+ .youth-approved-seal {
158
+ max-width: 20rem;
159
+ }
160
+
157
161
 
158
162
  @import "header";
159
163
 
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module ScoutsUk2018
5
+ class Tag < Liquid::Tag
6
+ def initialize(_tag_name, markup, _parse_context)
7
+ super
8
+
9
+ @level, @expires = markup.strip.split(/\s+/, 2)
10
+ end
11
+
12
+ def render(context)
13
+ expires = @expires || context.registers[:page]['youth_approved']&.[]('expires')
14
+ return if expires && expires.to_s < Date.today.to_s
15
+ level = @level || context.registers[:page]['youth_approved']&.[]('level')
16
+
17
+ logo = "#{context.registers[:site].config.fetch('baseurl', '').to_s.chomp('/')}/assets/images/YouthApproved#{level&.capitalize}"
18
+ alt = if level
19
+ "We've got the #{level.capitalize} Youth Approved award from Scouts Scotland."
20
+ else
21
+ "Scouts Scotland's Youth Approved award."
22
+ end
23
+
24
+ html = <<~__HTML__
25
+ <a href="https://www.scouts.scot/members/youth-involvement/youth-approved-award/" rel="nofollow noopener" target="_blank">
26
+ <img
27
+ class="youth-approved-seal"
28
+ src="#{logo}.png"
29
+ srcset="#{logo}-100.png 100w,
30
+ #{logo}-320.png 320w,
31
+ #{logo}-480.png 480w,
32
+ #{logo}-640.png 640w"
33
+ alt="#{alt}"
34
+ >
35
+ </a>
36
+ __HTML__
37
+ html.gsub(/\s+\>/, '>').gsub(/\s+\</, '<').gsub(/\s+/, ' ')
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'jekyll-scouts_uk_2018/tag'
4
+
5
+ module Jekyll
6
+ module ScoutsUk2018
7
+ end
8
+ end
9
+
10
+
11
+ Liquid::Template.register_tag('youth_approved', Jekyll::ScoutsUk2018::Tag)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-scouts_uk_2018
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gauld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-28 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -61,7 +61,6 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - LICENSE.txt
63
63
  - README.md
64
- - _config.yml
65
64
  - _includes/footer.html
66
65
  - _includes/head.html
67
66
  - _includes/header-logo.html
@@ -302,6 +301,8 @@ files:
302
301
  - assets/images/logos/SquirrelsSymbolYellow-100.png
303
302
  - assets/images/logos/SquirrelsSymbolYellow.png
304
303
  - assets/images/tabler-icons-sprite.svg
304
+ - lib/jekyll-scouts_uk_2018.rb
305
+ - lib/jekyll-scouts_uk_2018/tag.rb
305
306
  homepage: https://github.com/27thAberdeenScoutGroup/jekyll-scouts_uk_2018
306
307
  licenses:
307
308
  - BSD-3-Clause
data/_config.yml DELETED
File without changes