jekyll_flexible_include 2.0.6 → 2.0.7

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: fed2067800a2324df252ff3e8cfd48b21c9cb3754e5e5b474d135ebb307cd8bf
4
- data.tar.gz: abbf8f05f739832f259d9cb16d16d552ae18ee3da17a5bf8a77cae933cdb9b76
3
+ metadata.gz: 38eeb054b62e4c999437208ce95cb7291174167839d344db3df48670954b32ef
4
+ data.tar.gz: '0962b93b74c28d6521c655cea29f0646c11051d8f3ddaf690618b9ed91e7276b'
5
5
  SHA512:
6
- metadata.gz: b33745dc685acc809658f6ad42efaea735747c5b6816653e10ae56e5f001f957e0f13959d3e1cffe954d2ba8270309277a322568d8536864d9fc055938e00c48
7
- data.tar.gz: c6926ffab7a700d4ef884237c0f606ed053d32e66ac97472458cc09102875df883d1cc656c55dfb6a769bc094ae7447abe6e2057bebfb9a74f6e183c57d2e625
6
+ metadata.gz: 2e3ec9a8c269bda135c245a54b995abd6f2229658190a5f89e1bad97372e85f4a37af7c7227cbaa8b518f1ae90a6b70ecc3f0f9c881859329fdf241123047ca6
7
+ data.tar.gz: b8f6497ee5505ac0f43f28a6c9d0bb639be7b7c2bc712375f8ae6774522ccaae6ecd0108be1bdcb0d72cb1656e0b1a268ffa52d3feb675722295aca6c698961d
data/CHANGELOG.md CHANGED
@@ -1,12 +1,17 @@
1
+ ## 2.0.7 / 2022-04-14
2
+ * Added `file=` option, so the included file or process is better defined. This option is not required; the file/process can be specified without it as before.
3
+ * Documented `data-lt-active="false"`.
4
+ * Added `dark` option, and [provided CSS](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#pre_css).
5
+
1
6
  ## 2.0.6 / 2022-04-11
2
7
  * Niggling little bug thing. Gone.
3
8
 
4
9
  ## 2.0.5 / 2022-04-11
5
- * Now using <code>Shellwords</code> and <code>KeyValueParser</code> instead of a homegrown parser.
10
+ * Now using `Shellwords` and `KeyValueParser` instead of a homegrown parser.
6
11
  * Refactored helper methods to jekyll_tag_helper.rb
7
12
  * Looks up values for liquid variable references from several scopes.
8
13
  * Suppresses stack dump when an error occurs.
9
- * Deleted a lot of old cruft.
14
+ * Deleted a lot of old cruft. Virtually none of the original code remains.
10
15
  * Added pre, label and copy_button optional parameters
11
16
 
12
17
  ## 2.0.4 / 2022-04-05
data/README.md CHANGED
@@ -22,6 +22,7 @@ This plugin supports 4 types of includes:
22
22
  In addition, filenames that require environment expansion because they contain a <code>$</code> character are
23
23
  expanded according to the environment variables defined when <code>jekyll build</code> executes.
24
24
 
25
+
25
26
  ### Syntax
26
27
  The following are equivalent:
27
28
  ```
@@ -36,18 +37,18 @@ Note that the [square brackets] merely indicate optional parameters and are not
36
37
 
37
38
  ### Options
38
39
  * `do_not_escape` includes the content without HTML escaping it.
39
- * `pre` causes the included file to be wrapped inside a &lt;pre>&lt;/pre> tag, no label is generated.
40
+ * `pre` causes the included file to be wrapped inside a &lt;pre>&lt;/pre> tag, no label is generated. The &lt;pre>&lt;/pre> tag has an `data-lt-active="false"` attribute, so [LanguageTool](https://forum.languagetool.org/t/avoid-spell-check-on-certain-html-inputs-manually/3944) does not check the spelling or grammar of the contents.
40
41
 
41
42
  The following options imply `pre`:
43
+ * `dark` applies the `dark` class to the generated &lt;pre>&lt;/pre> tag.
44
+ You can define the `dark` and `darkLabel` classes as desired.
45
+ [This CSS is a good starting point.](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#pre_css)
42
46
  * `download` uses the name of the file as a label, and displays it above the &lt;pre>&lt;/pre> tag. Clicking the label causes the file to be downloaded.
43
47
  * `copy_button` draws an icon at the top right of the &lt;pre>&lt;/pre> tag that causes the included contents to be copied to the clipboard.
44
48
  * `label` specifies that an automatically generated label be placed above the contents. There is no need to specify this option if `download` or `copy_button` options are provided.
45
49
  * `label="blah blah"` specifies a label for the contents; this value overrides the default label. The value can be enclosed in single or double quotes.
46
50
 
47
51
 
48
- ### Additional Information
49
- More information is available on my web site about [my Jekyll plugins](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
50
-
51
52
 
52
53
  ## Installation
53
54
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllFlexibleIncludePluginVersion
4
- VERSION = "2.0.6"
4
+ VERSION = "2.0.7"
5
5
  end
@@ -27,15 +27,17 @@ class FlexibleInclude < Liquid::Tag
27
27
  end
28
28
 
29
29
  # @param liquid_context [Liquid::Context]
30
- def render(liquid_context) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity
30
+ def render(liquid_context) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/CyclomaticComplexity
31
31
  @helper.liquid_context = liquid_context
32
32
  @do_not_escape = @helper.parameter_specified? "do_not_escape"
33
33
  @download = @helper.parameter_specified? "download"
34
+ @dark = " dark" if @helper.parameter_specified?("dark")
34
35
  @label = @helper.parameter_specified? "label"
35
36
  @label_specified = @label
36
37
  @copy_button = @helper.parameter_specified? "copyButton"
37
- @pre = @copy_button || @download || @label_specified || @helper.parameter_specified?("pre") # Download or label implies pre
38
- filename = @helper.params.first # Do this after all options have been checked for
38
+ @pre = @copy_button || @dark || @download || @label_specified || @helper.parameter_specified?("pre") # Download or label implies pre
39
+ filename = @helper.parameter_specified? "file"
40
+ filename ||= @helper.params.first # Do this after all options have been checked for
39
41
  @label ||= filename
40
42
 
41
43
  # If a label was specified, use it, otherwise concatenate any dangling parameters and use that as the label
@@ -53,7 +55,7 @@ class FlexibleInclude < Liquid::Tag
53
55
  path = File.join(ENV['HOME'], filename)
54
56
  @logger.debug { "User home end filename=#{filename}, path=#{path}" }
55
57
  when /\A!/ # Run command and return response
56
- filename = JekyllTagHelper.remove_quotes(@helper.argv.first)
58
+ filename = JekyllTagHelper.remove_quotes(@helper.argv.first) if @helper.argv.first
57
59
  filename.slice! "!"
58
60
  contents = run(filename)
59
61
  else # Relative path
@@ -107,9 +109,10 @@ class FlexibleInclude < Liquid::Tag
107
109
  end
108
110
  pre_id = "id#{SecureRandom.hex 6}"
109
111
  copy_button = @copy_button ? "#{PREFIX}'##{pre_id}'#{SUFFIX}" : ""
112
+ dark_label = " darkLabel" if @dark
110
113
  <<~END_PRE
111
- <div class="codeLabel">#{label_or_href}</div>
112
- <pre data-lt-active="false" class="maxOneScreenHigh copyContainer" id="#{pre_id}">#{copy_button}#{content}</pre>
114
+ <div class="codeLabel#{dark_label}">#{label_or_href}</div>
115
+ <pre data-lt-active="false" class="maxOneScreenHigh copyContainer#{@dark}" id="#{pre_id}">#{copy_button}#{content}</pre>
113
116
  END_PRE
114
117
  end
115
118
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_flexible_include
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2022-04-13 00:00:00.000000000 Z
13
+ date: 2022-04-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jekyll