jekyll-block 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bfbb13e63b399d1d39e069a3674e26ab70da53537c0351af7dac61e058d8e741
4
+ data.tar.gz: 1fa9e517a53efafd033be14510aac9e1e6e0b5cab5e675f1dd0c0b01572acd28
5
+ SHA512:
6
+ metadata.gz: e85ba17e07ac270b0cca66a60ead1ba67e56d21caa7111e7aff254ff1807ad6bca0808e1deee0f43474ff6165e5f819112f30c6efc4ed4b6b103d0ef699ea5f1
7
+ data.tar.gz: a95915da03b67a95ab0f23baef26f64dfa1f1265943a44c4b4b239ae7a4a155afbe468eeac8542d3700ea927a0e4410720dafcb8925ac9faf8e851bd2058b7fb
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.gem
@@ -0,0 +1,10 @@
1
+ require: rubocop-jekyll
2
+ inherit_gem:
3
+ rubocop-jekyll: .rubocop.yml
4
+
5
+ Style/ClassAndModuleChildren:
6
+ Enabled: false
7
+
8
+ AllCops:
9
+ Exclude:
10
+ - vendor/**/*
@@ -0,0 +1 @@
1
+ 2.5.3
@@ -0,0 +1,16 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ before_install: gem install bundler -v 2.0.2
5
+ script:
6
+ - bundle exec rake
7
+ - bundle exec rubocop
8
+ deploy:
9
+ provider: rubygems
10
+ api_key:
11
+ secure: B+x/LA7mNueMslGUAF6eLaB9sw2+KnaWxRmo7u/KIXdiBrLXEar1JyVS06kHWGP4q213Cv6SjZa9hKG6ksoucI12PjhR1ObkIt/fXjiRJaYJTAr6Jn2C8mC2kUILAhYiktdE+xtyl6Q/7QxDB4RYygD396iwfAipU10wBAvcf5Pxkj9GzfFXyJzBO3fdZeYcVfZbkUTvA7ueSQfcY1UQNiTtKiRecXhFHWcYzjsW9ixKDkKVO83fzdvtZBIKL7039jxu1XSCUDSq8IB2Q8o6U16kWNYMZ6UTbUHd0cPtAkEYKkwiYEd15ybPfo41t1M7o52f3hXKbXzjrVjthR/mgQOLXnT22X0bJBrmcyNWa14Ul3gUUdgnxVjH8JrIEgh/eOLmjqj6+ZtN3JkOdIa+e8zoQQPAiyAEOhiQhwtEkjxAFcqpve9nbTWEY7oHcjpMALuiMPhfVGQYz0XJG9TAbOYkfh5YlWm+AUFkNJx1V80zYiSG4z93RqGoiBosYS2pm0dYe1/qjXI97gUI4TfKFD6uiDQztlwdzxnOubsDQLEr8ohGV/fPT9B7gNQiFg9LvmX97Y9BwaYJq88/SEi+hnilnDxzN1WxQ/C01iX75ZcrWqbmW/hWIpfzTs7rETYUzlsK5K+UrVfa70Se7Dw7qIighstSxVBz9hfpKGTUZQQ=
12
+ gem: jekyll-block
13
+ on:
14
+ tags: true
15
+ branch: master
16
+ repo: MaximeKjaer/jekyll-block
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## v0.0.0
4
+
5
+ Initial release 🎉
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jekyll-block.gemspec
6
+ gemspec
@@ -0,0 +1,97 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-block (0.0.0)
5
+ jekyll (>= 3.6, < 5.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.7.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.0)
13
+ colorator (1.1.0)
14
+ concurrent-ruby (1.1.5)
15
+ em-websocket (0.5.1)
16
+ eventmachine (>= 0.12.9)
17
+ http_parser.rb (~> 0.6.0)
18
+ eventmachine (1.2.7)
19
+ ffi (1.12.1)
20
+ forwardable-extended (2.6.0)
21
+ http_parser.rb (0.6.0)
22
+ i18n (1.8.2)
23
+ concurrent-ruby (~> 1.0)
24
+ jaro_winkler (1.5.4)
25
+ jekyll (4.0.0)
26
+ addressable (~> 2.4)
27
+ colorator (~> 1.0)
28
+ em-websocket (~> 0.5)
29
+ i18n (>= 0.9.5, < 2)
30
+ jekyll-sass-converter (~> 2.0)
31
+ jekyll-watch (~> 2.0)
32
+ kramdown (~> 2.1)
33
+ kramdown-parser-gfm (~> 1.0)
34
+ liquid (~> 4.0)
35
+ mercenary (~> 0.3.3)
36
+ pathutil (~> 0.9)
37
+ rouge (~> 3.0)
38
+ safe_yaml (~> 1.0)
39
+ terminal-table (~> 1.8)
40
+ jekyll-sass-converter (2.0.1)
41
+ sassc (> 2.0.1, < 3.0)
42
+ jekyll-watch (2.2.1)
43
+ listen (~> 3.0)
44
+ kramdown (2.1.0)
45
+ kramdown-parser-gfm (1.1.0)
46
+ kramdown (~> 2.0)
47
+ liquid (4.0.3)
48
+ listen (3.2.1)
49
+ rb-fsevent (~> 0.10, >= 0.10.3)
50
+ rb-inotify (~> 0.9, >= 0.9.10)
51
+ mercenary (0.3.6)
52
+ minitest (5.14.0)
53
+ parallel (1.19.1)
54
+ parser (2.7.0.2)
55
+ ast (~> 2.4.0)
56
+ pathutil (0.16.2)
57
+ forwardable-extended (~> 2.6)
58
+ public_suffix (4.0.3)
59
+ rainbow (3.0.0)
60
+ rake (10.5.0)
61
+ rb-fsevent (0.10.3)
62
+ rb-inotify (0.10.1)
63
+ ffi (~> 1.0)
64
+ rouge (3.15.0)
65
+ rubocop (0.71.0)
66
+ jaro_winkler (~> 1.5.1)
67
+ parallel (~> 1.10)
68
+ parser (>= 2.6)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ ruby-progressbar (~> 1.7)
71
+ unicode-display_width (>= 1.4.0, < 1.7)
72
+ rubocop-jekyll (0.10.0)
73
+ rubocop (>= 0.68.0, < 0.72.0)
74
+ rubocop-performance (~> 1.2)
75
+ rubocop-performance (1.5.2)
76
+ rubocop (>= 0.71.0)
77
+ ruby-progressbar (1.10.1)
78
+ safe_yaml (1.0.5)
79
+ sassc (2.2.1)
80
+ ffi (~> 1.9)
81
+ terminal-table (1.8.0)
82
+ unicode-display_width (~> 1.1, >= 1.1.1)
83
+ unicode-display_width (1.6.1)
84
+
85
+ PLATFORMS
86
+ ruby
87
+
88
+ DEPENDENCIES
89
+ bundler (~> 2.0)
90
+ jekyll-block!
91
+ minitest (~> 5.0)
92
+ rake (~> 10.0)
93
+ rubocop (>= 0.68.0, < 0.72.0)
94
+ rubocop-jekyll (~> 0.10.0)
95
+
96
+ BUNDLED WITH
97
+ 2.0.2
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Maxime Kjaer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,67 @@
1
+ # jekyll-block
2
+
3
+ `jekyll-block` is a Jekyll plugin that adds a `{% block %}` Liquid block.
4
+
5
+ It is very similar to [Premonition](https://github.com/lazee/premonition), but has a few differences:
6
+
7
+ - Only supports Kramdown; does not support RedCarpet
8
+ - Works in [post excerpts](https://jekyllrb.com/docs/posts/#post-excerpts)
9
+ - Works with Kramdown [link definitions](https://kramdown.gettalong.org/syntax.html#link-definitions), [footnotes](https://kramdown.gettalong.org/syntax.html#footnotes) and [abbreviations](https://kramdown.gettalong.org/syntax.html#abbreviations)
10
+
11
+ It's also similar to [Jolt](https://github.com/helpscout/jekyll-jolt), but has a more concise syntax.
12
+
13
+ ## Installation
14
+
15
+ Add the following to your `Gemfile`:
16
+
17
+ ```ruby
18
+ group :jekyll_plugins do
19
+ gem "jekyll-block", "~> 0.0.0"
20
+ end
21
+ ```
22
+
23
+ Then add jekyll-block to `plugins` in Jekyll's `_config.yml`:
24
+
25
+ ```yml
26
+ plugins:
27
+ - jekyll-block
28
+ ```
29
+
30
+ Then run:
31
+
32
+ ```console
33
+ $ bundle install
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ In a Markdown post, you can use the `block` tag as follows:
39
+
40
+ ```liquid
41
+ {% block warning %}
42
+ This is the text of the warning block! Note that you **can** write Markdown here.
43
+ {% endblock %}
44
+
45
+ {% block note "Optional block title" %}
46
+ This block will also have a title
47
+ {% endblock %}
48
+ ```
49
+
50
+ The block tag takes two arguments:
51
+
52
+ - **type**: A single word for the block type. The type is added to the generated HTML's class list.
53
+ - **title**: A string in quotes for the block title. The title is added to the block's header, and is used to generate an HTML `id` attribute.
54
+
55
+ ## Development
56
+
57
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests. Run `rubocop` to run formatting and linting checks.
58
+
59
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb` and commit it locally. Then, run `git tag "v1.2.3"`, and `git push --tags`.
60
+
61
+ ## Contributing
62
+
63
+ Bug reports and pull requests are welcome on GitHub at https://github.com/MaximeKjaer/jekyll-block.
64
+
65
+ ## License
66
+
67
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task :default => :test
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "jekyll-block/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "jekyll-block"
9
+ spec.version = Jekyll::Block::VERSION
10
+ spec.authors = ["Maxime Kjaer"]
11
+ spec.email = ["maxime.kjaer@gmail.com"]
12
+
13
+ spec.summary = "Liquid tag for message boxes"
14
+ spec.description = 'Adds a "block" Liquid tag to generate HTML for message boxes in Jekyll'
15
+ spec.homepage = "https://github.com/MaximeKjaer/jekyll-block"
16
+ spec.license = "MIT"
17
+
18
+ spec.required_ruby_version = ">= 2.3.0"
19
+
20
+ spec.metadata["homepage_uri"] = spec.homepage
21
+ spec.metadata["source_code_uri"] = "https://github.com/MaximeKjaer/jekyll-block"
22
+ spec.metadata["changelog_uri"] = "https://github.com/MaximeKjaer/jekyll-block/blob/master/CHANGELOG.md"
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r!^exe/!) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 2.0"
34
+ spec.add_development_dependency "minitest", "~> 5.0"
35
+ spec.add_development_dependency "rake", "~> 10.0"
36
+ spec.add_development_dependency "rubocop", ">= 0.68.0", "< 0.72.0"
37
+ spec.add_development_dependency "rubocop-jekyll", "~> 0.10.0"
38
+
39
+ spec.add_runtime_dependency "jekyll", ">= 3.6", "< 5.0"
40
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll-block/version"
4
+ require "jekyll-block/block_tag"
5
+
6
+ module Jekyll
7
+ module Block
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+
5
+ module Jekyll
6
+ module Block
7
+ # A Jekyll Liquid {% block %} block tag that generates HTML for block-styled content.
8
+ # The content of the block can contain Markdown, which will be parsed by kramdown.
9
+ #
10
+ # Usage:
11
+ # {% block <type> ["Title"] %}
12
+ # *Markdown content*
13
+ # {% endblock %}
14
+ #
15
+ # The type argument is mandatory, and the title is optional.
16
+ class BlockTag < Liquid::Block
17
+ def initialize(tag_name, text, tokens)
18
+ @type, @title = text.match(%r!\s*(\w+)\s+(?:\"(.*)\".*)?!im).captures
19
+ @id = @title ? @type.downcase + ":" + Jekyll::Utils.slugify(@title) : nil
20
+ super
21
+ end
22
+
23
+ attr_reader :type, :title, :id
24
+
25
+ def render(context)
26
+ text = super
27
+ if @title
28
+ "<div class=\"block #{@type}\" id=\"#{@id}\" markdown=\"block\">"\
29
+ "<a class=\"header\" href=\"##{id}\">"\
30
+ "#{@type.capitalize}: #{@title}"\
31
+ "</a>"\
32
+ "\n#{text}\n"\
33
+ "</div>"
34
+ else
35
+ "<div class=\"block #{@type}\" markdown=\"block\">"\
36
+ "<span class=\"header\">#{@type.capitalize}</span>"\
37
+ "\n#{text}\n"\
38
+ "</div>"
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ Liquid::Template.register_tag("block", Jekyll::Block::BlockTag)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Block
5
+ VERSION = "0.0.0"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-block
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Maxime Kjaer
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.68.0
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: 0.72.0
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: 0.68.0
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.72.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: rubocop-jekyll
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 0.10.0
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: 0.10.0
89
+ - !ruby/object:Gem::Dependency
90
+ name: jekyll
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '3.6'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '5.0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '3.6'
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '5.0'
109
+ description: Adds a "block" Liquid tag to generate HTML for message boxes in Jekyll
110
+ email:
111
+ - maxime.kjaer@gmail.com
112
+ executables: []
113
+ extensions: []
114
+ extra_rdoc_files: []
115
+ files:
116
+ - ".gitignore"
117
+ - ".rubocop.yml"
118
+ - ".ruby-version"
119
+ - ".travis.yml"
120
+ - CHANGELOG.md
121
+ - Gemfile
122
+ - Gemfile.lock
123
+ - LICENSE.txt
124
+ - README.md
125
+ - Rakefile
126
+ - jekyll-block.gemspec
127
+ - lib/jekyll-block.rb
128
+ - lib/jekyll-block/block_tag.rb
129
+ - lib/jekyll-block/version.rb
130
+ homepage: https://github.com/MaximeKjaer/jekyll-block
131
+ licenses:
132
+ - MIT
133
+ metadata:
134
+ homepage_uri: https://github.com/MaximeKjaer/jekyll-block
135
+ source_code_uri: https://github.com/MaximeKjaer/jekyll-block
136
+ changelog_uri: https://github.com/MaximeKjaer/jekyll-block/blob/master/CHANGELOG.md
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.3.0
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.7.6
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Liquid tag for message boxes
157
+ test_files: []