jekyll_outline 1.0.0 → 1.0.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
  SHA256:
3
- metadata.gz: b4d559d814621351a2af4cb4100c83f375de62f7c66c5d21efbe60e651df1564
4
- data.tar.gz: f97c2a34d62012e1b43ea6c70980747376830f72165dd254533c7a142ac2fd5f
3
+ metadata.gz: ed799d887e818fc21f0892c7c7fe550081352b98554bc4dae0fc8d6fb04b0a90
4
+ data.tar.gz: ae4fd7f8a48d45abcabad5207566a8f96d0fe8b14e0016b294f54c9ba576f7fc
5
5
  SHA512:
6
- metadata.gz: 1c2056fc66da354151c7676d66e16f07de1ba445d45e88f665a32496587d5985e8a2dea33577d1d8f65dba2559d4bced9468166779214067f1ceb95f53625bcb
7
- data.tar.gz: b923a57ea06fac9460ceb273f26fb49e441579146446b50aabbaf91dfc51cc8e6690b94a4e853fe9b4654907a9dd1d02b35757666833e51f2a6e3f89220ce0f2
6
+ metadata.gz: ac864827baf9f274f85d9f52c84e38216bd8edd6ebd86be766b8002d966050cdc14e8f966bf905edbd7362386620bc012d7f66fd18c86c74eabafb564bdc8a04
7
+ data.tar.gz: cc3cfd1e248224f34b242aa501a8cdf12f8d86dd26f46b09449f22505f4a33e6840892bccd875defcf558ae8822af68085751808318a9c2cb823eee35342438f
data/.rubocop.yml CHANGED
@@ -1,17 +1,48 @@
1
- require: rubocop-jekyll
2
- inherit_gem:
3
- rubocop-jekyll: .rubocop.yml
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rake
4
4
 
5
5
  AllCops:
6
6
  Exclude:
7
- - vendor/**/*
8
- - Gemfile*
9
- - '*.gemspec' # This does nothing. Why?
7
+ - exe/**/*
8
+ - vendor/**/*
9
+ - Gemfile*
10
10
  NewCops: enable
11
11
  TargetRubyVersion: 2.6
12
12
 
13
+ Gemspec/DeprecatedAttributeAssignment:
14
+ Enabled: false
15
+
16
+ Gemspec/RequireMFA:
17
+ Enabled: false
18
+
19
+ Layout/HashAlignment:
20
+ Enabled: false
21
+
13
22
  Layout/LineLength:
14
23
  Max: 150
15
24
 
16
- # Gemspec/RequireMFA:
17
- # enable: false
25
+ Metrics/BlockLength:
26
+ Exclude:
27
+ - jekyll_outline.gemspec
28
+ Max: 30
29
+
30
+ Metrics/MethodLength:
31
+ Max: 30
32
+
33
+ Naming/FileName:
34
+ Exclude:
35
+ - Rakefile
36
+
37
+ Style/Documentation:
38
+ Enabled: false
39
+
40
+ Style/FrozenStringLiteralComment:
41
+ Enabled: false
42
+
43
+ Style/TrailingCommaInHashLiteral:
44
+ EnforcedStyleForMultiline: comma
45
+
46
+ RSpec/FilePath:
47
+ IgnoreMethods: true
48
+ SpecSuffixOnly: true
data/CHANGELOG.md CHANGED
@@ -1,2 +1,8 @@
1
+ ## 1.0.2 / 2023-02-16
2
+ * Updated to `jekyll_plugin_support` v0.5.0
3
+
4
+ ## 1.0.1 / 2023-02-14
5
+ * Now dependent upon `jekyll_plugin_support`
6
+
1
7
  ## 1.0.0 / 2022-04-02
2
8
  * Initial version
data/README.md CHANGED
@@ -17,19 +17,16 @@ And then execute:
17
17
 
18
18
  $ bundle install
19
19
 
20
- Or install it yourself as:
21
-
22
- $ gem install jekyll_outline
23
-
24
20
 
25
21
  ## Additional Information
26
22
  More information is available on
27
- [Mike Slinn’s website](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
23
+ [Mike Slinn’s website](https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#outline).
28
24
 
29
25
 
30
26
  ## Development
31
27
 
32
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ After checking out the repo, run `bin/setup` to install dependencies.
29
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
33
30
 
34
31
  Install development dependencies like this:
35
32
  ```
@@ -39,14 +36,14 @@ $ BUNDLE_WITH="development" bundle install
39
36
  To build and install this gem onto your local machine, run:
40
37
  ```shell
41
38
  $ bundle exec rake install
42
- jekyll_outline 1.0.0 built to pkg/jekyll_outline-0.1.0.gem.
43
- jekyll_outline (1.0.0) installed.
39
+ jekyll_outline 0.1.0 built to pkg/jekyll_outline-0.1.0.gem.
40
+ jekyll_outline (0.1.0) installed.
44
41
 
45
42
  $ gem info jekyll_outline
46
43
 
47
44
  *** LOCAL GEMS ***
48
45
 
49
- jekyll_outline (1.0.0)
46
+ jekyll_outline (0.1.0)
50
47
  Author: Mike Slinn
51
48
  Homepage:
52
49
  https://github.com/mslinn/jekyll_outline
@@ -56,10 +53,27 @@ jekyll_outline (1.0.0)
56
53
  Generates Jekyll logger with colored output.
57
54
  ```
58
55
 
56
+
57
+ ## Test
58
+ A test website is provided in the `demo` directory.
59
+ 1. Set breakpoints.
60
+
61
+ 2. Initiate a debug session from the command line:
62
+ ```shell
63
+ $ bin/attach demo
64
+ ```
65
+
66
+ 3. Once the `Fast Debugger` signon appears, launch the Visual Studio Code launch configuration called `Attach rdebug-ide`.
67
+
68
+ 4. View the generated website at [`http://localhost:4444`](http://localhost:4444)
69
+
70
+
71
+ ## Release
59
72
  To release a new version,
60
73
  1. Update the version number in `version.rb`.
61
- 2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
62
- 3. Run the following:
74
+ 2. Describe the changes in `CHANGELOG.md`.
75
+ 3. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
76
+ 4. Run the following:
63
77
  ```shell
64
78
  $ bundle exec rake release
65
79
  ```
data/Rakefile CHANGED
@@ -1,7 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
5
3
 
6
4
  RSpec::Core::RakeTask.new(:spec)
7
- task :default => :spec
5
+ task default: :spec
@@ -0,0 +1,37 @@
1
+ require_relative 'lib/jekyll_outline/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ github = 'https://github.com/mslinn/jekyll_outline'
5
+
6
+ spec.authors = ['Mike Slinn']
7
+ spec.bindir = 'exe'
8
+ spec.description = <<~END_OF_DESC
9
+ Jekyll tag plugin that creates a clickable table of contents.
10
+ END_OF_DESC
11
+ spec.email = ['mslinn@mslinn.com']
12
+ spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
13
+ spec.homepage = 'https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#outline'
14
+ spec.license = 'MIT'
15
+ spec.metadata = {
16
+ 'allowed_push_host' => 'https://rubygems.org',
17
+ 'bug_tracker_uri' => "#{github}/issues",
18
+ 'changelog_uri' => "#{github}/CHANGELOG.md",
19
+ 'homepage_uri' => spec.homepage,
20
+ 'source_code_uri' => github,
21
+ }
22
+ spec.name = 'jekyll_outline'
23
+ spec.post_install_message = <<~END_MESSAGE
24
+
25
+ Thanks for installing #{spec.name}!
26
+
27
+ END_MESSAGE
28
+ spec.require_paths = ['lib']
29
+ spec.required_ruby_version = '>= 2.6.0'
30
+ spec.summary = 'Jekyll tag plugin that creates a clickable table of contents.'
31
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
32
+ spec.version = JekyllOutlineVersion::VERSION
33
+
34
+ spec.add_dependency 'jekyll', '>= 3.5.0'
35
+ spec.add_dependency 'jekyll_draft', '~> 1.1.1'
36
+ spec.add_dependency 'jekyll_plugin_support', '~> 0.5.0'
37
+ end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module JekyllOutlineVersion
4
- VERSION = "1.0.0"
2
+ VERSION = '1.0.1'.freeze
5
3
  end
@@ -1,13 +1,12 @@
1
- # frozen_string_literal: true
2
-
3
1
  # @author Copyright 2022 {https://www.mslinn.com Michael Slinn}
4
2
 
5
- require "jekyll_draft"
6
- require "jekyll_plugin_logger"
3
+ require 'jekyll_draft'
4
+ require 'jekyll_plugin_logger'
5
+ require 'jekyll_plugin_support'
7
6
  require 'yaml'
8
7
 
9
8
  module Outline
10
- PLUGIN_NAME = "outline"
9
+ PLUGIN_NAME = 'outline'.freeze
11
10
 
12
11
  # Interleaves with docs
13
12
  class Header
@@ -26,32 +25,16 @@ module Outline
26
25
  end
27
26
  end
28
27
 
29
- # Makes outlines for Jekyll pages
30
- class OutlineTag < Liquid::Block
31
- FIXNUM_MAX = 2**(0.size * 8 - 2) - 1
32
-
33
- # Called by Jekyll only once to register the tag.
34
- # @param tag_name [String] is the name of the tag, which we already know.
35
- # @param argument_string [String] the arguments from the web page.
36
- # @param _parse_context [Liquid::ParseContext] hash that stores Liquid options.
37
- # By default it has two keys: :locale and :line_numbers, the first is a Liquid::I18n object, and the second,
38
- # a boolean parameter that determines if error messages should display the line number the error occurred.
39
- # This argument is used mostly to display localized error messages on Liquid built-in Tags and Filters.
40
- # See https://github.com/Shopify/liquid/wiki/Liquid-for-Programmers#create-your-own-tags
41
- # @return [void]
42
- def initialize(tag_name, argument_string, _parse_context)
43
- super
44
- @logger = PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
28
+ class OutlineTag < JekyllSupport::JekyllBlock
29
+ include JekyllOutlineVersion
30
+
31
+ FIXNUM_MAX = (2**((0.size * 8) - 2)) - 1
32
+
33
+ def render_impl(text)
45
34
  @collection_name = argument_string.strip
46
- abort "OutlineTag: collection_name was not specified" unless @collection_name
47
- end
35
+ abort 'OutlineTag: collection_name was not specified' unless @collection_name
48
36
 
49
- # Method prescribed by the Jekyll plugin lifecycle.
50
- # @param liquid_context [Liquid::Context]
51
- # @return [String]
52
- def render(liquid_context)
53
37
  headers = make_headers(super) # Process the block content.
54
- @site = liquid_context.registers[:site]
55
38
  collection = headers + obtain_docs(@collection_name)
56
39
  <<~HEREDOC
57
40
  <div class="posts">
@@ -71,7 +54,7 @@ module Outline
71
54
  yaml.map { |entry| Header.new entry }
72
55
  end
73
56
 
74
- def make_entries(collection) # rubocop:disable Metrics/MethodLength
57
+ def make_entries(collection)
75
58
  sorted = collection.sort_by(&obtain_order)
76
59
  pruned = remove_empty_headers(sorted)
77
60
  pruned.map do |entry|
@@ -95,7 +78,7 @@ module Outline
95
78
  @site
96
79
  .collections[collection_name]
97
80
  .docs
98
- .reject { |doc| doc.path.end_with? "index.html" }
81
+ .reject { |doc| doc.path.end_with? 'index.html' }
99
82
  end
100
83
 
101
84
  # Sort entries without an order property at the end
@@ -118,14 +101,11 @@ module Outline
118
101
  i += 1
119
102
  end
120
103
  end
121
- if header?(array.last)
122
- array.delete_at(array.length - 1)
123
- end
104
+
105
+ array.delete_at(array.length - 1) if header?(array.last)
124
106
  array
125
107
  end
108
+
109
+ JekyllPluginHelper.register(self, PLUGIN_NAME)
126
110
  end
127
111
  end
128
-
129
- # PluginMetaLogger.instance.info { "Loaded #{JekyllPluginTagTemplate::PLUGIN_NAME} v#{JekyllPluginTemplateVersion::VERSION} plugin." }
130
- PluginMetaLogger.instance.info { "Loaded Outline plugin." }
131
- Liquid::Template.register_tag(Outline::PLUGIN_NAME, Outline::OutlineTag)
@@ -0,0 +1,13 @@
1
+ require 'jekyll'
2
+ require_relative '../lib/jekyll_outline'
3
+
4
+ RSpec.describe(Outline) do
5
+ include Jekyll
6
+
7
+ it 'is created properly' do
8
+ pending 'This is just a placeholder'
9
+ run_tag = RunTag.new('run', 'echo asdf')
10
+ output = run_tag.render(context)
11
+ expect(output).to eq('asdf')
12
+ end
13
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,11 @@
1
- # frozen_string_literal: true
2
-
3
- require "jekyll"
4
- require_relative "../lib/jekyll_outline"
1
+ require 'jekyll'
2
+ require_relative '../lib/jekyll_outline'
5
3
 
6
4
  RSpec.configure do |config|
7
5
  config.filter_run :focus
8
- config.order = "random"
6
+ config.order = 'random'
9
7
  config.run_all_when_everything_filtered = true
10
8
 
11
9
  # See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
12
- config.example_status_persistence_file_path = "spec/status_persistence.txt"
10
+ config.example_status_persistence_file_path = 'spec/status_persistence.txt'
13
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_outline
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-03 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -28,30 +28,30 @@ dependencies:
28
28
  name: jekyll_draft
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.1.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.1.1
41
41
  - !ruby/object:Gem::Dependency
42
- name: jekyll_plugin_logger
42
+ name: jekyll_plugin_support
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.5.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.5.0
55
55
  description: 'Jekyll tag plugin that creates a clickable table of contents.
56
56
 
57
57
  '
@@ -66,20 +66,19 @@ files:
66
66
  - LICENSE.txt
67
67
  - README.md
68
68
  - Rakefile
69
- - jekyll_run.gemspec
69
+ - jekyll_outline.gemspec
70
70
  - lib/jekyll_outline.rb
71
71
  - lib/jekyll_outline/version.rb
72
- - spec/jekyll_outline_spec.rb
72
+ - spec/outline_spec.rb
73
73
  - spec/spec_helper.rb
74
- - spec/status_persistence.txt
75
- homepage: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#run
74
+ homepage: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#outline
76
75
  licenses:
77
76
  - MIT
78
77
  metadata:
79
78
  allowed_push_host: https://rubygems.org
80
79
  bug_tracker_uri: https://github.com/mslinn/jekyll_outline/issues
81
80
  changelog_uri: https://github.com/mslinn/jekyll_outline/CHANGELOG.md
82
- homepage_uri: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#run
81
+ homepage_uri: https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#outline
83
82
  source_code_uri: https://github.com/mslinn/jekyll_outline
84
83
  post_install_message: |2+
85
84
 
@@ -104,7 +103,6 @@ signing_key:
104
103
  specification_version: 4
105
104
  summary: Jekyll tag plugin that creates a clickable table of contents.
106
105
  test_files:
107
- - spec/jekyll_outline_spec.rb
106
+ - spec/outline_spec.rb
108
107
  - spec/spec_helper.rb
109
- - spec/status_persistence.txt
110
108
  ...
data/jekyll_run.gemspec DELETED
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/jekyll_outline/version"
4
-
5
- # rubocop:disable Metrics/BlockLength
6
- Gem::Specification.new do |spec|
7
- github = "https://github.com/mslinn/jekyll_outline"
8
-
9
- spec.authors = ["Mike Slinn"]
10
- spec.bindir = "exe"
11
- spec.description = <<~END_OF_DESC
12
- Jekyll tag plugin that creates a clickable table of contents.
13
- END_OF_DESC
14
- spec.email = ["mslinn@mslinn.com"]
15
- spec.files = Dir[".rubocop.yml", "LICENSE.*", "Rakefile", "{lib,spec}/**/*", "*.gemspec", "*.md"]
16
- spec.homepage = "https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html#run"
17
- spec.license = "MIT"
18
- spec.metadata = {
19
- "allowed_push_host" => "https://rubygems.org",
20
- "bug_tracker_uri" => "#{github}/issues",
21
- "changelog_uri" => "#{github}/CHANGELOG.md",
22
- "homepage_uri" => spec.homepage,
23
- "source_code_uri" => github,
24
- }
25
- spec.name = "jekyll_outline"
26
- spec.post_install_message = <<~END_MESSAGE
27
-
28
- Thanks for installing #{spec.name}!
29
-
30
- END_MESSAGE
31
- spec.require_paths = ["lib"]
32
- spec.required_ruby_version = ">= 2.6.0"
33
- spec.summary = "Jekyll tag plugin that creates a clickable table of contents."
34
- spec.test_files = spec.files.grep(%r!^(test|spec|features)/!)
35
- spec.version = JekyllOutlineVersion::VERSION
36
-
37
- spec.add_dependency "jekyll", ">= 3.5.0"
38
- spec.add_dependency "jekyll_draft"
39
- spec.add_dependency "jekyll_plugin_logger"
40
-
41
- # spec.add_development_dependency "debase"
42
- # spec.add_development_dependency "rubocop-jekyll"
43
- # spec.add_development_dependency "rake"
44
- # spec.add_development_dependency "rubocop-rake"
45
- # spec.add_development_dependency "rubocop-rspec"
46
- # spec.add_development_dependency "ruby-debug-ide"
47
- end
48
- # rubocop:enable Metrics/BlockLength
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "jekyll"
4
- require_relative "../lib/jekyll_outline"
5
-
6
- RSpec.describe(Jekyll) do
7
- include Jekyll
8
-
9
- it "is created properly" do
10
- # run_tag = RunTag.new("run", "echo asdf")
11
- # output = run_tag.render(context)
12
- # expect(output).to eq("asdf")
13
- end
14
- end
@@ -1,3 +0,0 @@
1
- example_id | status | run_time |
2
- ---------------------------------- | ------ | --------------- |
3
- ./spec/jekyll_outline_spec.rb[1:1] | passed | 0.00023 seconds |