jekyll-include_snippet 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 00f11048d745f88a45a271aeb681ee50e15ccfc6
4
- data.tar.gz: 9045192b86846e6e30a556cf3b854acd6a8bf060
3
+ metadata.gz: 630d507fa7567bd1c603300264fcad567d76edb0
4
+ data.tar.gz: 0746efea8f3df62129a5c4642e8a880b48ac5b99
5
5
  SHA512:
6
- metadata.gz: 55f1afa12468169590277215842aa22e9ac7c7119bee84371e45ee318c7df82b3d03b72923a704b98b57f22d493c571b5c0b4f463837a6a3528d47a5442f6ac1
7
- data.tar.gz: 47022efa04a82c1e5ef482acb5ca6d54b5da59e339ba94e8ce57ad42d6a63238bed4eb6aaff230481decff2824540b4f0cc7a276cf9be8037eec672b33136046
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
- gem 'jekyll-include_snippet', github: 'tomdalling/jekyll-include_snippet'
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
- Alternatively, you can set a default source path in the YAML frontmatter:
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: # Magic string for beginning a snippet
7
- (.+) # The remainder of the line is the snippet name
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* # Line must start with a hash (surrounding whitespace optional)
12
- end-snippet # Magic string for ending a 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
 
@@ -3,7 +3,7 @@ module Jekyll
3
3
  class LiquidTag < Liquid::Tag
4
4
  def initialize(tag_name, arg_str, tokens)
5
5
  super
6
- @snippet_name, @source_path = arg_str.split('from').map(&:strip)
6
+ @snippet_name, @source_path = arg_str.split(/\sfrom\s/).map(&:strip)
7
7
  end
8
8
 
9
9
  def render(context)
@@ -1,5 +1,5 @@
1
1
  module Jekyll
2
2
  module IncludeSnippet
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
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.0
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-04-15 00:00:00.000000000 Z
11
+ date: 2018-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid