jekyll_include_plugin 1.2.0 → 1.3.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: 1ab41eee4ee062ebf7ff40d8af0a74b1f8c62290917d9a8f7cefff42da0448eb
4
- data.tar.gz: 33baf168b4e8135a1764c87331440fe0b99708ed03ae0c785b05f83a460e7dbc
3
+ metadata.gz: bf5e2649753a79999e7dc654d94f74b2fb46bd3825d0724c045785fa67e12f2a
4
+ data.tar.gz: 516cc1d240386761f0ed7e315978d5c9280925732dcba575bfcc75cbd71e2f05
5
5
  SHA512:
6
- metadata.gz: 273307ca8e1c63524efaed172e0175fb92296184940d8456cf143303363662652eb11648d352c93c0a7e667ac3f51f366ebb001829347bef1b22a9de8c8b38e1
7
- data.tar.gz: b1ed24b4640b5897660f76d340b9067b9a936bf209c32037b647c7c5f378ea0a7effec85c7bc2272c001238c6bc3ee35d0c4da9e0018ecc7e43194fbb369e397
6
+ metadata.gz: ddc9154f479ac2f0592ac47e00599f4efe4057a58b5b5ca3d03ac3fb415cbc052354a77d3942ae685134c3f16351767fb0e5d0c658845833759e871263446d5a
7
+ data.tar.gz: f078a6a8c2f89fae4e3af7d620c6fe7aa2224b0d27144fa0ea25a267534e3c0532480a6901802ce3d8816e376fe61d661425b04af1319c6e4b76e95fe952fe9d
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
9
  matrix:
10
- ruby: [2.6.10, 2.7.6, 3.0.4, 3.1.2, 3.2.0, 3.4.2]
10
+ ruby: [3.1.2, 3.2.0, 3.4.2]
11
11
  steps:
12
12
  - uses: actions/checkout@v2
13
13
  - name: Set up Ruby
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ .idea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jekyll_include_plugin (1.2.0)
4
+ jekyll_include_plugin (1.3.0)
5
5
  jekyll (>= 3.5, < 5.0)
6
6
  liquid (~> 4.0)
7
7
 
data/README.md CHANGED
@@ -60,6 +60,37 @@ Dynamic parameters:
60
60
  {% include_file "{{ $templatingAllowedHere }}/Dockerfile" snippet="{{ $hereToo }}" %}
61
61
  ```
62
62
 
63
+ ## Ignore a part of an included content
64
+
65
+ The usage:
66
+ ```jsx
67
+ const template = () => {
68
+ return (
69
+ // [<snippet example>]
70
+ <Provider
71
+ // [<ignore>]
72
+ propToIgnore={propToIgnore}
73
+ // [<endignore>]
74
+ component={() => <div>Data is loading...</div>}
75
+ errorComponent={({ message }) => <div>There was an error: {message}</div>}
76
+ >
77
+ ...
78
+ </Provider>
79
+ // [<endsnippet example>]
80
+ );
81
+ };
82
+ ```
83
+
84
+ The result:
85
+ ```jsx
86
+ <Provider
87
+ component={() => <div>Data is loading...</div>}
88
+ errorComponent={({ message }) => <div>There was an error: {message}</div>}
89
+ >
90
+ ...
91
+ </Provider>
92
+ ```
93
+
63
94
  ## Plugin options in `_config.yml`
64
95
 
65
96
  Default options:
@@ -26,6 +26,7 @@ module JekyllIncludePlugin
26
26
  file_contents = remove_all_snippets(file_contents)
27
27
  end
28
28
 
29
+ file_contents = remove_ignored_lines(file_contents)
29
30
  file_contents = remove_excessive_newlines(file_contents)
30
31
  file_contents = remove_excessive_indentation(file_contents)
31
32
  file_contents = render_comments(file_contents, context.registers[:page]["lang"])
@@ -48,6 +48,21 @@ module JekyllIncludePlugin
48
48
  return "#{first_line_indent}#{snippet_prefix}\n#{snippet_content}"
49
49
  end
50
50
 
51
+ def remove_ignored_lines(text)
52
+ ignoring = false
53
+ text.each_line.reject do |line|
54
+ if line =~ /^\s*\/\/\s*\[<ignore>\]/
55
+ ignoring = true
56
+ true
57
+ elsif line =~ /^\s*\/\/\s*\[<endignore>\]/
58
+ ignoring = false
59
+ true
60
+ else
61
+ ignoring
62
+ end
63
+ end.join
64
+ end
65
+
51
66
  def remove_all_snippets(text)
52
67
  result_text = ""
53
68
  text.each_line do |line|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JekyllIncludePlugin
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_include_plugin
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
  - Ilya Lesikov
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-15 00:00:00.000000000 Z
10
+ date: 2025-03-19 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: liquid