jekyll_plugin_support 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +56 -6
- data/lib/jekyll_plugin_support/version.rb +1 -1
- data/lib/jekyll_plugin_support_tag.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d96d3f40ca733d7fa1322a8fbec0a70131029baa063a32c55fdc003efcf0d24
|
4
|
+
data.tar.gz: 2ebb3e46419147a2f1b60e2024fd7118617be61c6cd8f359e448aad2279bf92f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4022b99e9b6b1eef55be72e3cbe6a8d99af12e6ec0004a1e2c610325c726ffdf5cef042ce8687eb9be4e352fc7372e3a51f7053e39303cb06ff2dd5f180d530
|
7
|
+
data.tar.gz: 6d6b5d1221e8985a02bc8bfe32d6411cb516aa4376a0a3f27d9dc6d7b66bee43ce41c02b026e102f9b5035f0b6b116cf8983e1b8b6cea3847a5c2d70733cff69
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -26,6 +26,27 @@ Plugins that use `jekyll_plugin_support` include:
|
|
26
26
|
[`jekyll_plugin_support`](https://github.com/mslinn/jekyll_plugin_support/tree/master/demo/_plugins)
|
27
27
|
|
28
28
|
|
29
|
+
## Features
|
30
|
+
|
31
|
+
Jekyll plugin tags created from `jekyll_plugin_support` framework automatically have the following features:
|
32
|
+
|
33
|
+
1. Boilerplate is removed, so you can focus on the required logic and output.
|
34
|
+
2. Arguments are parsed for keywords and name/value parameters.
|
35
|
+
3. Single or double quotes can be used for arguments and parameters.
|
36
|
+
4. Important variables are defined.
|
37
|
+
5. Error handling is standardized, and includes an automatically defined error type
|
38
|
+
and corresponding CSS tag for each Jekyll tag.
|
39
|
+
6. Liquid variables can be passed as parameters to tags, and used in the body of block tags.
|
40
|
+
7. Registration is automatic, and important configuration details are reported during registration.
|
41
|
+
8. A custom logger is created for each tag, independent of the default Jekyll logger.
|
42
|
+
9. Variables can be defined in `_config.yml`, and optionally have different values for debug mode,
|
43
|
+
production mode and test mode.
|
44
|
+
10. An attribution message is available.
|
45
|
+
11. Draft pages are automatically detected.
|
46
|
+
|
47
|
+
In addition, a demonstration website is provided for easy testing of your plugins.
|
48
|
+
|
49
|
+
|
29
50
|
## Installation
|
30
51
|
|
31
52
|
`Jekyll_plugin_support` is packaged as a Ruby gem.
|
@@ -297,11 +318,14 @@ After your plugin has parsed all the keyword options and name/value parameters,
|
|
297
318
|
call `@helper.remaining_markup` to obtain the remaining markup that was passed to your plugin.
|
298
319
|
|
299
320
|
|
300
|
-
##
|
321
|
+
## Configuration Variables
|
301
322
|
|
302
323
|
`jekyll_plugin_support` provides support for
|
303
324
|
[Liquid variables](https://shopify.github.io/liquid/tags/variable/)
|
304
325
|
to be defined in `_config.yml`, in a section called `liquid-vars`.
|
326
|
+
These variables behave exactly like Liquid variables defined by `assign` and `capture` expressions,
|
327
|
+
except they are global in scope; these variables are available in every Jekyll web page.
|
328
|
+
|
305
329
|
The following `_config.yml` fragment defines 3 variables called `var1`, `var2` and `var3`:
|
306
330
|
|
307
331
|
```yaml
|
@@ -312,18 +336,44 @@ liquid-vars:
|
|
312
336
|
```
|
313
337
|
|
314
338
|
Liquid variables defined in this manner are intended to be embedded in a webpage.
|
315
|
-
They are
|
316
|
-
|
339
|
+
They are can be used like any other Liquid variable.
|
340
|
+
|
341
|
+
|
342
|
+
### Variable Expansion
|
343
|
+
|
344
|
+
Jekyll expands Liquid variable references during the page rendering process.
|
345
|
+
Jekyll does not expand Liquid variable references passes as parameters to tag and block plugins, however.
|
346
|
+
However, plugins made from `jekyll_plugin_support` automatically
|
347
|
+
expand all types of variable references passed as parameters and in block tag bodies.
|
317
348
|
|
318
|
-
|
319
|
-
|
349
|
+
`Jekyll_plugin_support` tag and block plugins expand the following types of variables:
|
350
|
+
|
351
|
+
* Jekyll_plugin_support configuration variables, discussed above.
|
352
|
+
* Jekyll [page](https://jekyllrb.com/docs/variables/#page-variables) and
|
353
|
+
[layout](https://jekyllrb.com/docs/layouts/#variables) variables.
|
354
|
+
* Inline Liquid variables (defined in [assign](https://shopify.dev/docs/api/liquid/tags/assign) and [capture](https://shopify.dev/docs/api/liquid/tags/capture) statements).
|
355
|
+
|
356
|
+
In the following example web page, Jekyll expands the `var1` reference within the `<p></p>` tag,
|
357
|
+
but not the `var1` or `var2` references passed to `my_plugin`.
|
320
358
|
|
321
359
|
```html
|
322
|
-
This is the value of var1: {{var1}}
|
360
|
+
<p>This is the value of var1: {{var1}}.</p>
|
323
361
|
|
324
362
|
{% my_plugin param1="{{var1}}" param2="{{var2}}" %}
|
325
363
|
```
|
326
364
|
|
365
|
+
Assuming that `my_plugin` was written as a `jekyll_plugin_support` plugin,
|
366
|
+
all variable references in its parameters are expanded.
|
367
|
+
Thus, the above is interpreted as follows when `my_plugin` is evaluated during the Jekyll rendering process:
|
368
|
+
</p>
|
369
|
+
|
370
|
+
```html
|
371
|
+
<p>This is the value of var1: value1.</p>
|
372
|
+
|
373
|
+
{% my_plugin param1="value1" param2="value 2" %}
|
374
|
+
```
|
375
|
+
|
376
|
+
|
327
377
|
`Jekyll_plugin_support` expands most of the [plugin variables described above](#predefined-variables),
|
328
378
|
replacing Liquid variable references with their values.
|
329
379
|
The exception is `@argument_string`, which is not expanded.
|
@@ -63,7 +63,9 @@ module JekyllSupport
|
|
63
63
|
render_impl
|
64
64
|
rescue StandardError => e
|
65
65
|
e.shorten_backtrace
|
66
|
-
|
66
|
+
file_name = e.backtrace[0]&.split(':')&.first
|
67
|
+
of_file_name = "of #{file_name} " if file_name
|
68
|
+
@logger.error { "#{e.class} on line #{@line_number} #{of_file_name}while processing #{tag_name} - #{e.message}" }
|
67
69
|
binding.pry if @pry_on_standard_error # rubocop:disable Lint/Debugger
|
68
70
|
raise e if @die_on_standard_error
|
69
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll_plugin_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Slinn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.
|
142
|
+
rubygems_version: 3.5.6
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: Provides a framework for writing and testing Jekyll plugins
|