jekyll-include_snippet 0.1.0 → 0.1.1
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/README.md +15 -6
- data/lib/jekyll/include_snippet/extractor.rb +4 -7
- data/lib/jekyll/include_snippet/liquid_tag.rb +1 -1
- data/lib/jekyll/include_snippet/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 630d507fa7567bd1c603300264fcad567d76edb0
|
4
|
+
data.tar.gz: 0746efea8f3df62129a5c4642e8a880b48ac5b99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 673b72138d6e810612186407efddf19fa2dc5db2925669fec59555f148db24b8d375b2ec3e8a79f70cd70833b6e612c77d8d815827d68dbe8d94dfd0f784e908
|
7
|
+
data.tar.gz: 1844a9d618f20727d0475527ec400485946c41d6335dff2398ac2a0bac3b142b00584006cac5e59bbbb3f2c3444291c8259920a903cf9753ab0fd03741561cde
|
data/README.md
CHANGED
@@ -4,11 +4,13 @@ Include snippets of text from external files into your markdown
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
Add it to your `Gemfile
|
7
|
+
Add it to your `Gemfile` (in a way that Jekyll will load):
|
8
8
|
|
9
9
|
source 'https://rubygems.org'
|
10
10
|
|
11
|
-
|
11
|
+
group :jekyll_plugins do
|
12
|
+
gem 'jekyll-include_snippet'
|
13
|
+
end
|
12
14
|
|
13
15
|
## Usage
|
14
16
|
|
@@ -26,13 +28,18 @@ Put the special "begin-snippet" and "end-snippet" comments into your source file
|
|
26
28
|
|
27
29
|
Use it from your markdown:
|
28
30
|
|
31
|
+
---
|
32
|
+
title: "My Blerg Post"
|
33
|
+
date: "2018-01-01"
|
34
|
+
---
|
35
|
+
|
29
36
|
Blah blah here is some code:
|
30
37
|
|
31
38
|
```ruby
|
32
39
|
{% include_snippet my_method_snippet from path/to/blah.rb %}
|
33
40
|
```
|
34
41
|
|
35
|
-
|
42
|
+
Optionally, you can set a default source path in the YAML frontmatter:
|
36
43
|
|
37
44
|
---
|
38
45
|
title: "My Blerg Post"
|
@@ -44,9 +51,11 @@ Alternatively, you can set a default source path in the YAML frontmatter:
|
|
44
51
|
{% include_snippet my_method_snippet %}
|
45
52
|
```
|
46
53
|
|
47
|
-
And the text from `blah.rb` will be included into your post (and processed as markdown).
|
48
|
-
|
49
|
-
|
50
54
|
## License
|
51
55
|
|
52
56
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
57
|
+
|
58
|
+
## TODO
|
59
|
+
|
60
|
+
- Could easily be optimised for better performance
|
61
|
+
- Maybe a feature for evaluating code and including the result
|
@@ -3,13 +3,13 @@ module Jekyll
|
|
3
3
|
class Extractor
|
4
4
|
BEGIN_REGEX = %r{
|
5
5
|
(\s*)\#\s* # Line must start with a hash (surrounding whitespace optional)
|
6
|
-
begin-snippet:
|
7
|
-
(.+)
|
6
|
+
begin-snippet: # Magic string for beginning a snippet
|
7
|
+
(.+) # The remainder of the line is the snippet name
|
8
8
|
}x
|
9
9
|
|
10
10
|
END_REGEX = %r{
|
11
|
-
\s*\#\s*
|
12
|
-
end-snippet
|
11
|
+
\s*\#\s* # Line must start with a hash (surrounding whitespace optional)
|
12
|
+
end-snippet # Magic string for ending a snippet
|
13
13
|
}x
|
14
14
|
|
15
15
|
def call(source)
|
@@ -37,9 +37,6 @@ module Jekyll
|
|
37
37
|
|
38
38
|
private
|
39
39
|
|
40
|
-
def hash_from_snippets(snippets)
|
41
|
-
end
|
42
|
-
|
43
40
|
class Snippet
|
44
41
|
attr_reader :name, :indent, :lines
|
45
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-include_snippet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Dalling
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: liquid
|