jekyll_href 1.2.2 → 1.2.3

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: 9e9e6357f4c5f4d4dd7815aab9142ab5dadfbc48b3ba719fdc6b1cd70265d3d3
4
- data.tar.gz: '068d3c6821f1f8578fee4331179be452ad50fdfd620cc990a0dbdb1359f605cc'
3
+ metadata.gz: f273b4ad20431d42f67bd6a8bba43823e158b4239d385951371e5511f31483f6
4
+ data.tar.gz: 13ce74af244bd5d9d26c44a7ebeb340126f729f084cddf04c75d0b79e83e973e
5
5
  SHA512:
6
- metadata.gz: d4411b3c9cfad7062eb75206f487e6e1a5589874479ae09815d044177069fd567b069875b9fabd4018dc9aafed9dc5dcc656354917c90935311ee958b6c1d5c2
7
- data.tar.gz: abc4e78a0745ab9f455c5e1a1f85d0a41aa85c242f155c8d064503d5682df69806ef98c06c838833d37b1d3468713d5a21e798b7bf33570d48e2e27f76450fb8
6
+ metadata.gz: 69169786943109c5f2fb288a430d247f8fa3a46b4d94c78607c012f3a9abd4116f38e66a4071e11c8bb53e8d21e7b3efe716aaf32d7a93c73d670026a24038bc
7
+ data.tar.gz: b37d5401822827f70f9b1e00f5eef1e93f8cab00c97a808409d71e6f173d99c0dc7bab5e33c07c2e41b98d47a2749a2e9e771588f167c8b269fa50b07c47cc96
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.3 / 2023-05-16
2
+ * Added `label` option.
3
+
1
4
  ## 1.2.2 / 2023-03-25
2
5
  * Added **References** capability:
3
6
  * Added `summary_exclude` keyword option to `href` tag.
data/README.md CHANGED
@@ -85,6 +85,15 @@ If both are specified, `blank` prevails.
85
85
  ### `follow`
86
86
  To suppress the `nofollow` attribute, preface the link with the word `follow`.
87
87
 
88
+ ### `label='whatever you want'`
89
+ If the text to be linked contains an optional keyword argument,
90
+ for example `summary`, that word will be removed from the displayed link text,
91
+ unless the link text is provided via the `label` option.
92
+ Both of the following produce the same output:
93
+ ```
94
+ {% href https://mslinn.com label="This is a summary" %}
95
+ {% href label="This is a summary" https://mslinn.com %}
96
+ ```
88
97
 
89
98
  ### `notarget`
90
99
  To suppress the `target` attribute, preface the link with the word `notarget`.
@@ -130,6 +139,7 @@ Expands to:
130
139
  ### `summary`
131
140
  The `summary` name/value option provides an override for the linked text in the **References** section
132
141
  generated by the `{% href_summary %}` tag.
142
+ If the value is the empty string, or no value is provided, the `href` tag is not included in the page summary.
133
143
 
134
144
 
135
145
  ### `summary_exclude`
data/lib/href_tag.rb CHANGED
@@ -55,6 +55,17 @@ module HrefTag
55
55
  return if @summary_exclude || @link_save.start_with?('mailto:') || @link_save.start_with?('#')
56
56
 
57
57
  @summary = @summary.to_s.empty? ? @text : @summary.to_s
58
+ if @summary == true
59
+ warning = <<~END_WARNING
60
+ Warning: a href plugin keyword option was detected in the link text for #{@path} on line #{line_number}.
61
+ The href tag will not be included in the summary, and the link text will not have the word summary included.
62
+ This is probably unintentional. Consider using the label option to correct this problem."
63
+ END_WARNING
64
+ puts warning.red
65
+ return
66
+ end
67
+ return if @summary.class != String || @summary.empty?
68
+
58
69
  @summary = @summary[0].upcase + @summary[1..]
59
70
  @summary_href = "<a href='#{@link_save}'#{@target}#{@follow}>#{@summary}</a>"
60
71
  mini_href = MiniHref.new(
@@ -109,9 +120,10 @@ module HrefTag
109
120
  @path = @page['path']
110
121
  AllCollectionsHooks.compute(@site)
111
122
 
123
+ @blank = @helper.parameter_specified? 'blank'
112
124
  @follow = @helper.parameter_specified?('follow') ? '' : " rel='nofollow'"
113
125
  @match = @helper.parameter_specified? 'match'
114
- @blank = @helper.parameter_specified? 'blank'
126
+ @label = @helper.parameter_specified? 'label'
115
127
  @summary_exclude = @helper.parameter_specified? 'summary_exclude'
116
128
  @shy = @helper.parameter_specified? 'shy'
117
129
  @summary = @helper.parameter_specified? 'summary'
@@ -133,7 +145,7 @@ module HrefTag
133
145
  end
134
146
  return
135
147
  else
136
- @text = tokens.join(' ').strip
148
+ @text = @label || tokens.join(' ').strip
137
149
  if @text.to_s.empty?
138
150
  text = linkk
139
151
  text = linkk.gsub('/', '/&shy;') if @shy
@@ -1,3 +1,3 @@
1
1
  module JekyllHrefVersion
2
- VERSION = '1.2.2'.freeze
2
+ VERSION = '1.2.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll_href
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Slinn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-13 00:00:00.000000000 Z
11
+ date: 2023-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll