asciidoctor-jenkins-extensions 0.3.0 → 0.7.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
- SHA1:
3
- metadata.gz: 445dba7fb8b6ae1688eee6fb08904a6e71106468
4
- data.tar.gz: f8d07573f5a00e002a5adcd31fe31f3326e5e3f5
2
+ SHA256:
3
+ metadata.gz: 8dbfccac22053bd1cce012851bf735a6a1d4e9312dcf56dcf622c4e5d6899491
4
+ data.tar.gz: 1606be519f9a6975d93e27ac3ab94eeaa7e39e7c4f2c28c09c7e59058950f3ba
5
5
  SHA512:
6
- metadata.gz: 242d37614b4d6e1fa684e28b68bee6a4864f51983e33f5800101f503203223fd80077206dc3f704f1b3e512bd75a30ba4b5ab003cef79283f094adaf492cae83
7
- data.tar.gz: ae66144435ae33aa3d617a276158e1f3a87363c8384b7bf61e85a98991ea595da0e17b62ee3abafb0241d20f628f477729caeddbc578ba268014f494a90c0226
6
+ metadata.gz: 3810c5eccd7c9ed188656e93f572e87ea55f904f84f3744367b1f5881bb0e843800bfc47538fe55e3a7ff5598625daaae756dee14d61e82446c2caff32101802
7
+ data.tar.gz: db6b264e816e904c6f596e1db293f2eec89478581cbb439c408fc5e4c6454f39ca913f8c775750adcfdace0b04e585ddec8158610a649838ab3579dda45b9052
@@ -26,11 +26,11 @@ formatting in Jenkins-related content.
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
 
29
- spec.add_dependency 'asciidoctor', '~> 1.5.5'
29
+ spec.add_dependency 'asciidoctor', '>= 1.5.5'
30
30
  spec.add_dependency 'coderay', '~> 1.1.1'
31
31
  spec.add_dependency 'colorize', '~> 0.8.1'
32
32
 
33
- spec.add_development_dependency "bundler", "~> 1.11"
33
+ spec.add_development_dependency "bundler", "~> 2.0"
34
34
  spec.add_development_dependency "rake", "~> 10.0"
35
35
  spec.add_development_dependency "rspec"
36
36
  spec.add_development_dependency "rspec-its"
@@ -0,0 +1,24 @@
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ #
5
+ # Usage:
6
+ # author:timja[Tim Jacomb]
7
+ # author:timja[]
8
+ #
9
+ Asciidoctor::Extensions.register do
10
+ inline_macro do
11
+ named :author
12
+ name_positional_attributes 'label'
13
+
14
+ process do |parent, target, attrs|
15
+ if attrs['label']
16
+ label = %(#{attrs['label']})
17
+ else
18
+ label = %(#{target})
19
+ end
20
+ target = %(/blog/authors/#{target})
21
+ (create_anchor parent, label, type: :link, target: target).render
22
+ end
23
+ end
24
+ end
@@ -20,6 +20,14 @@ require 'asciidoctor/extensions'
20
20
  # jenkinsdoc:git:hudson.plugins.git.GitSCM[some label]
21
21
  # jenkinsdoc:git:hudson.plugins.git.GitSCM#anchor[]
22
22
  # jenkinsdoc:git:hudson.plugins.git.GitSCM#anchor[some label]
23
+ #
24
+ #
25
+ # For component Javadoc:
26
+ #
27
+ # jenkinsdoc:component:remoting:hudson.remoting.Channel[]
28
+ # jenkinsdoc:component:remoting:hudson.remoting.Channel[some label]
29
+ # jenkinsdoc:component:remoting:hudson.remoting.Channel#anchor[]
30
+ # jenkinsdoc:component:remoting:hudson.remoting.Channel#anchor[some label]
23
31
 
24
32
  Asciidoctor::Extensions.register do
25
33
  inline_macro do
@@ -29,8 +37,13 @@ Asciidoctor::Extensions.register do
29
37
  process do |parent, target, attrs|
30
38
 
31
39
  if target.include? ":"
32
- parts = target.split(':', 2)
33
- plugin = parts.first
40
+ parts = target.split(':', 3)
41
+
42
+ if parts.first == "component"
43
+ component = parts[1]
44
+ else
45
+ plugin = parts.first
46
+ end
34
47
  target = parts.last
35
48
  end
36
49
  classname = label = title = target
@@ -43,6 +56,13 @@ Asciidoctor::Extensions.register do
43
56
  classname.split('.').each do |part|
44
57
  if is_package && /[[:lower:]]/.match(part[0])
45
58
  package_parts.push(part)
59
+ elsif match = /(.*)#/.match(part)
60
+ class_part = match.captures
61
+ simpleclass_parts.push(class_part)
62
+ is_package = false
63
+
64
+ # escape once fragment has been found, required for complex fragments that contain a '.'
65
+ break
46
66
  else
47
67
  is_package = false
48
68
  simpleclass_parts.push(part)
@@ -52,22 +72,25 @@ Asciidoctor::Extensions.register do
52
72
  package = package_parts.join('.')
53
73
  simpleclass = simpleclass_parts.join('.')
54
74
 
55
- if package.length > 0 || plugin
75
+ if package.length > 0 || plugin || component
56
76
  classname = classname.gsub(/#.*/, '')
57
77
  classurl = package.gsub(/\./, '/') + '/' + simpleclass + ".html"
58
78
 
59
- classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '') : ''
79
+ classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '').gsub(/\(\)/, '--') : ''
60
80
 
61
81
  if plugin
62
82
  label = (attrs.has_key? 'label') ? attrs['label'] : %(#{classname} in #{plugin})
63
- target = %(http://javadoc.jenkins.io/plugin/#{plugin}/#{classurl}#{classfrag})
83
+ target = %(https://javadoc.jenkins.io/plugin/#{plugin}/#{classurl}#{classfrag})
84
+ elsif component
85
+ label = (attrs.has_key? 'label') ? attrs['label'] : %(#{classname} in #{component})
86
+ target = %(https://javadoc.jenkins.io/component/#{component}/#{classurl}#{classfrag})
64
87
  else
65
88
  label = (attrs.has_key? 'label') ? attrs['label'] : classname
66
- target = %(http://javadoc.jenkins.io/#{classurl}#{classfrag})
89
+ target = %(https://javadoc.jenkins.io/#{classurl}#{classfrag})
67
90
  end
68
91
  else
69
92
  label = (attrs.has_key? 'label') ? attrs['label'] : classname
70
- target = %(http://javadoc.jenkins.io/byShortName/#{classname})
93
+ target = %(https://javadoc.jenkins.io/byShortName/#{classname})
71
94
  end
72
95
 
73
96
  title = %(Javadoc for #{classname})
@@ -84,12 +107,39 @@ Asciidoctor::Extensions.register do
84
107
 
85
108
  process do |parent, target, attrs|
86
109
 
110
+ classname = target
111
+
112
+ package_parts = Array.new
113
+ simpleclass_parts = Array.new
114
+
115
+ is_package = true
116
+
117
+ classname.split('.').each do |part|
118
+ match = /(.*)#/.match(part)
119
+ if is_package && /[[:lower:]]/.match(part[0])
120
+ package_parts.push(part)
121
+ elsif match = /(.*)#/.match(part)
122
+ class_part = match.captures
123
+ simpleclass_parts.push(class_part)
124
+ is_package = false
125
+
126
+ # escape once fragment has been found, required for complex fragments that contain a '.'
127
+ break
128
+ else
129
+ is_package = false
130
+ simpleclass_parts.push(part)
131
+ end
132
+ end
133
+
134
+ package = package_parts.join('.')
135
+ simpleclass = simpleclass_parts.join('.')
136
+
87
137
  classname = target.gsub(/#.*/, '')
88
- classurl = classname.gsub(/\./, '/') + ".html"
138
+ classurl = package.gsub(/\./, '/') + '/' + simpleclass + ".html"
89
139
 
90
- classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '') : ''
140
+ classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '').gsub(/\(\)/, '--') : ''
91
141
  label = (attrs.has_key? 'label') ? attrs['label'] : classname
92
- target = %(http://stapler.kohsuke.org/apidocs/#{classurl}#{classfrag})
142
+ target = %(https://stapler.kohsuke.org/apidocs/#{classurl}#{classfrag})
93
143
 
94
144
  title = %(Javadoc for #{classname})
95
145
 
@@ -106,12 +156,38 @@ Asciidoctor::Extensions.register do
106
156
 
107
157
  process do |parent, target, attrs|
108
158
 
159
+ classname = target
160
+
161
+ package_parts = Array.new
162
+ simpleclass_parts = Array.new
163
+
164
+ is_package = true
165
+
166
+ classname.split('.').each do |part|
167
+ if is_package && /[[:lower:]]/.match(part[0])
168
+ package_parts.push(part)
169
+ elsif match = /(.*)#/.match(part)
170
+ class_part = match.captures
171
+ simpleclass_parts.push(class_part)
172
+ is_package = false
173
+
174
+ # escape once fragment has been found, required for complex fragments that contain a '.'
175
+ break
176
+ else
177
+ is_package = false
178
+ simpleclass_parts.push(part)
179
+ end
180
+ end
181
+
182
+ package = package_parts.join('.')
183
+ simpleclass = simpleclass_parts.join('.')
184
+
109
185
  classname = target.gsub(/#.*/, '')
110
- classurl = classname.gsub(/\./, '/') + ".html"
186
+ classurl = package.gsub(/\./, '/') + '/' + simpleclass + ".html"
111
187
 
112
- classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '') : ''
188
+ classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '').gsub(/\(\)/, '--') : ''
113
189
  label = (attrs.has_key? 'label') ? attrs['label'] : classname
114
- target = %(http://docs.oracle.com/javase/7/docs/api/#{classurl}#{classfrag})
190
+ target = %(https://docs.oracle.com/javase/8/docs/api/#{classurl}#{classfrag})
115
191
 
116
192
  title = %(Javadoc for #{classname})
117
193
 
@@ -0,0 +1,23 @@
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ #
5
+ # Usage:
6
+ # jep:201[Jenkins Configuration as Code]
7
+ #
8
+ Asciidoctor::Extensions.register do
9
+ inline_macro do
10
+ named :jep
11
+ name_positional_attributes 'label'
12
+
13
+ process do |parent, target, attrs|
14
+ if attrs['label']
15
+ label = %(JEP-#{target}: #{attrs['label']})
16
+ else
17
+ label = %(JEP-#{target})
18
+ end
19
+ target = %(https://github.com/jenkinsci/jep/blob/master/jep/#{target}/README.adoc)
20
+ (create_anchor parent, label, type: :link, target: target).render
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ #
5
+ # Usage:
6
+ # jira:JENKINS-12345[Issue description]
7
+ #
8
+ Asciidoctor::Extensions.register do
9
+ inline_macro do
10
+ named :jira
11
+ name_positional_attributes 'label'
12
+
13
+ process do |parent, target, attrs|
14
+ if target.include? "-"
15
+ issueId = target
16
+ else
17
+ issueId = %(JENKINS-#{target})
18
+ end
19
+
20
+ if attrs['label']
21
+ label = %(#{issueId}: #{attrs['label']})
22
+ else
23
+ label = issueId
24
+ end
25
+
26
+ target = %(https://issues.jenkins-ci.org/browse/#{issueId})
27
+ (create_anchor parent, label, type: :link, target: target).render
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,36 @@
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ #
5
+ # Usage:
6
+ # security:12345[Issue description, date]
7
+ #
8
+ Asciidoctor::Extensions.register do
9
+ inline_macro do
10
+ named :security
11
+ name_positional_attributes 'label', 'date'
12
+
13
+ process do |parent, target, attrs|
14
+ if target.include? "-"
15
+ issueId = target
16
+ else
17
+ issueId = %(SECURITY-#{target})
18
+ end
19
+
20
+ if attrs['label']
21
+ label = %(#{issueId}: #{attrs['label']})
22
+ else
23
+ label = issueId
24
+ end
25
+
26
+ if attrs['date']
27
+ target = %(https://jenkins.io/security/advisory/#{attrs['date']}/##{issueId})
28
+ else
29
+ # TODO(oleg_nenashev): Change to a security issue redirect service if it gets created
30
+ target = %(https://jenkins.io/security/advisories/)
31
+ end
32
+
33
+ (create_anchor parent, label, type: :link, target: target).render
34
+ end
35
+ end
36
+ end
@@ -1,7 +1,7 @@
1
1
  module Asciidoctor
2
2
  module Jenkins
3
3
  module Extensions
4
- VERSION = "0.3.0"
4
+ VERSION = "0.7.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-jenkins-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - R. Tyler Croy
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-15 00:00:00.000000000 Z
11
+ date: 2020-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.5.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.5.5
27
27
  - !ruby/object:Gem::Dependency
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.11'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.11'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -161,14 +161,18 @@ extra_rdoc_files: []
161
161
  files:
162
162
  - asciidoctor-jenkins-extensions.gemspec
163
163
  - lib/asciidoctor/jenkins/extensions.rb
164
+ - lib/asciidoctor/jenkins/extensions/author-link.rb
164
165
  - lib/asciidoctor/jenkins/extensions/javadoc-link.rb
166
+ - lib/asciidoctor/jenkins/extensions/jep-link.rb
167
+ - lib/asciidoctor/jenkins/extensions/jira-link.rb
165
168
  - lib/asciidoctor/jenkins/extensions/pipeline-block.rb
166
169
  - lib/asciidoctor/jenkins/extensions/plugin-link.rb
170
+ - lib/asciidoctor/jenkins/extensions/security-link.rb
167
171
  - lib/asciidoctor/jenkins/extensions/version.rb
168
172
  homepage: https://github.com/jenkins-infra/asciidoctor-jenkins-extensions
169
173
  licenses: []
170
174
  metadata: {}
171
- post_install_message:
175
+ post_install_message:
172
176
  rdoc_options: []
173
177
  require_paths:
174
178
  - lib
@@ -183,9 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
187
  - !ruby/object:Gem::Version
184
188
  version: '0'
185
189
  requirements: []
186
- rubyforge_project:
187
- rubygems_version: 2.5.1
188
- signing_key:
190
+ rubygems_version: 3.1.2
191
+ signing_key:
189
192
  specification_version: 4
190
193
  summary: a collection of Asciidoctor extensions which enable more advanced formatting
191
194
  in Jenkins-related content.