jekyll_href 1.2.13 → 3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15395e432574a69be4a28def40f3c20bf199fa762f8ca94155408e864921c406
4
- data.tar.gz: 4d7385465ad6ddd8b9f52c6efbb62f7fd757015d10f23017e63639ddfc8e6670
3
+ metadata.gz: c61c2bd72ae152f2abf6fb72d4fe6e4cbca4737d20d9e773937102adef35e8af
4
+ data.tar.gz: dea5bee553954993056fa72dea4ee9184de5d4512835e3e5a8ae4ba8062efc39
5
5
  SHA512:
6
- metadata.gz: 595817a332ef1fe8044249f075efc94a8fc6ba4f284ba2d97ef504d72cabf63799831c808e8450fe6c935d859c5296dda3805e42fd3ada764be2fe2c9985b616
7
- data.tar.gz: 07b1e783d4b0015097229fda3a2257fdfc8b7b523673f212bdde3c7423eb889badd30a6f36b57c3dcd95eaea321f1f48cdd9db90f96cee167852b6f9b8aa4341
6
+ metadata.gz: e26b7fdb1fb084803829711382647dae5c9c8538c1214455b82148ddd2aee6583c3c1d48ad369aaa6fc45a007c1e47ec6c4e508f9205c5b43c14e061976f6d1f
7
+ data.tar.gz: cda12780c651afb157b20eea0810ac150d9d86f66c007a11e761ebb013aad0a1bdcae67355ccae58f93378996a3bce5114550a7f235256e0f92c15d07d221363
data/CHANGELOG.md CHANGED
@@ -1,10 +1,25 @@
1
1
  # Change Log
2
2
 
3
+ ## 3.0.0 / In process
4
+
5
+ * Numbered as v3.0.0 to match the `jekyll_plugin_support` version number.
6
+ * Now requires [Jekyll 4.4.1](https://jekyllrb.com/news/2025/01/29/jekyll-4-4-1-released/) or later,
7
+ and Ruby 3.2.0 or later
8
+
9
+
10
+ ## 1.3.0 / 2025/-02-07
11
+
12
+ * The `match` option now searches all files, not just pages in collections.
13
+ * A binary search is now used.
14
+ * Launch configurations are now provided for `production` and `development` modes of the demo website.
15
+ * Renamed `HRef_error` to `HrefError`.
16
+
17
+
3
18
  ## 1.2.13 / 2024-12-23
4
19
 
5
20
  * Fixed reference to undefined `url_matches`.
6
21
  * References that point to draft pages are rendered differently in production mode,
7
- and an info-level log message is generated.
22
+ and an info-level log message is generated
8
23
 
9
24
 
10
25
  ## 1.2.12 / 2024-08-17
data/README.md CHANGED
@@ -1,31 +1,61 @@
1
1
  # `Jekyll_href` [![Gem Version](https://badge.fury.io/rb/jekyll_href.svg)](https://badge.fury.io/rb/jekyll_href)
2
2
 
3
- `Jekyll_href` is a Jekyll plugin that provides a new Liquid tag: `href`.
4
- It provides a convenient way to generate formatted and clickable URIs.
5
- The Liquid tag generates an `a href` HTML tag,
6
- which by default contains `target="_blank"` and `rel="nofollow"`.
3
+ `Jekyll_href` is a flexible Jekyll plugin that is designed to minimize the work of creating and maintaining a Jekyll website.
7
4
 
8
- If the url starts with `http`, or the `match` keyword is specified:
9
5
 
10
- - The url will open in a new tab or window.
11
- - The url will include `rel="nofollow"` for SEO purposes.
6
+ ## Features
7
+
8
+ 1. It provides a new Liquid tag: `href` with default options such as generating `target="_blank"` and `rel="nofollow"`
9
+ that can be overridden.
10
+ 2. The `match` keyword causes the title of the linked Jekyll page to be used as the link text;
11
+ an error is displayed if the page does not exist.
12
+ 3. Provides a convenient syntax for generating links with monospaced text that display the URL being linked to.
13
+ 4. Can generate soft hyphens (­ and <wbr>).
14
+ 5. If the url starts with `http`, or the `match` keyword is specified:
15
+
16
+ a. The url will open in a new tab or window.
17
+
18
+ b. The url will include `rel="nofollow"` for SEO purposes.
19
+
20
+ 6. URLs can be composed from environment variable references.
21
+ 7. The href tags in a page can be summarized by the `href_summary` tag.
12
22
 
13
23
  CAUTION: if linked text contains a single or double quote,
14
24
  you will see the error message: `Liquid Exception: Unmatched quote`.
15
25
  Instead, use one of the following:
16
26
 
17
- - `'` (')
18
- - `"` (")
19
- - `‘` (‘)
20
- - `’` (’)
21
- - `“` (“)
22
- - `”` (”)
27
+ <ul style="column-count: 3; list-style-type: none; padding: 0; margin: 0 2em;">
28
+ <li><code>&amp;apos;</code> (&apos;)</li>
29
+ <li><code>&amp;quot;</code> (&quot;)</li>
30
+ <li><code>&amp;lsquo;</code> (&lsquo;)</li>
31
+ <li><code>&amp;rsquo;</code> (&rsquo;)</li>
32
+ <li><code>&amp;ldquo;</code> (&ldquo;)</li>
33
+ <li><code>&amp;rdquo;</code> (&rdquo;)</li>
34
+ </ul>
35
+
36
+
37
+ ## Installation
38
+
39
+ Add the following to your Jekyll website's `Gemfile`, within the `jekyll_plugins` group:
40
+
41
+ ```text
42
+ group :jekyll_plugins do
43
+ gem 'jekyll_href'
44
+ end
45
+ ```
46
+
47
+ And then execute:
48
+
49
+ ```shell
50
+ $ bundle
51
+ ```
23
52
 
24
53
 
25
54
  ## Configuration
26
55
 
27
56
  In `_config.yml`, if a section called `plugin-vars` exists,
28
57
  then its name/value pairs are available for substitution.
58
+ When referenced from a web page, the names must be enclosed within {{double curly braces}} in order for substitution to occur.
29
59
 
30
60
  ```yaml
31
61
  plugin-vars:
@@ -33,6 +63,15 @@ plugin-vars:
33
63
  django-oscar-github: 'https://github.com/django-oscar/django-oscar/blob/3.0.2'
34
64
  ```
35
65
 
66
+ Use it as shown below. The lines have been folded for legibility; whitespace formatting is optional:
67
+
68
+ ```text
69
+ {% href
70
+ label="django.core.management.execute_from_command_line"
71
+ url="{{django-github}}/django/core/management/__init__.py#L398-L401"
72
+ %}
73
+ ```
74
+
36
75
  The following sections and settings can be set:
37
76
  `Pry_on_href_error` has priority over `die_on_href_error`.
38
77
 
@@ -46,55 +85,108 @@ href_summary:
46
85
  pry_on_href_error: true # Default value is false
47
86
  ```
48
87
 
88
+
89
+ ## Common Usages
90
+
91
+ 1. For local links (links within a Jekyll website), the best way to make them is with an incantation like this:
92
+ ```text
93
+ {% href match url='trust_winning.html' %}{% endraw %}
94
+ ```
95
+
96
+ The above uses the page title of <code>trust_winning.html</code> as the link text;
97
+ an error is displayed if the page does not exist.
98
+ It renders like this: {% href match url='trust_winning.html' %}.
99
+
100
+ 2. To display external links with a monospaced font, and use the URL as the link text, use an incantation like this:
101
+ ```text
102
+ {% href url='mslinn.com' %}{% endraw %}
103
+ ```
104
+ The above renders as: <a href="https://mslinn.com"><code>mslinn.com</code></a>.
105
+
106
+
49
107
  ## Suppprted Syntaxes
50
108
 
51
109
  Square brackets in the [BNF notation](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form)
52
110
  below denote optional keyword parameters, and are not meant to be typed.
111
+ Additional usage examples follow.
53
112
 
54
- ## Syntax 1 (most verbose, but provides best results and enables implicit matching title)
113
+
114
+ ## Syntax 1: Mmost verbose
115
+
116
+ This is the most verbose syntax, but it provides most reliable results.
117
+ If `match` is specified, the title from the matching page is used as the link
118
+ text unless overridden by the value of the `label` parameter.
119
+
120
+ Options are:
55
121
 
56
122
  ```html
57
- {% href [match | [follow] [blank|notarget] [summary_exclude]] url="local_page.html" label="text to display" %}
123
+ {% href [match | [follow] [blank|notarget] [summary_exclude]]
124
+ label="text to display"
125
+ url="local_page.html"
126
+ %}
58
127
  ```
59
128
 
60
129
  1. The url can be #relative, a page in the Jekyll website, or prefaced with a protocol, such as `https:`
61
- 2. If `match` is provided, and `label` is not provided, then the title of the matched page is used as the label.
130
+ 2. Embedded newlines within the label are legal.
131
+ 3. The `url` and `label` parameter values can be enclosed in single or double quotes.
132
+ 4. If `match` is provided, and `label` is not provided, then the title of the matched page is used as the label.
133
+
62
134
 
135
+ ## Syntax 2: Easiest to Type
63
136
 
64
- ## Syntax 2 (requires `url` without embedded spaces)
137
+ This syntax uses positional parameters instead of labeled parameters.
138
+ This syntax can only be used if the url does not contain embedded spaces.
139
+ You can write the tag on one line, or several lines as shown.
65
140
 
66
141
  ```html
67
- {% href [match | [follow] [blank|notarget] [page_title] [summary_exclude]] url text to display %}
142
+ {% href [match | [follow] [blank|notarget] [page_title] [summary_exclude]]
143
+ url
144
+ text to display
145
+ %}
68
146
  ```
69
147
 
70
- 1. The url must be a single token, without embedded spaces.
148
+ 1. Embedded newlines within the tag are legal.
71
149
  2. The url need not be enclosed in quotes.
150
+ 3. The `match` keyword causes the title of the linked page to be used as the link text unless the `label` option is provided.
151
+ 4. If `url` is not provided, then the text to display is assumed to be a URI,
152
+ as described in syntax 4, and is formatted into a clickable link.
72
153
 
73
154
 
74
- ## Syntax 3 (always works)
155
+ ## Syntax 3: `url` Option
75
156
 
76
- This syntax is recommended when the URL contains a colon (:).
157
+ This syntax is recommended when the URL contains a problematic character,
158
+ such as a colon (`:`) or space, and you are too lazy to type out label=.
159
+ Contrast with the explicit `label` parameter syntax, described next.
77
160
 
78
161
  ```html
79
162
  {% href [match | [follow] [blank|notarget]] [page_title] [summary_exclude]
80
- url="http://link.com with space.html" some text %}
163
+ url="http://link.com with space.html"
164
+ some text
165
+ %}
81
166
  ```
82
167
 
83
168
  1. Each of the above examples contain an embedded newline, which is legal.
84
169
  2. The url must be enclosed by either single or double quotes.
85
170
 
86
171
 
87
- ## Syntax 4 (implicit URL)
172
+ ## Syntax 4 Explicit `label` Option
173
+
174
+ This syntax is recommended when the linked text contains an option keyword, such as `summary` or `label`.
175
+ It can be combined with an explicit url, described above.
88
176
 
89
177
  ```html
90
- {% href [match | [follow] [blank|notarget] [page_title] [summary_exclude]] [shy|wbr] www.domain.com %}
178
+ {% href [match | [follow] [blank|notarget] [page_title] [summary_exclude]] [shy|wbr]
179
+ www.domain.com
180
+ %}
91
181
  ```
92
182
 
93
- The URI provided, for example `www.domain.com`,
94
- is used to form the URL by prepending `https://`,
95
- in this case the result would be `https://www.domain.com`.
96
- The displayed URI is enclosed in `<code></code>`,
97
- so the resulting text is `<code>www.domain.com</code>`.
183
+ 1. Embedded newlines within the tag are legal.
184
+
185
+ 2. The URI provided, for example `www.domain.com`,
186
+ is used to form the URL by prepending `https://`,
187
+ in this case the result would be `https://www.domain.com`.
188
+ The displayed URI is enclosed in `<code></code>`,
189
+ so the resulting text is `<code>www.domain.com</code>`.
98
190
 
99
191
 
100
192
  ## Environment Variable Expansion
@@ -103,22 +195,19 @@ URLs can contain environment variable references.
103
195
  For example, if `$domain`, `$uri` and `$USER` are environment variables:
104
196
 
105
197
  ```html
198
+ Using keyword options:
106
199
  {% href http://$domain.html some text %}
107
200
 
201
+ Using the url option and positional link text:
108
202
  {% href url="$uri" some text %}
109
203
 
204
+ Using positional parameters for the URL and the link text:
110
205
  {% href https://mslinn.html <code>USER=$USER</code> %}
111
206
  ```
112
207
 
113
208
 
114
209
  ## Optional Parameters
115
210
 
116
- ### `page_title`
117
-
118
- For local pages, use the linked page title as the link text.
119
- This value overrides any provided link text.
120
-
121
-
122
211
  ### `blank`
123
212
 
124
213
  The `target='_blank'` attribute is not normally generated for relative links.
@@ -166,10 +255,14 @@ Both of the following produce the same output:
166
255
  ### `match`
167
256
 
168
257
  `match` will attempt to match the url fragment (specified as a regex) to a URL in any collection.
169
- If multiple documents have matching URL an error is thrown.
258
+ If multiple documents have matching URLs an error is thrown.
170
259
  The `match` option looks through the pages collection for a URL with containing the provided substring.
171
260
  `Match` implies `follow` and `notarget`.
172
261
 
262
+ ```text
263
+ {% href match url="page6.html" %}
264
+ ```
265
+
173
266
 
174
267
  ### `notarget`
175
268
 
@@ -178,6 +271,12 @@ The `blank` and `notarget` parameters are mutually exclusive.
178
271
  If both are specified, `blank` prevails.
179
272
 
180
273
 
274
+ ### `page_title`
275
+
276
+ For local pages, use the linked page title as the link text.
277
+ This value overrides any provided link text.
278
+
279
+
181
280
  ### `shy`
182
281
 
183
282
  The `shy` keyword option is only applicable for syntax 3 (implicit URL).
@@ -253,7 +352,7 @@ Expands to:
253
352
  ```
254
353
 
255
354
 
256
- ## Examples
355
+ ## Usage Examples
257
356
 
258
357
  1. Generates `nofollow` and `target` attributes:
259
358
 
@@ -312,9 +411,10 @@ Expands to:
312
411
 
313
412
  Here is a complete invocation:
314
413
 
414
+ ```text
315
415
  {% href url="https://ammonite.io/#import&dollar;ivy"
316
416
  label="<code>import &dollar;ivy</code>" %}
317
-
417
+ ```
318
418
 
319
419
  ## References Generation
320
420
 
@@ -368,7 +468,7 @@ Given these `href` and `href_summary` usages in a web page:
368
468
  {% href_summary attribution include_local %}
369
469
  ```
370
470
 
371
- Then the generated HTML looks like the following:
471
+ The generated HTML looks like the following:
372
472
 
373
473
  ```html
374
474
  <h2 id="reference">References</h2>
@@ -401,23 +501,6 @@ More information is available on my website about
401
501
  [my Jekyll plugins](https://www.mslinn.com/blog/2020/10/03/jekyll-plugins.html).
402
502
 
403
503
 
404
- ## Installation
405
-
406
- Add this line to your Jekyll website's `Gemfile`, within the `jekyll_plugins` group:
407
-
408
- ```ruby
409
- group :jekyll_plugins do
410
- gem 'jekyll_href'
411
- end
412
- ```
413
-
414
- And then execute:
415
-
416
- ```shell
417
- $ bundle
418
- ```
419
-
420
-
421
504
  ## Generated HTML
422
505
 
423
506
  ### Without Keywords
data/jekyll_href.gemspec CHANGED
@@ -27,13 +27,12 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  END_MESSAGE
29
29
  spec.require_paths = ['lib']
30
- spec.required_ruby_version = '>= 2.6.0'
30
+ spec.required_ruby_version = '>= 3.2.0'
31
31
  spec.summary = "Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'."
32
32
  spec.version = JekyllHrefVersion::VERSION
33
33
 
34
34
  spec.add_dependency 'ipaddress'
35
- spec.add_dependency 'jekyll', '>= 3.5.0'
36
- spec.add_dependency 'jekyll_all_collections'
37
- spec.add_dependency 'jekyll_plugin_support', '>= 1.0.3'
35
+ spec.add_dependency 'jekyll', '>= 4.4.1'
36
+ spec.add_dependency 'jekyll_plugin_support', '>= 3.0.0'
38
37
  spec.add_dependency 'typesafe_enum'
39
38
  end
data/lib/enums.rb CHANGED
@@ -2,6 +2,7 @@ require 'typesafe_enum'
2
2
 
3
3
  class LinkType < TypesafeEnum::Base
4
4
  new :EXTERNAL
5
+ new :FILE
5
6
  new :FRAGMENT
6
7
  new :LOCAL
7
8
  new :MAILTO
data/lib/href_match.rb CHANGED
@@ -2,15 +2,20 @@ module JekyllSupport
2
2
  class HRefTag
3
3
  private
4
4
 
5
+ # This is a computationally intense method, and really slows down site generation.
6
+ # TODO: implement cache in front of sorted objects containing paths and page reference
7
+ # This cache is also needed by page_match in jekyll_draft
5
8
  def compute_link_and_text
6
- page_matches = @site.all_collections.map.select { |page| page.url&.include? @path }
9
+ page_matches = @site.everything # ? all_documents ?
10
+ .select { |page| page.url&.include? @path }
11
+ .reject { |x| x.path == 'redirect.html' } || []
7
12
  case page_matches.length
8
13
  when 0
9
- msg = "HRef error: No url matches '#{@link}', found on line #{@line_number} (after front matter) of #{@path}"
14
+ msg = "HRef error: No url matches '#{@path}', found on line #{@line_number} (after front matter) of #{@path}"
10
15
  @logger.error { msg }
11
16
  abort msg if @die_if_nomatch
12
17
 
13
- @text = "<i class='h_ref_error'>#{@link} is not a valid local page</i>"
18
+ @text = "<i class='not_public_yet'><code>#{@path}</code> is not a public page yet</i>"
14
19
  @link_save = @link = '#'
15
20
  when 1
16
21
  @link = page_matches.first.url
@@ -18,7 +23,7 @@ module JekyllSupport
18
23
  @link_save = @link
19
24
  @text = page_matches.first.title unless @label
20
25
  else
21
- logger.error { "Error: More than one url matched '#{@path}':\n #{page_matches.map(&:url).join("\n ")}" }
26
+ logger.error { "Error: More than one url matched '#{@path}', referenced in '#{@page['path']}':\n #{page_matches.map(&:url).join("\n ")}" }
22
27
  exit! 2
23
28
  end
24
29
  end
@@ -18,15 +18,19 @@ module JekyllSupport
18
18
  # Uses the linked page title as the link text
19
19
  def handle_page_title(linkk)
20
20
  @follow = @target = ''
21
- raise HRefError, 'href tags with page_title require local links.' unless @link_type == LinkType::LOCAL
21
+ unless @link_type == LinkType::LOCAL
22
+ puts 'Oops'
23
+ raise HrefError, 'href tags with page_title require local links.'
24
+ end
22
25
 
23
26
  page = find_page linkk
24
27
  unless page
25
28
  msg = "There is no page at path #{linkk}"
26
- @text = "<div class='href_error'>HRefError: #{msg}</div>\n<pre> {% href #{@argument_string.strip} %}</pre>"
27
- raise HRefError, msg
29
+ @text = "<div class='h_ref_error'>HrefError: #{msg}</div>\n<pre> {% href #{@argument_string.strip} %}</pre>"
30
+ raise HrefError, msg
28
31
  end
29
- @text = @label = page.title
32
+ @text = ''
33
+ @label = page.title
30
34
  handle_empty_text linkk if @text.to_s.empty?
31
35
  @label
32
36
  end
data/lib/href_private.rb CHANGED
@@ -16,7 +16,7 @@ module JekyllSupport
16
16
  return nil, error_no_uri
17
17
  end
18
18
  [linkk, nil]
19
- rescue HRefError => e
19
+ rescue HrefError => e
20
20
  [nil, e]
21
21
  end
22
22
 
@@ -26,13 +26,12 @@ module JekyllSupport
26
26
  <pre>{% href #{@argument_string.strip} %}</pre>
27
27
  END_MESSAGE
28
28
  @logger.error { JekyllSupport::JekyllPluginHelper.remove_html_tags msg.strip }
29
- "<div class='h_ref_error'>HRefError: #{msg}</div>"
29
+ "<div class='h_ref_error'>HrefError: #{msg}</div>"
30
30
  end
31
31
 
32
32
  # Sets @follow, @helper, @match, @path, @target, @url, @hyphenation
33
33
  def globals_initial
34
34
  @path = @page['path']
35
- AllCollectionsHooks.compute @site
36
35
  @hyphenation = Hyphenation::NONE
37
36
 
38
37
  @blank = @helper.parameter_specified? 'blank'
@@ -83,8 +82,10 @@ module JekyllSupport
83
82
  return
84
83
  end
85
84
 
86
- @link_type = if linkk.start_with? 'http'
85
+ @link_type = if linkk.start_with? 'http:', 'https:'
87
86
  LinkType::EXTERNAL
87
+ elsif linkk.start_with? 'file:'
88
+ LinkType::FILE
88
89
  elsif linkk.start_with? '#'
89
90
  LinkType::FRAGMENT
90
91
  else
@@ -101,7 +102,7 @@ module JekyllSupport
101
102
  linkk
102
103
  end
103
104
  @link_save = @link
104
- return if @link_type == LinkType::EXTERNAL
105
+ return if @link_type == LinkType::EXTERNAL || @link_type == LinkType::FILE
105
106
 
106
107
  @follow = ''
107
108
  @target = '' unless @blank
@@ -39,7 +39,7 @@ module JekyllSupport
39
39
  #{local_refs}
40
40
  #{@helper.attribute if @helper.attribution && have_refs}
41
41
  END_RENDER
42
- rescue HRefError => e # jekyll_plugin_support handles StandardError
42
+ rescue HrefError => e # jekyll_plugin_support handles StandardError
43
43
  @logger.error { e.logger_message }
44
44
  exit! 1 if @die_on_demo_block_error
45
45
 
data/lib/href_tag.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'ipaddress'
2
2
  require 'jekyll_draft'
3
- require 'jekyll_all_collections'
4
3
  require 'jekyll_plugin_logger'
5
4
  require 'jekyll_plugin_support'
6
5
  require 'liquid'
@@ -15,8 +14,6 @@ require_relative 'hash_array'
15
14
  module JekyllSupport
16
15
  MiniHref = Struct.new(:follow, :html, :link, :line_number, :link_save, :path, :summary_exclude, :summary_href, keyword_init: true)
17
16
 
18
- HRefError = JekyllSupport.define_error
19
-
20
17
  # Implements href Jekyll tag
21
18
  class HRefTag < JekyllTag
22
19
  attr_reader :follow, :helper, :line_number, :link_save, :match, :page, :path, :site,
@@ -51,16 +48,26 @@ module JekyllSupport
51
48
  raise HrefError, '@link_type was not set' if @link_type == LinkType::UNKNOWN
52
49
 
53
50
  save_summary
51
+
54
52
  klass = " class='#{@klass}'" if @klass
55
53
  style = " style='#{@style}'" if @style
56
- if @link_type == LinkType::LOCAL && local_page_draft?(@link)
57
- klass = "draft_link #{klass}".strip
58
- return "<span #{klass}#{style} title='This page is not available yet.'>#{@text}</span>" if @mode == 'production'
54
+
55
+ if @link_type == LinkType::LOCAL &&
56
+ @mode == 'production' &&
57
+ @label_source != LabelSource::FROM_IMPLICIT_LABEL &&
58
+ @link != '#'
59
+ path, _fragment = @link.split('#')
60
+ page = ::Jekyll::Draft.page_match path
61
+ if ::Jekyll::Draft.draft? page
62
+ klass = "draft_link #{@klass}".strip
63
+ raise HrefError,
64
+ "<span class='#{klass}'#{style}><span class='draft_title'>#{page.title}</span> <span class='draft_label'>#{@text}</span></span>"
65
+ end
59
66
  end
60
67
 
61
68
  "<a href='#{@link}'#{klass}#{style}#{@target}#{@follow}>#{@text}</a>"
62
- rescue HRefError => e # jekyll_plugin_support handles StandardError
63
- @logger.error { e.logger_message }
69
+ rescue HrefError => e # jekyll_plugin_support handles StandardError
70
+ @logger.error { JekyllPluginHelper.remove_html_tags e.logger_message }
64
71
  exit 1 if @die_on_demo_tag_error
65
72
 
66
73
  e.html_message
@@ -70,32 +77,6 @@ module JekyllSupport
70
77
  "On line #{line_number} of #{path}: #{follow} #{match} #{target} #{link} => '#{text}'"
71
78
  end
72
79
 
73
- def local_page_draft?(url)
74
- filetype = File.extname url
75
- page_matches = @site.all_collections.map.select { |page| page.url == url }
76
- case page_matches.length
77
- when 0
78
- return false unless %w[htm html md].include? filetype
79
-
80
- msg = "HRef error: No url matches '#{url}', found on line #{@line_number} (after front matter)"
81
- @logger.error { msg }
82
- abort msg if @die_if_nomatch
83
-
84
- @text = "<i class='h_ref_error'>#{url} is not a valid local page</i>"
85
- @link_save = @link = '#'
86
- true
87
- when 1
88
- @link = page_matches.first.url
89
- @link = "#{@link}##{@fragment}" if @fragment
90
- @link_save = @link
91
- @text = page_matches.first.title unless @label
92
- Jekyll::Draft.draft? page_matches.first
93
- else
94
- logger.error { "Error: More than one url matched '#{url}'. Collections are: #{page_matches.join(', ')}" }
95
- exit! 2
96
- end
97
- end
98
-
99
80
  JekyllSupport::JekyllPluginHelper.register(self, 'href')
100
81
  end
101
82
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllHrefVersion
2
- VERSION = '1.2.13'.freeze
2
+ VERSION = '3.0.0'.freeze
3
3
  end
@@ -1,15 +1,15 @@
1
1
  example_id | status | run_time |
2
2
  ----------------------------------------------------------------- | ------ | --------------- |
3
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:1] | passed | 0.00938 seconds |
4
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:2] | failed | 0.01389 seconds |
5
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:3] | failed | 0.00319 seconds |
6
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:4] | failed | 0.00211 seconds |
7
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:5] | failed | 0.00196 seconds |
8
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:6] | failed | 0.00205 seconds |
9
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:7] | passed | 0.00212 seconds |
10
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:8] | failed | 0.00209 seconds |
11
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:9] | failed | 0.0021 seconds |
12
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:10] | passed | 0.00278 seconds |
13
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:11] | passed | 0.00237 seconds |
14
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:12] | passed | 0.00218 seconds |
15
- /mnt/f/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:13] | passed | 0.00211 seconds |
3
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:1] | failed | 0.00183 seconds |
4
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:2] | failed | 0.00067 seconds |
5
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:3] | failed | 0.00073 seconds |
6
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:4] | failed | 0.00075 seconds |
7
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:5] | failed | 0.00069 seconds |
8
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:6] | failed | 0.00069 seconds |
9
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:7] | failed | 0.00069 seconds |
10
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:8] | failed | 0.00072 seconds |
11
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:9] | failed | 0.00067 seconds |
12
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:10] | failed | 0.00068 seconds |
13
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:11] | failed | 0.00068 seconds |
14
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:12] | failed | 0.0007 seconds |
15
+ /mnt/_/work/jekyll/my_plugins/jekyll_href/spec/href_spec.rb[1:13] | failed | 0.00069 seconds |
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_href
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.13
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 2024-12-23 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: ipaddress
@@ -29,42 +30,28 @@ dependencies:
29
30
  requirements:
30
31
  - - ">="
31
32
  - !ruby/object:Gem::Version
32
- version: 3.5.0
33
+ version: 4.4.1
33
34
  type: :runtime
34
35
  prerelease: false
35
36
  version_requirements: !ruby/object:Gem::Requirement
36
37
  requirements:
37
38
  - - ">="
38
39
  - !ruby/object:Gem::Version
39
- version: 3.5.0
40
- - !ruby/object:Gem::Dependency
41
- name: jekyll_all_collections
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: '0'
40
+ version: 4.4.1
54
41
  - !ruby/object:Gem::Dependency
55
42
  name: jekyll_plugin_support
56
43
  requirement: !ruby/object:Gem::Requirement
57
44
  requirements:
58
45
  - - ">="
59
46
  - !ruby/object:Gem::Version
60
- version: 1.0.3
47
+ version: 3.0.0
61
48
  type: :runtime
62
49
  prerelease: false
63
50
  version_requirements: !ruby/object:Gem::Requirement
64
51
  requirements:
65
52
  - - ">="
66
53
  - !ruby/object:Gem::Version
67
- version: 1.0.3
54
+ version: 3.0.0
68
55
  - !ruby/object:Gem::Dependency
69
56
  name: typesafe_enum
70
57
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +115,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
115
  requirements:
129
116
  - - ">="
130
117
  - !ruby/object:Gem::Version
131
- version: 2.6.0
118
+ version: 3.2.0
132
119
  required_rubygems_version: !ruby/object:Gem::Requirement
133
120
  requirements:
134
121
  - - ">="
135
122
  - !ruby/object:Gem::Version
136
123
  version: '0'
137
124
  requirements: []
138
- rubygems_version: 3.6.0
125
+ rubygems_version: 3.5.22
126
+ signing_key:
139
127
  specification_version: 4
140
128
  summary: Generates an 'a href' tag, possibly with target='_blank' and rel='nofollow'.
141
129
  test_files: []