creek-jekyll-theme 1.7.4 → 1.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a338aef1b12d27f26bdf0ccc334aa6ebeeced4daf1074c8ffecd87c84a84562
4
- data.tar.gz: 942de0d235a2742ac014e1227b5c1d4e6a9ebbfe29cf04aa16922228b17045f6
3
+ metadata.gz: 4b118a4111e51a90bfa302e32857c701d8a9ace6c278f1faeef5781ade636b1c
4
+ data.tar.gz: b6c9c48a8bce657660aa0f502ab85e88fe0997fb9d71c4be28cc4017e31ea99a
5
5
  SHA512:
6
- metadata.gz: 809c58209543e9f263fbae5f699348640698bf86a8ac924f7e01ce5aea88b3fecbdda848d2220233a1f2e6280ff557446f94b33bc7679445e65ea74a5830a556
7
- data.tar.gz: b328a16afe5e609e4570ef2b57a045d6b4a85465a4b6b4f336dbc05382e8654b7a844012309d19bd007d2e4541652c8e007fd7deefa4d610749e7ef2f32db2ca
6
+ metadata.gz: 41af36e2771e94e630304b2bce7148eb7996e9f71d6a9fd205fdf866983da9ef5173898b84ba74a0a302feae09c6d79702b594eda6c8a277467495e6f78aa231
7
+ data.tar.gz: 523e31b1201cd7e546ad6a48b0c5c3274abf5dd0b129f957f3b7c87c8db977623655f6a17d393c4e5a60bc47b9ab6e40b8e7671ea99bf63e8759a0afaa155f22
data/README.md ADDED
@@ -0,0 +1,147 @@
1
+ # creek-jekyll-theme
2
+
3
+ The Jekyll theme used by the [Creek site](https://www.creekservice.org).
4
+
5
+ ## Installation
6
+
7
+ Add this line to your Jekyll site's `Gemfile`:
8
+
9
+ ```ruby
10
+ gem "creek-jekyll-theme"
11
+ ```
12
+
13
+ And add this line to your Jekyll site's `_config.yml`:
14
+
15
+ ```yaml
16
+ theme: creek-jekyll-theme
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ ```shell
22
+ $ bundle
23
+ ```
24
+
25
+ Or install it yourself as:
26
+
27
+ ```shell
28
+ $ gem install creek-jekyll-theme
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ The theme is a fork of [minimal-mistakes](https://github.com/mmistakes/minimal-mistakes), with a load of shared
34
+ defaults, images, data, and customisations.
35
+
36
+ ### `include_snippet` Liquid tag
37
+
38
+ The gem also bundles an `include_snippet` Liquid tag, which includes a named snippet of text from another file
39
+ into a page or post - handy for keeping code samples in docs in sync with the actual source. It's a drop-in
40
+ replacement for the [`jekyll-include_snippet`](https://github.com/tomdalling/jekyll-include_snippet) gem, with
41
+ one behavioural fix: an explicit `from <path>` on a tag now always takes precedence over a page's
42
+ `snippet_source` front matter default, rather than being silently overridden by it.
43
+
44
+ To use it, add this gem to the `jekyll_plugins` group in your `Gemfile` instead of (or as well as, if you're
45
+ also using the theme) adding it as a plain gem, so Jekyll requires it as a plugin:
46
+
47
+ ```ruby
48
+ group :jekyll_plugins do
49
+ gem "creek-jekyll-theme"
50
+ end
51
+ ```
52
+
53
+ If you were previously using the `jekyll-include_snippet` gem directly, remove it - `include_snippet` tags in
54
+ your markdown work unchanged, no content needs to change.
55
+
56
+ Usage is otherwise the same as the gem it replaces. Put `begin-snippet`/`end-snippet` comments around the code
57
+ you want to include:
58
+
59
+ ```ruby
60
+ # begin-snippet: my_snippet
61
+ def my_method
62
+ ...
63
+ end
64
+ # end-snippet
65
+ ```
66
+
67
+ Then include it from a page or post:
68
+
69
+ ```liquid
70
+ {% include_snippet my_snippet from path/to/file.rb %}
71
+ ```
72
+
73
+ Or set a default source file in front matter, and override it per-tag when needed:
74
+
75
+ ```yaml
76
+ ---
77
+ snippet_source: "path/to/file.rb"
78
+ snippet_comment_prefix: "//" # defaults to "#"
79
+ ---
80
+ ```
81
+
82
+ See the source of [`lib/creek-jekyll-theme/include_snippet.rb`](lib/creek-jekyll-theme/include_snippet.rb) for
83
+ full documentation.
84
+
85
+ ## Contributing
86
+
87
+ Bug reports and pull requests are welcome on GitHub at https://github.com/creek-service/creek-jekyll-theme.
88
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere
89
+ to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
90
+
91
+ ## Development
92
+
93
+ To set up your environment to develop this theme, run `bundle install`.
94
+
95
+ This theme is set up just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open
96
+ your browser at `http://localhost:4000`. This starts a Jekyll server using this theme. Add pages, documents, data, etc.
97
+ like normal to test the theme's contents. As you make modifications to the theme and to your content,
98
+ the site will regenerate, and you should see the changes in the browser after a refresh, just like normal.
99
+
100
+ When the theme is released, only the files in `_data`, `_layouts`, `_includes`, `_sass`, `assets` and `lib` tracked with Git will be bundled.
101
+ To add a custom directory to the theme-gem, please edit the regexp in `creek-jekyll-theme.gemspec` accordingly.
102
+
103
+ ## License
104
+
105
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
106
+
107
+ ## Building locally
108
+
109
+ To build and install locally from source, follow these steps:
110
+
111
+ 1. Update version number in the [gemspec](creek-jekyll-theme.gemspec).
112
+ 2. Run:
113
+ ```shell
114
+ rm creek-jekyll-theme-*.gem
115
+ gem build creek-jekyll-theme.gemspec
116
+ gem install creek-jekyll-theme-*.gem
117
+ ```
118
+
119
+ ## Releasing
120
+
121
+ Releases will automatically be built and pushed to [Ruby Gems](https://rubygems.org/gems/creek-jekyll-theme) when
122
+ a release tag is pushed to git.
123
+ Currently, the process of updating the gemspec version and pushing a matching git tag is a manual process:
124
+
125
+ 1. Update version number in the [gemspec](creek-jekyll-theme.gemspec).
126
+ 2. Run the following to pick up the new version:
127
+ ```shell
128
+ bundle update
129
+ ```
130
+ 3. Commit & push
131
+ ```shell
132
+ git add -A
133
+ git commit -m "Bump release version"
134
+ git push
135
+ ```
136
+ 4. Push a new git tag, matching the new version in the gemspec:
137
+ ```shell
138
+ GEM_VERSION=$(sed -nr 's/.*spec\.version[^"]*"([1-9.]+)"/\1/p' creek-jekyll-theme.gemspec)
139
+ git tag v$GEM_VERSION
140
+ git push --tag
141
+ ```
142
+
143
+ ### Dropping a release
144
+
145
+ ```shell
146
+ gem yank creek-jekyll-theme -v VERSION_TO_DROP
147
+ ```
data/_includes/seo.html CHANGED
@@ -7,7 +7,7 @@
7
7
  {% assign title_separator = site.title_separator | default: '-' | replace: '|', '&#124;' %}
8
8
 
9
9
  {%- if page.title -%}
10
- {%- assign seo_title = page.title | append: " " | append: title_separator | append: " " | append: site.title -%}
10
+ {%- assign seo_title = page.title | append: " " | append: title_separator | append: " " | append: site.title | truncate: 70 -%}
11
11
  {%- endif -%}
12
12
 
13
13
  {%- if seo_title -%}
@@ -0,0 +1,185 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Liquid tag that includes a named snippet of text from another file into a page or post.
4
+ #
5
+ # Bundled with this theme so Creek's docs sites don't need to depend on the separate
6
+ # `jekyll-include_snippet` gem, and so a bug in that gem's precedence rules can be fixed here
7
+ # without waiting on an upstream release.
8
+ #
9
+ # Ported from https://github.com/tomdalling/jekyll-include_snippet (MIT licensed,
10
+ # Copyright (c) Tom Dalling), with one behavioural fix: an explicit `from <path>` on the tag
11
+ # itself now takes precedence over a page's `snippet_source` front matter default. Previously,
12
+ # setting `snippet_source` in front matter silently overrode every `from <path>` on that page,
13
+ # no matter what path was given, which broke pages that need to pull named snippets from more
14
+ # than one source file.
15
+ #
16
+ # Usage:
17
+ #
18
+ # Put `begin-snippet`/`end-snippet` comments around the code you want to include:
19
+ #
20
+ # # begin-snippet: my_snippet
21
+ # def my_method
22
+ # ...
23
+ # end
24
+ # # end-snippet
25
+ #
26
+ # Then include it from a page or post:
27
+ #
28
+ # {% include_snippet my_snippet from path/to/file.rb %}
29
+ #
30
+ # If every `include_snippet` tag on a page reads from the same file, set a default in the
31
+ # page's front matter instead of repeating `from <path>` on every tag:
32
+ #
33
+ # ---
34
+ # snippet_source: "path/to/file.rb"
35
+ # ---
36
+ # {% include_snippet my_snippet %}
37
+ #
38
+ # An explicit `from <path>` always overrides the front matter default for that one tag, so
39
+ # the two forms can be mixed freely on the same page.
40
+ #
41
+ # For non-Ruby source, set the comment prefix used to find the begin/end markers, either
42
+ # per-page via front matter:
43
+ #
44
+ # ---
45
+ # snippet_comment_prefix: "//"
46
+ # ---
47
+ #
48
+ # The default comment prefix is `#`.
49
+ module CreekJekyllTheme
50
+ module IncludeSnippet
51
+ DEFAULT_COMMENT_PREFIX = "#"
52
+
53
+ class LiquidTag < Liquid::Tag
54
+ def initialize(tag_name, arg_str, tokens)
55
+ super
56
+ @snippet_name, @source_path = arg_str.split(/\sfrom\s/).map(&:strip)
57
+ end
58
+
59
+ def render(context)
60
+ source_path = source_path_for(context)
61
+ source = File.read(source_path)
62
+ extractor = Extractor.new(comment_prefix: comment_prefix_for(context))
63
+ snippets = extractor.(source)
64
+ snippets.fetch(@snippet_name) do
65
+ raise "Snippet not found: #{@snippet_name.inspect}\n in file: #{source_path}"
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+ # An explicit `from <path>` on the tag always wins. Only fall back to the page's
72
+ # `snippet_source` front matter default when the tag doesn't specify its own path.
73
+ def source_path_for(context)
74
+ result = @source_path || get_option(:snippet_source, context)
75
+
76
+ raise "No source path provided for snippet: #{@snippet_name}" if result.nil?
77
+
78
+ result
79
+ end
80
+
81
+ def comment_prefix_for(context)
82
+ get_option(:snippet_comment_prefix, context) || DEFAULT_COMMENT_PREFIX
83
+ end
84
+
85
+ def get_option(option_name, context)
86
+ page = context["page"]
87
+ page && page[option_name.to_s]
88
+ end
89
+ end
90
+
91
+ class Extractor
92
+ attr_reader :comment_prefix
93
+
94
+ def initialize(comment_prefix:)
95
+ @comment_prefix = comment_prefix
96
+ end
97
+
98
+ def call(source)
99
+ everything = Snippet.new(name: "everything", indent: 0)
100
+ all_snippets = []
101
+ active_snippets = []
102
+
103
+ source.each_line.each_with_index do |line, lineno|
104
+ case line
105
+ when begin_regex
106
+ active_snippets << Snippet.new(name: $2.strip, indent: $1.length)
107
+ when end_regex
108
+ raise missing_begin_snippet(lineno) if active_snippets.empty?
109
+
110
+ all_snippets << active_snippets.pop
111
+ else
112
+ (active_snippets + [everything]).each do |snippet|
113
+ snippet.lines << line
114
+ end
115
+ end
116
+ end
117
+
118
+ (all_snippets + [everything])
119
+ .map { |s| [s.name, s.dedented_text] }
120
+ .to_h
121
+ end
122
+
123
+ private
124
+
125
+ def begin_regex
126
+ %r{
127
+ (\s*) # optional whitespace (indenting)
128
+ #{Regexp.quote(comment_prefix)} # the comment prefix
129
+ \s* # optional whitespace
130
+ begin-snippet: # magic string for beginning a snippet
131
+ (.+) # the remainder of the line is the snippet name
132
+ }x
133
+ end
134
+
135
+ def end_regex
136
+ %r{
137
+ \s* # optional whitespace (indenting)
138
+ #{Regexp.quote(comment_prefix)} # the comment prefix
139
+ \s* # optional whitespace
140
+ end-snippet # Magic string for ending a snippet
141
+ }x
142
+ end
143
+
144
+ def missing_begin_snippet(lineno)
145
+ <<~END_ERROR
146
+ There was an `end-snippet` on line #{lineno}, but there doesn't
147
+ appear to be any matching `begin-snippet` line.
148
+
149
+ Make sure you have the correct `begin-snippet` comment --
150
+ something like this:
151
+
152
+ # begin-snippet: MyRadCode
153
+
154
+ END_ERROR
155
+ end
156
+
157
+ class Snippet
158
+ attr_reader :name, :indent, :lines
159
+
160
+ def initialize(name:, indent:)
161
+ @name = name
162
+ @indent = indent
163
+ @lines = []
164
+ end
165
+
166
+ def dedented_text
167
+ lines
168
+ .map { |line| dedent(line) }
169
+ .join
170
+ .rstrip
171
+ end
172
+
173
+ def dedent(line)
174
+ if line.length >= indent
175
+ line[indent..-1]
176
+ else
177
+ line
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
184
+
185
+ Liquid::Template.register_tag("include_snippet", CreekJekyllTheme::IncludeSnippet::LiquidTag)
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "creek-jekyll-theme/include_snippet"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: creek-jekyll-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Creek Service - Big Andy Coates
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-22 00:00:00.000000000 Z
11
+ date: 2026-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: liquid
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: jekyll-paginate
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -104,16 +118,22 @@ dependencies:
104
118
  name: jekyll-sass-converter
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
- - - "~>"
121
+ - - ">="
108
122
  - !ruby/object:Gem::Version
109
123
  version: '2.2'
124
+ - - "<"
125
+ - !ruby/object:Gem::Version
126
+ version: '4.0'
110
127
  type: :runtime
111
128
  prerelease: false
112
129
  version_requirements: !ruby/object:Gem::Requirement
113
130
  requirements:
114
- - - "~>"
131
+ - - ">="
115
132
  - !ruby/object:Gem::Version
116
133
  version: '2.2'
134
+ - - "<"
135
+ - !ruby/object:Gem::Version
136
+ version: '4.0'
117
137
  - !ruby/object:Gem::Dependency
118
138
  name: jekyll-algolia
119
139
  requirement: !ruby/object:Gem::Requirement
@@ -132,16 +152,22 @@ dependencies:
132
152
  name: jemoji
133
153
  requirement: !ruby/object:Gem::Requirement
134
154
  requirements:
135
- - - "~>"
155
+ - - ">="
136
156
  - !ruby/object:Gem::Version
137
- version: 0.12.0
157
+ version: '0.12'
158
+ - - "<"
159
+ - !ruby/object:Gem::Version
160
+ version: '0.14'
138
161
  type: :runtime
139
162
  prerelease: false
140
163
  version_requirements: !ruby/object:Gem::Requirement
141
164
  requirements:
142
- - - "~>"
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0.12'
168
+ - - "<"
143
169
  - !ruby/object:Gem::Version
144
- version: 0.12.0
170
+ version: '0.14'
145
171
  - !ruby/object:Gem::Dependency
146
172
  name: jekyll-last-modified-at
147
173
  requirement: !ruby/object:Gem::Requirement
@@ -184,7 +210,7 @@ dependencies:
184
210
  - - ">="
185
211
  - !ruby/object:Gem::Version
186
212
  version: 12.3.3
187
- description:
213
+ description:
188
214
  email:
189
215
  - 8012398+big-andy-coates@users.noreply.github.com
190
216
  executables: []
@@ -192,6 +218,7 @@ extensions: []
192
218
  extra_rdoc_files: []
193
219
  files:
194
220
  - LICENSE
221
+ - README.md
195
222
  - _config.yml
196
223
  - _data/navigation/main.yml
197
224
  - _data/ui-text.yml
@@ -356,7 +383,6 @@ files:
356
383
  - assets/images/logo_drop_shadow.png
357
384
  - assets/images/mstile-150x150.png
358
385
  - assets/images/safari-pinned-tab.svg
359
- - assets/images/site-under-construction.png
360
386
  - assets/images/site.webmanifest
361
387
  - assets/js/_main.js
362
388
  - assets/js/lunr/lunr-en.js
@@ -372,12 +398,14 @@ files:
372
398
  - assets/js/plugins/jquery.magnific-popup.js
373
399
  - assets/js/plugins/smooth-scroll.js
374
400
  - assets/js/vendor/jquery/jquery-3.6.0.js
401
+ - lib/creek-jekyll-theme.rb
402
+ - lib/creek-jekyll-theme/include_snippet.rb
375
403
  homepage: https://github.com/creek-service/creek-jekyll-theme
376
404
  licenses:
377
405
  - MIT
378
406
  metadata:
379
407
  plugin_type: theme
380
- post_install_message:
408
+ post_install_message:
381
409
  rdoc_options: []
382
410
  require_paths:
383
411
  - lib
@@ -392,8 +420,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
392
420
  - !ruby/object:Gem::Version
393
421
  version: '0'
394
422
  requirements: []
395
- rubygems_version: 3.3.26
396
- signing_key:
423
+ rubygems_version: 3.4.19
424
+ signing_key:
397
425
  specification_version: 4
398
426
  summary: A Jekyll theme gem, intended only for the Creek website.
399
427
  test_files: []