asciidoctor-jenkins-extensions 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: bb1de6bbfef89d0eca8d18655598ad6b506579e4
4
- data.tar.gz: 048acf1c7f174f52868c244abdc4956e4c36df5c
3
+ metadata.gz: b20df85998143d1d7564e4f5610978056be4ef3a
4
+ data.tar.gz: e4a1846370a46d92f496062407e37f794279539a
5
5
  SHA512:
6
- metadata.gz: d3a2f33d658a5b66bc8de2d39cd47de3d82b5fb99572417fa1f08e9e9e229b2b5076ab00c5f4b86c061e968b4a15b75406a96c2f031cb0899aa9ab8a92afb5f2
7
- data.tar.gz: 4dab70e2a1c188b719910b5b2a754e3ce68392b2ca372e0c18ec2a108a83ea34d01ff7289277197cae9b0e2148339e33a29cbf8e63ef683b0d860a22af01422d
6
+ metadata.gz: 39ccbfae10d529c3e1c7373d36121abed711ab79d0b73f9eb85cdb08eb4797e86ba6da9a3ad99d547882188f5077556bd4972b8a7dc4151bf7e6be66ebe25325
7
+ data.tar.gz: 96be257c07ddcdb6be0b9943c2b1831f1f89478fa53b42ae875595bcfa68e1b8f801f20da6fcc6f43a8c91b5f6baba1645dba6141d35d39d736c1898f0ab9289
@@ -0,0 +1,104 @@
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ #
5
+ # Usage:
6
+ #
7
+ # For core Javadoc:
8
+ #
9
+ # jenkinsdoc:SCM[]
10
+ # jenkinsdoc:SCM[some label]
11
+ # jenkinsdoc:hudson.scm.SCM[]
12
+ # jenkinsdoc:hudson.scm.SCM[some label]
13
+ # jenkinsdoc:hudson.scm.SCM#anchor[]
14
+ # jenkinsdoc:hudson.scm.SCM#anchor[some label]
15
+ #
16
+ #
17
+ # For plugin Javadoc:
18
+ #
19
+ # jenkinsdoc:git:hudson.plugins.git.GitSCM[]
20
+ # jenkinsdoc:git:hudson.plugins.git.GitSCM[some label]
21
+ # jenkinsdoc:git:hudson.plugins.git.GitSCM#anchor[]
22
+ # jenkinsdoc:git:hudson.plugins.git.GitSCM#anchor[some label]
23
+
24
+ Asciidoctor::Extensions.register do
25
+ inline_macro do
26
+ named :jenkinsdoc
27
+ name_positional_attributes 'label'
28
+
29
+ process do |parent, target, attrs|
30
+
31
+ if target.include? ":"
32
+ parts = target.split(':', 2)
33
+ plugin = parts.first
34
+ target = parts.last
35
+ end
36
+ classname = label = title = target
37
+
38
+ if classname.include? "." || plugin
39
+ classname = classname.gsub(/#.*/, '')
40
+ classurl = classname.gsub(/\./, '/') + ".html"
41
+
42
+ classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '') : ''
43
+
44
+ if plugin
45
+ label = (attrs.has_key? 'label') ? attrs['label'] : %(#{classname} in #{plugin})
46
+ target = %(http://javadoc.jenkins.io/plugin/#{plugin}/#{classurl}#{classfrag})
47
+ else
48
+ label = (attrs.has_key? 'label') ? attrs['label'] : classname
49
+ target = %(http://javadoc.jenkins.io/#{classurl}#{classfrag})
50
+ end
51
+ else
52
+ label = (attrs.has_key? 'label') ? attrs['label'] : classname
53
+ target = %(http://javadoc.jenkins.io/byShortName/#{classname})
54
+ end
55
+
56
+ title = %(Javadoc for #{classname})
57
+
58
+ (create_anchor parent, label, type: :link, target: target, attributes: {'title' => title}).render
59
+ end
60
+ end
61
+ end
62
+
63
+ Asciidoctor::Extensions.register do
64
+ inline_macro do
65
+ named :staplerdoc
66
+ name_positional_attributes 'label'
67
+
68
+ process do |parent, target, attrs|
69
+
70
+ classname = target.gsub(/#.*/, '')
71
+ classurl = classname.gsub(/\./, '/') + ".html"
72
+
73
+ classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '') : ''
74
+ label = (attrs.has_key? 'label') ? attrs['label'] : classname
75
+ target = %(http://stapler.kohsuke.org/apidocs/#{classurl}#{classfrag})
76
+
77
+ title = %(Javadoc for #{classname})
78
+
79
+ (create_anchor parent, label, type: :link, target: target, attributes: {'title' => title}).render
80
+ end
81
+ end
82
+ end
83
+
84
+
85
+ Asciidoctor::Extensions.register do
86
+ inline_macro do
87
+ named :javadoc
88
+ name_positional_attributes 'label'
89
+
90
+ process do |parent, target, attrs|
91
+
92
+ classname = target.gsub(/#.*/, '')
93
+ classurl = classname.gsub(/\./, '/') + ".html"
94
+
95
+ classfrag = (target.include? "#") ? '#' + target.gsub(/.*#/, '') : ''
96
+ label = (attrs.has_key? 'label') ? attrs['label'] : classname
97
+ target = %(http://docs.oracle.com/javase/7/docs/api/#{classurl}#{classfrag})
98
+
99
+ title = %(Javadoc for #{classname})
100
+
101
+ (create_anchor parent, label, type: :link, target: target, attributes: {'title' => title}).render
102
+ end
103
+ end
104
+ end
@@ -0,0 +1,19 @@
1
+ require 'asciidoctor'
2
+ require 'asciidoctor/extensions'
3
+
4
+ #
5
+ # Usage:
6
+ # plugin:git[Git plugin]
7
+ #
8
+ Asciidoctor::Extensions.register do
9
+ inline_macro do
10
+ named :plugin
11
+ name_positional_attributes 'label'
12
+
13
+ process do |parent, target, attrs|
14
+ label = attrs['label']
15
+ target = %(https://plugins.jenkins.io/#{target})
16
+ (create_anchor parent, label, type: :link, target: target).render
17
+ end
18
+ end
19
+ end
@@ -1,7 +1,7 @@
1
1
  module Asciidoctor
2
2
  module Jenkins
3
3
  module Extensions
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-jenkins-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - R. Tyler Croy
@@ -161,7 +161,9 @@ extra_rdoc_files: []
161
161
  files:
162
162
  - asciidoctor-jenkins-extensions.gemspec
163
163
  - lib/asciidoctor/jenkins/extensions.rb
164
+ - lib/asciidoctor/jenkins/extensions/javadoc-link.rb
164
165
  - lib/asciidoctor/jenkins/extensions/pipeline-block.rb
166
+ - lib/asciidoctor/jenkins/extensions/plugin-link.rb
165
167
  - lib/asciidoctor/jenkins/extensions/version.rb
166
168
  homepage: https://github.com/jenkins-infra/asciidoctor-jenkins-extensions
167
169
  licenses: []