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 +4 -4
- data/.github/workflows/main.yml +1 -1
- data/.gitignore +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +31 -0
- data/lib/jekyll_include_plugin/jekyll_include_plugin.rb +1 -0
- data/lib/jekyll_include_plugin/utils.rb +15 -0
- data/lib/jekyll_include_plugin/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf5e2649753a79999e7dc654d94f74b2fb46bd3825d0724c045785fa67e12f2a
|
4
|
+
data.tar.gz: 516cc1d240386761f0ed7e315978d5c9280925732dcba575bfcc75cbd71e2f05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddc9154f479ac2f0592ac47e00599f4efe4057a58b5b5ca3d03ac3fb415cbc052354a77d3942ae685134c3f16351767fb0e5d0c658845833759e871263446d5a
|
7
|
+
data.tar.gz: f078a6a8c2f89fae4e3af7d620c6fe7aa2224b0d27144fa0ea25a267534e3c0532480a6901802ce3d8816e376fe61d661425b04af1319c6e4b76e95fe952fe9d
|
data/.github/workflows/main.yml
CHANGED
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
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|
|
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.
|
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-
|
10
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: liquid
|