jekyll_todo 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3e30a9fe9e16fbadf014b44dd753d3e316a9a37144428fe0b84078869ca99ca3
4
+ data.tar.gz: '019eeae995cff67e6b3325a06febc188535c1eddaa0dc4d4a6d55c689f4e2f2b'
5
+ SHA512:
6
+ metadata.gz: 627ed50f1bd935f268c3eab173df0ece8ce98726fd1cc721c6c6b0fb390817568a6f2f6fa2aa98b3571a26d26705f111c18205769731527cba2a9f6a1dac6eb2
7
+ data.tar.gz: a28bcdb4bbb27b84a9de6739a0f178b1b08bd9c51d95a76528eaef237e6c787f509b910f034a076a09bc8c092f9ad1714736856d99751891c6b69bbf4e7f9ef9
data/.rubocop.yml ADDED
@@ -0,0 +1,69 @@
1
+ require:
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
+ Metrics/AbcSize:
30
+ Max: 35
31
+
32
+ Metrics/BlockLength:
33
+ Exclude:
34
+ - jekyll_todo.gemspec
35
+ Max: 30
36
+
37
+ Metrics/CyclomaticComplexity:
38
+ Max: 15
39
+
40
+ Metrics/MethodLength:
41
+ Max: 40
42
+
43
+ Metrics/ModuleLength:
44
+ Enabled: false
45
+
46
+ Metrics/PerceivedComplexity:
47
+ Max: 15
48
+
49
+ Naming/FileName:
50
+ Exclude:
51
+ - Rakefile
52
+
53
+ Style/Documentation:
54
+ Enabled: false
55
+
56
+ Style/FrozenStringLiteralComment:
57
+ Enabled: false
58
+
59
+ Style/TrailingCommaInHashLiteral:
60
+ EnforcedStyleForMultiline: comma
61
+
62
+ RSpec/SpecFilePathFormat:
63
+ IgnoreMethods: true
64
+
65
+ RSpec/ExampleLength:
66
+ Max: 30
67
+
68
+ RSpec/MultipleExpectations:
69
+ Max: 15
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Change Log
2
+
3
+ ## 0.1.0 / 2025-07-16
4
+
5
+ * Initial release.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # `Jekyll_todo` [![Gem Version](https://badge.fury.io/rb/jekyll_todo.svg)](https://badge.fury.io/rb/jekyll_todo)
2
+
3
+ Generates a TODO block.
4
+
5
+ ## Options
6
+
7
+ * `alert` - Apply the `alert` class to the generated HTML wrapper
8
+ * `block` - Apply `display: block` to the generated HTML wrapper
9
+ * `class` - Apply the given class to the generated HTML wrapper
10
+ * `id` - Apply the given HTML id attribute to the generated HTML wrapper
11
+ * `span` - Apply `display: inline` to the generated HTML wrapper
12
+ * `style` - Apply the given CSS style to the generated HTML wrapper
13
+
14
+
15
+ ## Examples
16
+
17
+ ```html
18
+ {% todo %}
19
+ blah blah blah
20
+ {% endtodo %}
21
+ ```
22
+
23
+ Example:
24
+
25
+ ```html
26
+ {% todo id='todo1' %}
27
+ blah blah blah
28
+ {% endtodo %}
29
+ ```
30
+
31
+ See `demo/index.html` for more examples.
32
+
33
+
34
+ ## Installation
35
+
36
+ Add the following to your Jekyll website's `Gemfile`:
37
+
38
+ ```ruby
39
+ group :jekyll_plugins do
40
+ gem 'jekyll_todo'
41
+ end
42
+ ```
43
+
44
+ And then execute:
45
+
46
+ ```shell
47
+ $ bundle
48
+ ```
49
+
50
+
51
+ ## Usage
52
+
53
+ Describe how to use this gem
54
+
55
+
56
+ ## Development
57
+
58
+ After checking out this git repository, install dependencies by typing:
59
+
60
+ ```shell
61
+ $ bin/setup
62
+ ```
63
+
64
+ You should do the above before running Visual Studio Code.
65
+
66
+
67
+ ### Run the Tests
68
+
69
+ ```shell
70
+ $ bundle exec rake test
71
+ ```
72
+
73
+
74
+ ### Interactive Session
75
+
76
+ The following will allow you to experiment:
77
+
78
+ ```shell
79
+ $ bin/console
80
+ ```
81
+
82
+
83
+ ### Local Installation
84
+
85
+ To install this gem onto your local machine, type:
86
+
87
+ ```shell
88
+ $ bundle exec rake install
89
+ ```
90
+
91
+
92
+ ### To Release A New Version
93
+
94
+ To create a git tag for the new version, push git commits and tags,
95
+ and push the new version of the gem to https://rubygems.org, type:
96
+
97
+ ```shell
98
+ $ bundle exec rake release
99
+ ```
100
+
101
+
102
+ ## Contributing
103
+
104
+ Bug reports and pull requests are welcome at https://github.com/mslinn/jekyll_todo.
105
+
106
+
107
+ ## License
108
+
109
+ The gem is available as open source under the terms of the [MIT 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_todo/version.rb'
28
+ system "gem push pkg/jekyll_todo-#{JekyllToDo::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,35 @@
1
+ require_relative 'lib/jekyll_todo/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ host = 'https://github.com/mslinn/jekyll_todo'
5
+
6
+ spec.authors = ['Mike Slinn']
7
+ spec.description = <<~END_DESC
8
+ Generate a TODO block.
9
+ END_DESC
10
+ spec.email = ['mslinn@mslinn.com']
11
+ spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
12
+ spec.homepage = 'https://github.com/mslinn/jekyll_todo'
13
+ spec.license = 'MIT'
14
+ spec.metadata = {
15
+ 'allowed_push_host' => 'https://rubygems.org',
16
+ 'bug_tracker_uri' => "#{host}/issues",
17
+ 'changelog_uri' => "#{host}/CHANGELOG.md",
18
+ 'homepage_uri' => spec.homepage,
19
+ 'source_code_uri' => host,
20
+ }
21
+ spec.name = 'jekyll_todo'
22
+ spec.platform = Gem::Platform::RUBY
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 = '>= 3.1.0'
30
+ spec.summary = 'Generate a TODO block'
31
+ spec.version = JekyllToDo::VERSION
32
+ spec.add_dependency 'jekyll', '>= 3.5.0'
33
+ spec.add_dependency 'jekyll_draft'
34
+ spec.add_dependency 'jekyll_plugin_support', '>= 1.0.3'
35
+ end
@@ -0,0 +1,3 @@
1
+ module JekyllToDo
2
+ VERSION = '0.1.0'.freeze unless defined? VERSION
3
+ end
@@ -0,0 +1,10 @@
1
+ def require_directory(dir)
2
+ Dir[File.join(dir, '*.rb')]&.sort&.each do |file|
3
+ require file unless file == __FILE__
4
+ end
5
+ end
6
+
7
+ require 'jekyll'
8
+ require 'jekyll_plugin_logger'
9
+ require 'jekyll_plugin_support'
10
+ require_directory __dir__
@@ -0,0 +1,6 @@
1
+ # See https://mslinn.com/jekyll/10700-designing-for-testability.html
2
+ module JekyllToDoModule
3
+ def a_method
4
+ "a_method says #{msg}"
5
+ end
6
+ end
data/lib/todo.rb ADDED
@@ -0,0 +1,98 @@
1
+ require 'jekyll_plugin_support'
2
+ require 'helper/jekyll_plugin_helper'
3
+ require_relative 'jekyll_todo/version'
4
+
5
+ # Generate a TODO block
6
+ # Options:
7
+ # `id`
8
+ #
9
+ # @example
10
+ # {% todo %}
11
+ # blah blah blah
12
+ # {% endtodo %}
13
+ #
14
+ # @example
15
+ # {% todo id='todo1' %}
16
+ # blah blah blah
17
+ # {% endtodo %}
18
+ #
19
+ # The Jekyll log level defaults to :info, which means all the Jekyll.logger statements below will not generate output.
20
+ # You can control the log level when you start Jekyll.
21
+ # To set the log level to :debug, write an entery into _config.yml, like this:
22
+ # plugin_loggers:
23
+ # Todo: debug
24
+
25
+ module JekyllToDo
26
+ # This class implements the Jekyll functionality
27
+ class ToDo < JekyllSupport::JekyllBlock
28
+ # Defines class methods, see https://mslinn.com/jekyll/10700-designing-for-testability.html:
29
+ extend JekyllToDoModule
30
+
31
+ PLUGIN_NAME = 'todo'.freeze
32
+ VERSION = JekyllToDo::VERSION
33
+
34
+ # See https://github.com/mslinn/jekyll_plugin_support#argument-parsing
35
+ #
36
+ # The following variables are predefined:
37
+ # @argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site and @theme
38
+ # @tag_name [String] is the name of the tag, which we already know.
39
+ # @argument_string [String] the arguments from the web page.
40
+ # @tokens [Liquid::ParseContext] tokenized command line
41
+ #
42
+ # @helper provides these read-only attributes:
43
+ # argv, attribution, keys_values, liquid_context, logger, markup, no_arg_parsing, params, tag_name,
44
+ # argv_original, excerpt_caller, keys_values_original, params_original
45
+ # @helper provides these class methods:
46
+ # expand_env, register, remove_quotes
47
+ # @helper provides these instance methods:
48
+ # attribution_string
49
+ # default_attribution
50
+ # delete_parameter
51
+ # dereference_include_variable
52
+ # dereference_variable
53
+ # lookup_variable
54
+ # parameter_specified?('option/keyword name') || 'default value' # parse option value/keyword
55
+ # gem_file __FILE__ # Enables attribution
56
+ # remaining_markup # unparsed markup passed to this plugin
57
+ # reinitialize # Returns markup remaining after `parameter_specified?` has been invoked.
58
+ # remaining_markup_original
59
+ #
60
+ # @return [string] markup to be rendered on web page
61
+ def render_impl(content)
62
+ @alert = @helper.parameter_specified? 'alert'
63
+ @alert_option = ' alert' if @alert
64
+
65
+ @block = @helper.parameter_specified? 'block'
66
+ @block_option = ' display: block;' if @block
67
+
68
+ @class = @helper.parameter_specified? 'class'
69
+ @class_option = " #{@class}"
70
+
71
+ @id = @helper.parameter_specified? 'id'
72
+ @id_option = " id='@id'" if @id
73
+
74
+ @span = @helper.parameter_specified? 'span' unless @block
75
+
76
+ @style = @helper.parameter_specified? 'style'
77
+ @style_option = " style='#{@style}#{@block_option}'" if @style || @block_option
78
+
79
+ if @span
80
+ <<~END_MSG
81
+ <span class="todo#{@alert_option}#{@class_option}"#{@id_option}#{@style_option}>#{content}</span>
82
+ END_MSG
83
+ else
84
+ <<~END_MSG
85
+ <fieldset class="todo#{@alert_option}#{@class_option} rounded shadow"#{@id_option}#{@style_option}>
86
+ <legend>TODO</legend>
87
+ #{content}
88
+ </fieldset>
89
+ END_MSG
90
+ end
91
+ rescue StandardError => e
92
+ @logger.error { "#{self.class} died with a #{e.full_message}" }
93
+ exit 3
94
+ end
95
+
96
+ ::JekyllSupport::JekyllPluginHelper.register(self, PLUGIN_NAME)
97
+ end
98
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/jekyll_todo'
3
+
4
+ RSpec.describe JekyllToDoModule do
5
+ extend described_class # Define class methods from JekyllToDoModule
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,81 @@
1
+ require 'jekyll'
2
+ require 'jekyll_plugin_logger'
3
+ require 'liquid'
4
+ require 'fileutils'
5
+ require 'yaml'
6
+ require_relative '../lib/jekyll_todo'
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,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll_todo
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: 3.5.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 3.5.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: 1.0.3
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.0.3
54
+ description: 'Generate a TODO block.
55
+
56
+ '
57
+ email:
58
+ - mslinn@mslinn.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".rubocop.yml"
64
+ - CHANGELOG.md
65
+ - README.md
66
+ - Rakefile
67
+ - jekyll_todo.gemspec
68
+ - lib/jekyll_todo.rb
69
+ - lib/jekyll_todo/version.rb
70
+ - lib/jekyll_todo_module.rb
71
+ - lib/todo.rb
72
+ - spec/jekyll_todo/jekyll_to_do_module_spec.rb
73
+ - spec/spec_helper.rb
74
+ homepage: https://github.com/mslinn/jekyll_todo
75
+ licenses:
76
+ - MIT
77
+ metadata:
78
+ allowed_push_host: https://rubygems.org
79
+ bug_tracker_uri: https://github.com/mslinn/jekyll_todo/issues
80
+ changelog_uri: https://github.com/mslinn/jekyll_todo/CHANGELOG.md
81
+ homepage_uri: https://github.com/mslinn/jekyll_todo
82
+ source_code_uri: https://github.com/mslinn/jekyll_todo
83
+ post_install_message: |2+
84
+
85
+ Thanks for installing jekyll_todo!
86
+
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: 3.1.0
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubygems_version: 3.7.0
102
+ specification_version: 4
103
+ summary: Generate a TODO block
104
+ test_files: []
105
+ ...