jekyll_kramdown 0.1.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 +7 -0
- data/.rubocop.yml +75 -0
- data/CHANGELOG.md +5 -0
- data/README.md +148 -0
- data/Rakefile +40 -0
- data/jekyll_kramdown.gemspec +40 -0
- data/lib/jekyll_kramdown/version.rb +3 -0
- data/lib/jekyll_kramdown.rb +10 -0
- data/lib/jekyll_kramdown_module.rb +24 -0
- data/lib/kramdown_class.rb +67 -0
- data/spec/jekyll_kramdown/jekyll_kramdown_module_spec.rb +16 -0
- data/spec/jekyll_kramdown_spec.rb +15 -0
- data/spec/spec_helper.rb +81 -0
- metadata +148 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a796724c93743f8cea36b528f0db8b74f9f30ca6e35a1df8bbfc9c92cba199c7
|
|
4
|
+
data.tar.gz: db263da0a59b4e92e25aade787d317dcb755df5518ad9fe39932019a0b2089f1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 53ccc64fec3660aef6914c5a7702a386706cc967d8be71545aacad22593b9dd253987ab96c2fc6d475125e3596e0d517ba49e51b2b31e8200e6ac3ec1129cbad
|
|
7
|
+
data.tar.gz: ac774f381cd4ea8e36fe88e5c022575ef66fe8121b33cf1ee40304e70474f5cc61495bd461ffd8f29de9a842adbab8799f85e94c785eaa9625690c2fe7122b55
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
# - rubocop-jekyll
|
|
3
|
+
- rubocop-md
|
|
4
|
+
- rubocop-performance
|
|
5
|
+
- rubocop-rake
|
|
6
|
+
- rubocop-rspec
|
|
7
|
+
|
|
8
|
+
AllCops:
|
|
9
|
+
Exclude:
|
|
10
|
+
- binstub/**/*
|
|
11
|
+
- exe/**/*
|
|
12
|
+
- vendor/**/*
|
|
13
|
+
- Gemfile*
|
|
14
|
+
NewCops: enable
|
|
15
|
+
|
|
16
|
+
Gemspec/DeprecatedAttributeAssignment:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
Gemspec/RequireMFA:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
Layout/HashAlignment:
|
|
23
|
+
EnforcedColonStyle: table
|
|
24
|
+
EnforcedHashRocketStyle: table
|
|
25
|
+
|
|
26
|
+
Layout/LineLength:
|
|
27
|
+
Max: 150
|
|
28
|
+
|
|
29
|
+
Lint/NonDeterministicRequireOrder:
|
|
30
|
+
Enabled: false
|
|
31
|
+
|
|
32
|
+
Metrics/AbcSize:
|
|
33
|
+
Max: 35
|
|
34
|
+
|
|
35
|
+
Metrics/BlockLength:
|
|
36
|
+
Exclude:
|
|
37
|
+
- jekyll_kramdown.gemspec
|
|
38
|
+
Max: 30
|
|
39
|
+
|
|
40
|
+
Metrics/CyclomaticComplexity:
|
|
41
|
+
Max: 15
|
|
42
|
+
|
|
43
|
+
Metrics/MethodLength:
|
|
44
|
+
Max: 40
|
|
45
|
+
|
|
46
|
+
Metrics/ModuleLength:
|
|
47
|
+
Enabled: false
|
|
48
|
+
|
|
49
|
+
Metrics/ParameterLists:
|
|
50
|
+
Enabled: false
|
|
51
|
+
|
|
52
|
+
Metrics/PerceivedComplexity:
|
|
53
|
+
Max: 15
|
|
54
|
+
|
|
55
|
+
Naming/FileName:
|
|
56
|
+
Exclude:
|
|
57
|
+
- Rakefile
|
|
58
|
+
|
|
59
|
+
Style/Documentation:
|
|
60
|
+
Enabled: false
|
|
61
|
+
|
|
62
|
+
Style/FrozenStringLiteralComment:
|
|
63
|
+
Enabled: false
|
|
64
|
+
|
|
65
|
+
Style/TrailingCommaInHashLiteral:
|
|
66
|
+
EnforcedStyleForMultiline: comma
|
|
67
|
+
|
|
68
|
+
RSpec/SpecFilePathFormat:
|
|
69
|
+
IgnoreMethods: true
|
|
70
|
+
|
|
71
|
+
RSpec/ExampleLength:
|
|
72
|
+
Max: 30
|
|
73
|
+
|
|
74
|
+
RSpec/MultipleExpectations:
|
|
75
|
+
Max: 15
|
data/CHANGELOG.md
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# `Jekyll_kramdown` [](https://badge.fury.io/rb/jekyll_kramdown)
|
|
2
|
+
|
|
3
|
+
Defines a `kramdown` block tag that processes
|
|
4
|
+
[Kramdown](https://kramdown.gettalong.org/) (a flavor of Markdown) embedded in
|
|
5
|
+
HTML files.
|
|
6
|
+
|
|
7
|
+
This plugin uses the facilities of the
|
|
8
|
+
[`kramdown`](https://kramdown.gettalong.org) plugin, which can be relatively slow.
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Add the following to your Jekyll website's `Gemfile`:
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
group :jekyll_plugins do
|
|
17
|
+
gem 'jekyll_kramdown'
|
|
18
|
+
end
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
```shell
|
|
24
|
+
$ bundle
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
### Invocation options
|
|
30
|
+
|
|
31
|
+
The available options for the `kramdown` block tag are:
|
|
32
|
+
|
|
33
|
+
- `class` Wrap the output in a div with this class
|
|
34
|
+
- `no_auto_ids` Do not generate `id` tags
|
|
35
|
+
- `hard_wrap` Enable GitHub wrapping default
|
|
36
|
+
- `input=GFM` Specify flavor of markdown (case sensitive)
|
|
37
|
+
- `math_engine=katex` Specify math engine (case senstitive)
|
|
38
|
+
- `maxOneScreenHigh` Wrap the output in a div with class maxOneScreenHigh
|
|
39
|
+
- `style='padding: 1em;'` Wrap the output in a div with this style
|
|
40
|
+
- `syntax_highlighter=rouge` Specify highligher (case sensitive)
|
|
41
|
+
|
|
42
|
+
Here they are all used together:
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
{% kramdown no_auto_ids hard_wrap maxOneScreenHigh table-container
|
|
46
|
+
input=GFM
|
|
47
|
+
math_engine=katex
|
|
48
|
+
syntax_highlighter=rouge %}
|
|
49
|
+
## Subheading here
|
|
50
|
+
|
|
51
|
+
- This is a perfectly good point
|
|
52
|
+
- YAP (yet another point)
|
|
53
|
+
|
|
54
|
+
{% href label='This link was generated by a Jekyll Support plugin.'
|
|
55
|
+
url='https://www.mslinn.com/jekyll_plugins' %}
|
|
56
|
+
{% endkramdown %}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The above example shows the
|
|
60
|
+
[`jekyll_href` tag plugin](https://www.mslinn.com/jekyll_plugins/jekyll_href.html)
|
|
61
|
+
being used within kramdown text, which was embedded in an HTML page.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Document Options
|
|
65
|
+
|
|
66
|
+
[Kramdown options can be specified in the content](https://kramdown.gettalong.org/options.html)
|
|
67
|
+
to some degree and with some fussing.
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
Add the following in any HTML file within a Jekyll project:
|
|
72
|
+
|
|
73
|
+
```html
|
|
74
|
+
{% kramdown %}
|
|
75
|
+
## Heading
|
|
76
|
+
|
|
77
|
+
Some text
|
|
78
|
+
|
|
79
|
+
- option 1
|
|
80
|
+
- option 2
|
|
81
|
+
{% endkramdown %}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Modify `_config.yaml` to set kramdown options:
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
kramdown:
|
|
88
|
+
input: GFM
|
|
89
|
+
hard_wrap: false
|
|
90
|
+
markdown: kramdown
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
After checking out this git repository, install dependencies by typing:
|
|
97
|
+
|
|
98
|
+
```shell
|
|
99
|
+
$ bin/setup
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
You should do the above before running Visual Studio Code.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Run the Tests
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
$ bundle exec rake test
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Interactive Session
|
|
113
|
+
|
|
114
|
+
The following will allow you to experiment:
|
|
115
|
+
|
|
116
|
+
```shell
|
|
117
|
+
$ bin/console
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Local Installation
|
|
122
|
+
|
|
123
|
+
To install this gem onto your local machine, type:
|
|
124
|
+
|
|
125
|
+
```shell
|
|
126
|
+
$ bundle exec rake install
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### To Release A New Version
|
|
131
|
+
|
|
132
|
+
To create a git tag for the new version, push git commits and tags,
|
|
133
|
+
and push the new version of the gem to the Gem server, type:
|
|
134
|
+
|
|
135
|
+
```shell
|
|
136
|
+
$ bundle exec rake release
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
Bug reports and pull requests are welcome at https://github.com/mlinn/jekyll_kramdown.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
## License
|
|
146
|
+
|
|
147
|
+
The gem is available as open source under the terms of the [MIT
|
|
148
|
+
License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
|
2
|
+
require 'rake/testtask'
|
|
3
|
+
|
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
|
5
|
+
t.libs << 'test'
|
|
6
|
+
t.libs << 'lib'
|
|
7
|
+
t.test_files = FileList['test/**/*_test.rb']
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
desc 'Bump patch version'
|
|
11
|
+
task :patch do
|
|
12
|
+
system 'gem bump --tag'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
desc 'Bump minor version'
|
|
16
|
+
task :minor do
|
|
17
|
+
system 'gem bump --version minor --tag'
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc 'Bump major version'
|
|
21
|
+
task :major do
|
|
22
|
+
system 'gem bump --version major --tag'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
task publish: [:build] do
|
|
26
|
+
$VERBOSE = nil
|
|
27
|
+
load 'jekyll_kramdown/version.rb'
|
|
28
|
+
system "gem push pkg/jekyll_kramdown-#{JekyllKramdown::VERSION}.gem"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
desc 'Bump patch version, create git tag, build the gem and release to geminabox (default)'
|
|
32
|
+
task release_patch: %i[test patch publish]
|
|
33
|
+
|
|
34
|
+
desc 'Bump minor version, create git tag, build the gem and release to geminabox'
|
|
35
|
+
task release_minor: %i[test minor publish]
|
|
36
|
+
|
|
37
|
+
desc 'Bump major version, create git tag, build the gem and release to geminabox'
|
|
38
|
+
task release_major: %i[test major publish]
|
|
39
|
+
|
|
40
|
+
task default: :test
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require_relative 'lib/jekyll_kramdown/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
host = 'https://github.com/mslinn/jekyll_kramdown'
|
|
5
|
+
|
|
6
|
+
spec.authors = ['Mike Slinn']
|
|
7
|
+
spec.description = <<~END_DESC
|
|
8
|
+
Write a longer description of the gem.
|
|
9
|
+
Use as many lines as you like.
|
|
10
|
+
END_DESC
|
|
11
|
+
spec.email = ['mslinn@mslinn.com']
|
|
12
|
+
spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
|
|
13
|
+
spec.homepage = host
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
spec.metadata = {
|
|
16
|
+
'allowed_push_host' => 'https://rubygems.org',
|
|
17
|
+
'bug_tracker_uri' => "#{host}/issues",
|
|
18
|
+
'changelog_uri' => "#{host}/CHANGELOG.md",
|
|
19
|
+
'homepage_uri' => spec.homepage,
|
|
20
|
+
'source_code_uri' => host,
|
|
21
|
+
}
|
|
22
|
+
spec.name = 'jekyll_kramdown'
|
|
23
|
+
spec.platform = Gem::Platform::RUBY
|
|
24
|
+
spec.post_install_message = <<~END_MESSAGE
|
|
25
|
+
|
|
26
|
+
Thanks for installing #{spec.name}!
|
|
27
|
+
|
|
28
|
+
END_MESSAGE
|
|
29
|
+
spec.require_paths = ['lib']
|
|
30
|
+
spec.required_ruby_version = '>= 3.1.0'
|
|
31
|
+
spec.summary = 'Write summary of what the gem is for'
|
|
32
|
+
spec.version = JekyllKramdown::VERSION
|
|
33
|
+
|
|
34
|
+
spec.add_dependency 'jekyll', '>= 4.4.0'
|
|
35
|
+
spec.add_dependency 'jekyll_draft'
|
|
36
|
+
spec.add_dependency 'jekyll_plugin_support', '>= 3.1.1'
|
|
37
|
+
spec.add_dependency 'kramdown'
|
|
38
|
+
spec.add_dependency 'kramdown-math-katex'
|
|
39
|
+
spec.add_dependency 'kramdown-parser-gfm'
|
|
40
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# See https://mslinn.com/jekyll/10700-designing-for-testability.html
|
|
2
|
+
module JekyllKramdownModule
|
|
3
|
+
def self.markdownify(
|
|
4
|
+
markdown_text,
|
|
5
|
+
auto_ids: true,
|
|
6
|
+
hard_wrap: false,
|
|
7
|
+
input: 'GFM',
|
|
8
|
+
math_engine: 'katex',
|
|
9
|
+
syntax_highlighter: nil
|
|
10
|
+
)
|
|
11
|
+
require 'kramdown'
|
|
12
|
+
require 'kramdown-parser-gfm'
|
|
13
|
+
require 'kramdown-math-katex'
|
|
14
|
+
|
|
15
|
+
Kramdown::Document.new(
|
|
16
|
+
markdown_text,
|
|
17
|
+
auto_ids: auto_ids,
|
|
18
|
+
hard_wrap: hard_wrap,
|
|
19
|
+
input: input,
|
|
20
|
+
math_engine: math_engine,
|
|
21
|
+
syntax_highlighter: syntax_highlighter
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
require 'jekyll'
|
|
2
|
+
require 'jekyll_plugin_support'
|
|
3
|
+
require 'helper/jekyll_plugin_helper'
|
|
4
|
+
require_relative 'jekyll_kramdown_module'
|
|
5
|
+
require_relative 'jekyll_kramdown/version'
|
|
6
|
+
|
|
7
|
+
# See https://www.mslinn.com/jekyll/10200-jekyll-plugin-background.html
|
|
8
|
+
# See https://www.mslinn.com/jekyll/10400-jekyll-plugin-template-collection.html
|
|
9
|
+
#
|
|
10
|
+
# @example Heading for this example
|
|
11
|
+
# {% kramdown %}
|
|
12
|
+
# Content here
|
|
13
|
+
# {% endkramdown %}
|
|
14
|
+
#
|
|
15
|
+
# The Jekyll log level defaults to :info, which means all the Jekyll.logger statements below will not generate output.
|
|
16
|
+
# You can control the log level when you start Jekyll.
|
|
17
|
+
# To set the log level to :debug, write an entry into _config.yml, like this:
|
|
18
|
+
# plugin_loggers:
|
|
19
|
+
# Kramdown: debug
|
|
20
|
+
#
|
|
21
|
+
module JekyllKramdown
|
|
22
|
+
JekyllKramdownError = ::JekyllSupport.define_error unless const_defined?(:JekyllKramdownError)
|
|
23
|
+
|
|
24
|
+
PLUGIN_NAME = 'kramdown'.freeze unless defined? PLUGIN_NAME
|
|
25
|
+
|
|
26
|
+
# This class implements the Jekyll block tag functionality
|
|
27
|
+
class Kramdown < JekyllSupport::JekyllBlock
|
|
28
|
+
# Defines class methods, see https://mslinn.com/jekyll/10700-designing-for-testability.html:
|
|
29
|
+
extend JekyllKramdownModule
|
|
30
|
+
|
|
31
|
+
VERSION = JekyllKramdown::VERSION
|
|
32
|
+
|
|
33
|
+
# @return [string] markup to be rendered on web page
|
|
34
|
+
def render_impl(content)
|
|
35
|
+
@klass = @helper.parameter_specified?('class')
|
|
36
|
+
@no_auto_ids = @helper.parameter_specified?('no_auto_ids') || false
|
|
37
|
+
@hard_wrap = @helper.parameter_specified?('hard_wrap') || false
|
|
38
|
+
@input = @helper.parameter_specified?('input') || 'GFM'
|
|
39
|
+
@math_engine = @helper.parameter_specified?('math_engine') || 'katex'
|
|
40
|
+
@maxOneScreenHigh = @helper.parameter_specified?('maxOneScreenHigh')
|
|
41
|
+
@style = @helper.parameter_specified?('style')
|
|
42
|
+
@syntax_highlighter = @helper.parameter_specified?('syntax_highlighter')
|
|
43
|
+
|
|
44
|
+
kramdown_doc = JekyllKramdownModule.markdownify(
|
|
45
|
+
content,
|
|
46
|
+
auto_ids: !@no_auto_ids,
|
|
47
|
+
hard_wrap: @hard_wrap,
|
|
48
|
+
input: @input,
|
|
49
|
+
math_engine: @math_engine,
|
|
50
|
+
syntax_highlighter: @syntax_highlighter
|
|
51
|
+
)
|
|
52
|
+
html = kramdown_doc.to_html
|
|
53
|
+
@klass = " class='#{@klass}'" if @klass
|
|
54
|
+
@style = " style='#{@style}'" if @style
|
|
55
|
+
if @maxOneScreenHigh
|
|
56
|
+
"<div#{@klass}#{@style}><div class='maxOneScreenHigh'>#{html}</div></div>"
|
|
57
|
+
else
|
|
58
|
+
@klass || @style ? "<div#{@klass}#{@style}>#{html}</div>" : html
|
|
59
|
+
end
|
|
60
|
+
rescue StandardError => e
|
|
61
|
+
@logger.error { "#{self.class} died with a #{e.full_message}" }
|
|
62
|
+
exit 3
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
::JekyllSupport::JekyllPluginHelper.register(self, PLUGIN_NAME)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require_relative '../lib/jekyll_kramdown'
|
|
3
|
+
|
|
4
|
+
RSpec.describe JekyllKramdownModule do
|
|
5
|
+
extend described_class # Define class methods from JekyllKramdownModule
|
|
6
|
+
|
|
7
|
+
let(:logger) do
|
|
8
|
+
PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
let(:parse_context) { TestParseContext.new } # Mock, may not be desired
|
|
12
|
+
|
|
13
|
+
it 'has a test' do
|
|
14
|
+
expect(true).to be_true
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'rspec/expectations'
|
|
2
|
+
require 'rspec/match_ignoring_whitespace'
|
|
3
|
+
|
|
4
|
+
require_relative 'spec_helper'
|
|
5
|
+
require_relative '../lib/jekyll_kramdown'
|
|
6
|
+
|
|
7
|
+
class JekyllKramdownTest
|
|
8
|
+
RSpec.describe JekyllKramdown do
|
|
9
|
+
it 'tests does something' do
|
|
10
|
+
actual = 1
|
|
11
|
+
expected = 1
|
|
12
|
+
expect(actual).to eq(expected)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require 'jekyll'
|
|
2
|
+
require 'jekyll_plugin_logger'
|
|
3
|
+
require 'liquid'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'yaml'
|
|
6
|
+
require_relative '../lib/jekyll_kramdown'
|
|
7
|
+
|
|
8
|
+
RSpec.configure do |config|
|
|
9
|
+
config.filter_run :focus
|
|
10
|
+
# config.order = 'random'
|
|
11
|
+
config.run_all_when_everything_filtered = true
|
|
12
|
+
config.filter_run_when_matching focus: true
|
|
13
|
+
|
|
14
|
+
# See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
|
|
15
|
+
config.example_status_persistence_file_path = '../spec/status_persistence.txt'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# None of the following is required if mocking Jekyll internal data structures is not required
|
|
20
|
+
|
|
21
|
+
Registers = Struct.new(:page, :site)
|
|
22
|
+
|
|
23
|
+
# Mock for Collections
|
|
24
|
+
class Collections
|
|
25
|
+
def values
|
|
26
|
+
[]
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Mock for Site
|
|
31
|
+
class SiteMock
|
|
32
|
+
attr_reader :config
|
|
33
|
+
|
|
34
|
+
def initialize
|
|
35
|
+
@config = YAML.safe_load_file(File.read('../demo/_config.yml'))
|
|
36
|
+
@config['env'] = { 'JEKYLL_ENV' => 'development' }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def collections
|
|
40
|
+
Collections.new
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
class TestLiquidContext < Liquid::Context
|
|
45
|
+
def initialize
|
|
46
|
+
super
|
|
47
|
+
|
|
48
|
+
page = {
|
|
49
|
+
'content' => 'blah blah',
|
|
50
|
+
'description' => 'Jekyll plugin support demo',
|
|
51
|
+
'dir' => '/',
|
|
52
|
+
'excerpt' => nil,
|
|
53
|
+
'layout' => 'default',
|
|
54
|
+
'name' => 'index.html',
|
|
55
|
+
'path' => 'index.html',
|
|
56
|
+
'title' => 'Welcome',
|
|
57
|
+
'url' => '/',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@content = 'Interior of the tag'
|
|
61
|
+
@registers = Registers.new(
|
|
62
|
+
page,
|
|
63
|
+
SiteMock.new
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Mock for Liquid::ParseContent
|
|
69
|
+
class TestParseContext < Liquid::ParseContext
|
|
70
|
+
attr_reader :line_number, :registers
|
|
71
|
+
|
|
72
|
+
def initialize
|
|
73
|
+
super
|
|
74
|
+
@line_number = 123
|
|
75
|
+
|
|
76
|
+
@registers = Registers.new(
|
|
77
|
+
{ 'path' => 'path/to/page.html' },
|
|
78
|
+
SiteMock.new
|
|
79
|
+
)
|
|
80
|
+
end
|
|
81
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jekyll_kramdown
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Mike Slinn
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: jekyll
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 4.4.0
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 4.4.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: jekyll_draft
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: jekyll_plugin_support
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 3.1.1
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 3.1.1
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: kramdown
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: kramdown-math-katex
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: kramdown-parser-gfm
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
description: |
|
|
97
|
+
Write a longer description of the gem.
|
|
98
|
+
Use as many lines as you like.
|
|
99
|
+
email:
|
|
100
|
+
- mslinn@mslinn.com
|
|
101
|
+
executables: []
|
|
102
|
+
extensions: []
|
|
103
|
+
extra_rdoc_files: []
|
|
104
|
+
files:
|
|
105
|
+
- ".rubocop.yml"
|
|
106
|
+
- CHANGELOG.md
|
|
107
|
+
- README.md
|
|
108
|
+
- Rakefile
|
|
109
|
+
- jekyll_kramdown.gemspec
|
|
110
|
+
- lib/jekyll_kramdown.rb
|
|
111
|
+
- lib/jekyll_kramdown/version.rb
|
|
112
|
+
- lib/jekyll_kramdown_module.rb
|
|
113
|
+
- lib/kramdown_class.rb
|
|
114
|
+
- spec/jekyll_kramdown/jekyll_kramdown_module_spec.rb
|
|
115
|
+
- spec/jekyll_kramdown_spec.rb
|
|
116
|
+
- spec/spec_helper.rb
|
|
117
|
+
homepage: https://github.com/mslinn/jekyll_kramdown
|
|
118
|
+
licenses:
|
|
119
|
+
- MIT
|
|
120
|
+
metadata:
|
|
121
|
+
allowed_push_host: https://rubygems.org
|
|
122
|
+
bug_tracker_uri: https://github.com/mslinn/jekyll_kramdown/issues
|
|
123
|
+
changelog_uri: https://github.com/mslinn/jekyll_kramdown/CHANGELOG.md
|
|
124
|
+
homepage_uri: https://github.com/mslinn/jekyll_kramdown
|
|
125
|
+
source_code_uri: https://github.com/mslinn/jekyll_kramdown
|
|
126
|
+
post_install_message: |2+
|
|
127
|
+
|
|
128
|
+
Thanks for installing jekyll_kramdown!
|
|
129
|
+
|
|
130
|
+
rdoc_options: []
|
|
131
|
+
require_paths:
|
|
132
|
+
- lib
|
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
|
+
requirements:
|
|
135
|
+
- - ">="
|
|
136
|
+
- !ruby/object:Gem::Version
|
|
137
|
+
version: 3.1.0
|
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
|
+
requirements:
|
|
140
|
+
- - ">="
|
|
141
|
+
- !ruby/object:Gem::Version
|
|
142
|
+
version: '0'
|
|
143
|
+
requirements: []
|
|
144
|
+
rubygems_version: 4.0.2
|
|
145
|
+
specification_version: 4
|
|
146
|
+
summary: Write summary of what the gem is for
|
|
147
|
+
test_files: []
|
|
148
|
+
...
|