jekyll_quote 0.4.0 → 0.4.2

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: 410dc88a139c0b1b0769b3896a644e6276f20a45ced9864a01d7f8f540a8e567
4
- data.tar.gz: 79f5d5b5963ad4f062d3fe8bd772698749025388f72f2672133fba63b83fadbd
3
+ metadata.gz: a2cf31841215c9cee3ccc8ba48b6dc30ae02b4dc5153c3d9e5f45f1708dee814
4
+ data.tar.gz: ff907b1974e4c509aa9d0cf56a6b7fb9738c9d936cb350daa61d44cfcdd98a98
5
5
  SHA512:
6
- metadata.gz: 4f3ede950a0fbfefcf9c2731948cd1a3a6b58935ad9cab8b47824a8bfeb4e97d58350c00a61ff52c2bf4ef0f4c2d8df456872015e572a02a94e59f8fbd5f2993
7
- data.tar.gz: e8449f5ea4015b67cd5726b18fb8675ec3fa21901cf6fcb661de1c4bd1c2acc0d092ce06ef13360a21bc49e264b14a54e53a8f3e5a86ad9a1e2c9167727281e0
6
+ metadata.gz: 12ec759cf139fe8a89aaf89aca329c75657f120982e0b266b63291b746c79801b7f74f156904b3d1060d6554514aff72fb4addb74a60255025438287847d0430
7
+ data.tar.gz: cc6c73e9a901f50db47867b3fc50a3bf6ce580f8e3ea71db438a081c4e298d905e448f49ff6f92289b6cdd9d7d29dd907ee9af6619adad4a18a832b9380833b3
data/.rubocop.yml CHANGED
@@ -8,17 +8,19 @@ require:
8
8
  AllCops:
9
9
  Exclude:
10
10
  - demo/_site/**/*
11
- - exe/**/*
11
+ - binstub/**/*
12
12
  - vendor/**/*
13
13
  - Gemfile*
14
14
  - Rakefile
15
15
  - jekyll_quote.gemspec
16
16
  NewCops: enable
17
- TargetRubyVersion: 2.6
18
17
 
19
18
  Gemspec/DeprecatedAttributeAssignment:
20
19
  Enabled: false
21
20
 
21
+ Gemspec/RequiredRubyVersion:
22
+ Enabled: false
23
+
22
24
  Gemspec/RequireMFA:
23
25
  Enabled: false
24
26
 
data/CHANGELOG.md CHANGED
@@ -1,14 +1,35 @@
1
+ # Change Log
2
+
3
+ ## 0.4.2 / 2024-04-27
4
+
5
+ * Depends upon jekyll_plugin_support v0.8.5
6
+
7
+
8
+ ## 0.4.1 / 2023-06-09
9
+
10
+ * Added `style` and `class` options.
11
+
12
+
1
13
  ## 0.4.0 / 2023-04-05
2
- * Added [`attribution` support](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
14
+
15
+ * Added [`attribution` support](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution).
16
+
3
17
 
4
18
  ## 0.3.1 / 2023-03-15
5
- * Added CSS class: `clearfix`
19
+
20
+ * Added CSS class: `clearfix`
21
+
6
22
 
7
23
  ## 0.3.0 / 2023-01-14
8
- * Added CSS classes: `quoteAttribution` and `quoteText`
24
+
25
+ * Added CSS classes: `quoteAttribution` and `quoteText`
26
+
9
27
 
10
28
  ## 0.2.0 / 2023-01-14
11
- * Added options: `break`, `by`, and `noprep`
29
+
30
+ * Added options: `break`, `by`, and `noprep`
31
+
12
32
 
13
33
  ## 0.1.0 / 2023-01-12
14
- * Initial version
34
+
35
+ * Initial version
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -1,6 +1,4 @@
1
- `jekyll_quote`
2
- [![Gem Version](https://badge.fury.io/rb/jekyll_quote.svg)](https://badge.fury.io/rb/jekyll_quote)
3
- ===========
1
+ # `jekyll_quote` [![Gem Version](https://badge.fury.io/rb/jekyll_quote.svg)](https://badge.fury.io/rb/jekyll_quote)
4
2
 
5
3
  `jekyll_quote` is a Jekyll plugin that displays formatted quotes.
6
4
 
@@ -8,35 +6,89 @@ See [demo/index.html](demo/index.html) for examples.
8
6
 
9
7
 
10
8
  ## Installation
11
- Add the following line to your Jekyll project's Gemfile, within the `jekyll_plugins` group:
12
9
 
13
- ```ruby
14
- group :jekyll_plugins do
15
- gem 'jekyll_quote'
16
- end
10
+ 1. Add the following line to your Jekyll project's Gemfile, within the `jekyll_plugins` group:
11
+
12
+ ```ruby
13
+ group :jekyll_plugins do
14
+ gem 'jekyll_quote'
15
+ end
16
+ ```
17
+
18
+ 2. Install the `jekyll_quote` Ruby gem and mark it as a dependency of your project by typing:
19
+
20
+ ```shell
21
+ $ bundle
22
+ ```
23
+
24
+ 3. Copy the CSS classes from `demo/assets/css/jekyll_quote.css` to your Jekyll project's CSS file.
25
+
26
+
27
+ ## Syntax
28
+
29
+ ```html
30
+ {% quote OPTIONS %}
31
+ Content of quote goes here.
32
+ {% endquote %}
17
33
  ```
18
34
 
19
- And then execute:
35
+ The default preposition is 'From'.
36
+
37
+ OPTIONS are:
38
+
39
+ * `break` – Put the citation on a separate line. Ignored if `cite` was not specified.
40
+ * `by` – Preface the citation with the preposition 'By'. Ignored if `cite` was not specified.
41
+ * `cite` – Citation text
42
+ * `class` – Apply additional CSS classes
43
+ * `noprep` – Do not preface the citation with a preposition. Ignored if `cite` was not specified.
44
+ * `style` – Apply additional CSS styling
45
+ * `url` – URL for the citation. Ignored if `cite` was not specified.
20
46
 
21
- $ bundle install
47
+
48
+ ## Usage Example
49
+
50
+ ```html
51
+ {% quote cite="Blaise Pascal, in Lettres provinciales"
52
+ url="https://en.wikipedia.org/wiki/Lettres_provinciales"
53
+ %}
54
+ I have only made this letter longer because
55
+ I have not had the time to make it shorter.
56
+ {% endquote %}
57
+ ```
22
58
 
23
59
 
24
60
  ## Attribution
61
+
25
62
  See [`jekyll_plugin_support` for `attribution`](https://github.com/mslinn/jekyll_plugin_support#subclass-attribution)
26
63
 
27
64
 
65
+ ## Demo
66
+
67
+ A demo / test website is provided in the `demo` directory.
68
+ It can be used to debug the plugin or to run freely.
69
+ Please examine the HTML files in the demo to see how the plugin works.
70
+
71
+ To run the demo freely from the command line, type:
72
+
73
+ ```shell
74
+ $ demo/_bin/debug -r
75
+ ```
76
+
28
77
  ## Additional Information
78
+
29
79
  More information is available on
30
80
  [Mike Slinn’s website](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
31
81
 
32
82
 
33
83
  ## Development
84
+
34
85
  After checking out the repo, run `bin/setup` to install dependencies.
35
86
 
36
87
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
88
 
38
89
 
39
90
  To build and install this gem onto your local machine, run:
91
+
40
92
  ```shell
41
93
  $ bundle exec rake install
42
94
  jekyll_quote 0.1.0 built to pkg/jekyll_quote-0.1.0.gem.
@@ -44,6 +96,7 @@ jekyll_quote (0.1.0) installed.
44
96
  ```
45
97
 
46
98
  Examine the newly built gem:
99
+
47
100
  ```shell
48
101
  $ gem info jekyll_quote
49
102
 
@@ -59,29 +112,41 @@ jekyll_quote (0.1.0)
59
112
  Generates Jekyll logger with colored output.
60
113
  ```
61
114
 
62
- ### Demo
115
+
116
+ ### Running the Demo
117
+
63
118
  Examine the output by running:
119
+
64
120
  ```shell
65
121
  $ demo/_bin/debug -r
66
122
  ```
123
+
67
124
  ... and pointing your web browser to http://localhost:4444/
68
125
 
126
+
69
127
  ### Unit Tests
128
+
70
129
  Either run `rspec` from Visual Studio Code's *Run and Debug* environment
71
130
  (<kbd>Ctrl</kbd>-<kbd>shift</kbd>-<kbd>D</kbd>) and view the *Debug Console* output,
72
131
  or run it from the command line:
132
+
73
133
  ```shell
74
134
  $ rspec
75
135
  ```
76
136
 
137
+
77
138
  ### Build and Push to RubyGems
139
+
78
140
  To release a new version,
141
+
79
142
  1. Update the version number in `version.rb`.
80
143
  2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.
81
144
  3. Run the following:
145
+
82
146
  ```shell
83
147
  $ bundle exec rake release
84
148
  ```
149
+
85
150
  The above creates a git tag for the version, commits the created tag,
86
151
  and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).
87
152
 
data/Rakefile CHANGED
File without changes
data/jekyll_quote.gemspec CHANGED
@@ -3,11 +3,10 @@ require_relative 'lib/jekyll_quote/version'
3
3
  Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
4
4
  github = 'https://github.com/mslinn/jekyll_quote'
5
5
 
6
- spec.bindir = 'exe'
7
6
  spec.authors = ['Mike Slinn']
8
7
  spec.email = ['mslinn@mslinn.com']
9
8
  spec.files = Dir['.rubocop.yml', 'LICENSE.*', 'Rakefile', '{lib,spec}/**/*', '*.gemspec', '*.md']
10
- spec.homepage = 'https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#jekyll_quote'
9
+ spec.homepage = 'https://www.mslinn.com/jekyll_plugins/jekyll_quote.html'
11
10
  spec.license = 'MIT'
12
11
  spec.metadata = {
13
12
  'allowed_push_host' => 'https://rubygems.org',
@@ -29,5 +28,5 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
29
28
  spec.version = JekyllQuoteVersion::VERSION
30
29
 
31
30
  spec.add_dependency 'jekyll', '>= 3.5.0'
32
- spec.add_dependency 'jekyll_plugin_support', '~> 0.6.0'
31
+ spec.add_dependency 'jekyll_plugin_support', '>= 0.8.5'
33
32
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllQuoteVersion
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.4.2'.freeze
3
3
  end
data/lib/jekyll_quote.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'jekyll_plugin_support'
2
- require 'jekyll_plugin_helper'
2
+ require 'helper/jekyll_plugin_helper'
3
3
  require_relative 'jekyll_quote/version'
4
4
 
5
5
  # @author Copyright 2022 Michael Slinn
@@ -27,25 +27,32 @@ module Jekyll
27
27
  @break = @helper.parameter_specified? 'break' # enforced by CSS if a list ends the body
28
28
  @by = @helper.parameter_specified? 'by'
29
29
  @cite = @helper.parameter_specified? 'cite'
30
+ @class = @helper.parameter_specified? 'class'
30
31
  @noprep = @helper.parameter_specified? 'noprep'
32
+ @style = @helper.parameter_specified? 'style'
31
33
  @url = @helper.parameter_specified? 'url'
32
-
33
34
  preposition = 'From'
34
35
  preposition = 'By' if @by
35
36
  preposition = '' if @noprep
36
37
  if @cite
37
- quote_attribution = if @url && !@url.empty?
38
- "<a href='#{@url}' rel='nofollow' target='_blank'>#{@cite}</a>"
39
- else
40
- "#{@cite}\n"
41
- end
38
+ cite_markup = if @url && !@url.empty?
39
+ "<a href='#{@url}' rel='nofollow' target='_blank'>#{@cite}</a>"
40
+ else
41
+ "#{@cite}\n"
42
+ end
42
43
  tag = @break ? 'div' : 'span'
43
- quote_attribution = "<#{tag} class='quoteAttribution'> &nbsp;&ndash; #{preposition} #{quote_attribution}</#{tag}>\n"
44
- text = "<div class='quoteText clearfix'>#{text}</div>" if @break
44
+ @cite_markup = "<#{tag} class='quoteAttribution'> &nbsp;&ndash; #{preposition} #{cite_markup}</#{tag}>\n"
45
45
  end
46
+ @text = @break ? "<div class='quoteText clearfix'>#{text}</div>" : text
47
+ output
48
+ end
49
+
50
+ def output
51
+ klass = "#{@class} " if @class
52
+ styling = " style='#{@style}'" if @style
46
53
  <<~END_HERE
47
- <div class='quote'>
48
- #{text}#{quote_attribution}
54
+ <div class='#{klass}quote'#{styling}>
55
+ #{@text}#{@cite_markup}
49
56
  #{@helper.attribute if @helper.attribution}
50
57
  </div>
51
58
  END_HERE
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  # These tests all fail because I have not figured out how to provide a Jekyll block body to a test
40
40
  class MyTest
41
- RSpec.describe Jekyll::Quote do # rubocop:disable Metrics/BlockLength
41
+ RSpec.describe Jekyll::Quote do
42
42
  let(:logger) do
43
43
  PluginMetaLogger.instance.new_logger(self, PluginMetaLogger.instance.config)
44
44
  end
@@ -55,7 +55,7 @@ class MyTest
55
55
 
56
56
  it 'has no cite or url' do
57
57
  helper.reinitialize('Quote has no cite or url.')
58
- quote = Jekyll::Quote.send(
58
+ quote = described_class.send(
59
59
  :new,
60
60
  'quote',
61
61
  helper.markup.dup,
@@ -71,7 +71,7 @@ class MyTest
71
71
 
72
72
  it 'has a cite but no url' do
73
73
  helper.reinitialize("cite='This is a citation' The quote has a cite but no url.")
74
- quote = Jekyll::Quote.send(
74
+ quote = described_class.send(
75
75
  :new,
76
76
  'quote',
77
77
  helper.markup.dup,
@@ -89,7 +89,7 @@ class MyTest
89
89
 
90
90
  it 'has a url but no cite' do
91
91
  helper.reinitialize("url='https://blah.com' The quote has a url but no cite.")
92
- quote = Jekyll::Quote.send(
92
+ quote = described_class.send(
93
93
  :new,
94
94
  'quote',
95
95
  helper.markup.dup,
@@ -104,8 +104,8 @@ class MyTest
104
104
  end
105
105
 
106
106
  it 'has a cite and a url' do
107
- helper.reinitialize "cite='This is a citation' url='https://blah.com' The quote has a url and a cite.".dup
108
- quote = Jekyll::Quote.send(
107
+ helper.reinitialize "cite='This is a citation' url='https://blah.com' The quote has a url and a cite.".+
108
+ quote = described_class.send(
109
109
  :new,
110
110
  'quote',
111
111
  helper.markup.dup,
data/spec/spec_helper.rb CHANGED
@@ -2,9 +2,8 @@ require 'jekyll'
2
2
  require_relative '../lib/jekyll_quote'
3
3
 
4
4
  RSpec.configure do |config|
5
- config.filter_run :focus
5
+ config.filter_run_when_matching focus: true
6
6
  config.order = 'random'
7
- config.run_all_when_everything_filtered = true
8
7
 
9
8
  # See https://relishapp.com/rspec/rspec-core/docs/command-line/only-failures
10
9
  config.example_status_persistence_file_path = 'spec/status_persistence.txt'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-13 00:00:00.000000000 Z
11
+ date: 2024-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: jekyll_plugin_support
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.0
33
+ version: 0.8.5
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.6.0
40
+ version: 0.8.5
41
41
  description:
42
42
  email:
43
43
  - mslinn@mslinn.com
@@ -55,15 +55,14 @@ files:
55
55
  - lib/jekyll_quote/version.rb
56
56
  - spec/jekyll_quote_spec.rb
57
57
  - spec/spec_helper.rb
58
- - spec/status_persistence.txt
59
- homepage: https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#jekyll_quote
58
+ homepage: https://www.mslinn.com/jekyll_plugins/jekyll_quote.html
60
59
  licenses:
61
60
  - MIT
62
61
  metadata:
63
62
  allowed_push_host: https://rubygems.org
64
63
  bug_tracker_uri: https://github.com/mslinn/jekyll_quote/issues
65
64
  changelog_uri: https://github.com/mslinn/jekyll_quote/CHANGELOG.md
66
- homepage_uri: https://www.mslinn.com/jekyll/3000-jekyll-plugins.html#jekyll_quote
65
+ homepage_uri: https://www.mslinn.com/jekyll_plugins/jekyll_quote.html
67
66
  source_code_uri: https://github.com/mslinn/jekyll_quote
68
67
  post_install_message: |2+
69
68
 
@@ -90,5 +89,4 @@ summary: Provides a Jekyll filter that creates formatted quotes.
90
89
  test_files:
91
90
  - spec/jekyll_quote_spec.rb
92
91
  - spec/spec_helper.rb
93
- - spec/status_persistence.txt
94
92
  ...
@@ -1,6 +0,0 @@
1
- example_id | status | run_time |
2
- -------------------------------- | ------ | --------------- |
3
- ./spec/jekyll_quote_spec.rb[1:1] | failed | 0.01849 seconds |
4
- ./spec/jekyll_quote_spec.rb[1:2] | failed | 0.00035 seconds |
5
- ./spec/jekyll_quote_spec.rb[1:3] | failed | 0.00018 seconds |
6
- ./spec/jekyll_quote_spec.rb[1:4] | failed | 0.00009 seconds |