hoe-manualgen 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/ruby
2
- #
2
+ #
3
3
  # A manual filter to generate links from the Darkfish API.
4
- #
4
+ #
5
5
  # Authors:
6
6
  # * Michael Granger <ged@FaerieMUD.org>
7
7
  # * Mahlon E. Smith <mahlon@martini.nu>
8
- #
8
+ #
9
9
 
10
10
 
11
11
  ### A filter for generating links from the generated API documentation. This allows you to refer
@@ -14,8 +14,14 @@
14
14
  ### Links are XML processing instructions. Pages can be referenced as such:
15
15
  ###
16
16
  ### <?api Class::Name ?>
17
+ ### <?api Class::Name#instance_method ?>
18
+ ### <?api Class::Name.class_method ?>
19
+ ###
20
+ ### Link text can be overridden, too:
21
+ ###
17
22
  ### <?api "click here":Class::Name ?>
18
- ###
23
+ ### <?api "click here":Class::Name#instance_method ?>
24
+ ###
19
25
  class Hoe::ManualGen::APIFilter < Hoe::ManualGen::PageFilter
20
26
 
21
27
  # PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
@@ -27,6 +33,7 @@ class Hoe::ManualGen::APIFilter < Hoe::ManualGen::PageFilter
27
33
  (.*?) # Optional link text [$1]
28
34
  ":)?
29
35
  (.*?) # Class name [$2]
36
+ ([\.#].*?)? # Method anchor [$3]
30
37
  \s+
31
38
  \?>
32
39
  }x
@@ -44,26 +51,27 @@ class Hoe::ManualGen::APIFilter < Hoe::ManualGen::PageFilter
44
51
 
45
52
  return source.gsub( ApiPI ) do |match|
46
53
  # Grab the tag values
47
- link_text = $1
48
- classname = $2
54
+ link_text = $1
55
+ classname = $2
56
+ methodname = $3
49
57
 
50
- self.generate_link( page, apipath, classname, link_text )
58
+ self.generate_link( page, apipath, classname, methodname, link_text )
51
59
  end
52
60
  end
53
61
 
54
62
 
55
63
  ### Create an HTML link fragment from the parsed ApiPI.
56
- ###
57
- def generate_link( current_page, apipath, classname, link_text=nil )
64
+ def generate_link( current_page, apipath, classname, methodname=nil, link_text=nil )
58
65
 
59
66
  classpath = "%s.html" % [ classname.gsub('::', '/') ]
60
67
  classfile = apipath + classpath
61
- classuri = current_page.basepath + 'api' + classpath
68
+ classuri = current_page.basepath + 'api' + classpath
62
69
 
63
70
  if classfile.exist?
64
- return %{<a href="%s">%s</a>} % [
71
+ return %{<a href="%s%s">%s</a>} % [
65
72
  classuri,
66
- link_text || classname
73
+ make_anchor( methodname ),
74
+ link_text || (classname + methodname || '')
67
75
  ]
68
76
  else
69
77
  link_text ||= classname
@@ -72,5 +80,17 @@ class Hoe::ManualGen::APIFilter < Hoe::ManualGen::PageFilter
72
80
  return %{<a href="#" title="#{error_message}" class="broken-link">#{link_text}</a>}
73
81
  end
74
82
  end
83
+
84
+
85
+ ### Attach a method anchor.
86
+ def make_anchor( methodname )
87
+ return '' unless methodname
88
+
89
+ method_type = methodname[ 0, 1 ]
90
+ return "#method-%s-%s" % [
91
+ ( method_type == '#' ? 'i' : 'c' ),
92
+ methodname[ 1..-1 ]
93
+ ]
94
+ end
75
95
  end
76
96
 
data/lib/hoe/manualgen.rb CHANGED
@@ -31,10 +31,10 @@ module Hoe::ManualGen
31
31
  include FileUtils::DryRun if Rake.application.options.dryrun
32
32
 
33
33
  # Library version constant
34
- VERSION = '0.1.1'
34
+ VERSION = '0.2.0'
35
35
 
36
36
  # Version-control revision constant
37
- REVISION = %q$Revision: 7b431d0b1024 $
37
+ REVISION = %q$Revision: b775fc3856f5 $
38
38
 
39
39
  # Configuration defaults
40
40
  DEFAULT_BASE_DIR = Pathname( 'manual' )
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,184 +1,162 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hoe-manualgen
3
- version: !ruby/object:Gem::Version
4
- hash: 25
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Granger
14
9
  autorequire:
15
10
  bindir: bin
16
- cert_chain:
17
- - |
18
- -----BEGIN CERTIFICATE-----
11
+ cert_chain:
12
+ - ! '-----BEGIN CERTIFICATE-----
13
+
19
14
  MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
15
+
20
16
  FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
17
+
21
18
  DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
19
+
22
20
  FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
21
+
23
22
  DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
23
+
24
24
  h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
25
+
25
26
  vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
27
+
26
28
  KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
29
+
27
30
  BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
31
+
28
32
  TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
33
+
29
34
  AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
35
+
30
36
  +saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
37
+
31
38
  vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
39
+
32
40
  HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
41
+
33
42
  aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
43
+
34
44
  U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
45
+
35
46
  cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
47
+
36
48
  -----END CERTIFICATE-----
37
49
 
38
- date: 2011-06-29 00:00:00 Z
39
- dependencies:
40
- - !ruby/object:Gem::Dependency
50
+ '
51
+ date: 2011-08-15 00:00:00.000000000Z
52
+ dependencies:
53
+ - !ruby/object:Gem::Dependency
41
54
  name: hoe
42
- prerelease: false
43
- requirement: &id001 !ruby/object:Gem::Requirement
55
+ requirement: &70213889262460 !ruby/object:Gem::Requirement
44
56
  none: false
45
- requirements:
57
+ requirements:
46
58
  - - ~>
47
- - !ruby/object:Gem::Version
48
- hash: 17
49
- segments:
50
- - 2
51
- - 9
52
- version: "2.9"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.10'
53
61
  type: :runtime
54
- version_requirements: *id001
55
- - !ruby/object:Gem::Dependency
56
- name: RedCloth
57
62
  prerelease: false
58
- requirement: &id002 !ruby/object:Gem::Requirement
63
+ version_requirements: *70213889262460
64
+ - !ruby/object:Gem::Dependency
65
+ name: RedCloth
66
+ requirement: &70213889261920 !ruby/object:Gem::Requirement
59
67
  none: false
60
- requirements:
68
+ requirements:
61
69
  - - ~>
62
- - !ruby/object:Gem::Version
63
- hash: 31
64
- segments:
65
- - 4
66
- - 2
67
- version: "4.2"
70
+ - !ruby/object:Gem::Version
71
+ version: '4.2'
68
72
  type: :runtime
69
- version_requirements: *id002
70
- - !ruby/object:Gem::Dependency
71
- name: rcodetools
72
73
  prerelease: false
73
- requirement: &id003 !ruby/object:Gem::Requirement
74
+ version_requirements: *70213889261920
75
+ - !ruby/object:Gem::Dependency
76
+ name: rcodetools
77
+ requirement: &70213889261500 !ruby/object:Gem::Requirement
74
78
  none: false
75
- requirements:
79
+ requirements:
76
80
  - - ~>
77
- - !ruby/object:Gem::Version
78
- hash: 27
79
- segments:
80
- - 0
81
- - 8
82
- version: "0.8"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.8'
83
83
  type: :runtime
84
- version_requirements: *id003
85
- - !ruby/object:Gem::Dependency
86
- name: hoe-mercurial
87
84
  prerelease: false
88
- requirement: &id004 !ruby/object:Gem::Requirement
85
+ version_requirements: *70213889261500
86
+ - !ruby/object:Gem::Dependency
87
+ name: hoe-mercurial
88
+ requirement: &70213889260960 !ruby/object:Gem::Requirement
89
89
  none: false
90
- requirements:
90
+ requirements:
91
91
  - - ~>
92
- - !ruby/object:Gem::Version
93
- hash: 29
94
- segments:
95
- - 1
96
- - 2
97
- - 1
92
+ - !ruby/object:Gem::Version
98
93
  version: 1.2.1
99
94
  type: :development
100
- version_requirements: *id004
101
- - !ruby/object:Gem::Dependency
102
- name: hoe-highline
103
95
  prerelease: false
104
- requirement: &id005 !ruby/object:Gem::Requirement
96
+ version_requirements: *70213889260960
97
+ - !ruby/object:Gem::Dependency
98
+ name: hoe-highline
99
+ requirement: &70213889260380 !ruby/object:Gem::Requirement
105
100
  none: false
106
- requirements:
101
+ requirements:
107
102
  - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 29
110
- segments:
111
- - 0
112
- - 0
113
- - 1
103
+ - !ruby/object:Gem::Version
114
104
  version: 0.0.1
115
105
  type: :development
116
- version_requirements: *id005
117
- - !ruby/object:Gem::Dependency
118
- name: tidy-ext
119
106
  prerelease: false
120
- requirement: &id006 !ruby/object:Gem::Requirement
107
+ version_requirements: *70213889260380
108
+ - !ruby/object:Gem::Dependency
109
+ name: rspec
110
+ requirement: &70213889259920 !ruby/object:Gem::Requirement
121
111
  none: false
122
- requirements:
112
+ requirements:
123
113
  - - ~>
124
- - !ruby/object:Gem::Version
125
- hash: 9
126
- segments:
127
- - 0
128
- - 1
129
- version: "0.1"
114
+ - !ruby/object:Gem::Version
115
+ version: '2.4'
130
116
  type: :development
131
- version_requirements: *id006
132
- - !ruby/object:Gem::Dependency
133
- name: rspec
134
117
  prerelease: false
135
- requirement: &id007 !ruby/object:Gem::Requirement
118
+ version_requirements: *70213889259920
119
+ - !ruby/object:Gem::Dependency
120
+ name: tidy-ext
121
+ requirement: &70213889259400 !ruby/object:Gem::Requirement
136
122
  none: false
137
- requirements:
123
+ requirements:
138
124
  - - ~>
139
- - !ruby/object:Gem::Version
140
- hash: 11
141
- segments:
142
- - 2
143
- - 4
144
- version: "2.4"
125
+ - !ruby/object:Gem::Version
126
+ version: '0.1'
145
127
  type: :development
146
- version_requirements: *id007
147
- - !ruby/object:Gem::Dependency
148
- name: hoe
149
128
  prerelease: false
150
- requirement: &id008 !ruby/object:Gem::Requirement
129
+ version_requirements: *70213889259400
130
+ - !ruby/object:Gem::Dependency
131
+ name: hoe
132
+ requirement: &70213889258840 !ruby/object:Gem::Requirement
151
133
  none: false
152
- requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- hash: 35
156
- segments:
157
- - 2
158
- - 9
159
- - 4
160
- version: 2.9.4
134
+ requirements:
135
+ - - ~>
136
+ - !ruby/object:Gem::Version
137
+ version: '2.10'
161
138
  type: :development
162
- version_requirements: *id008
163
- description: |-
164
- A manual-generation plugin for Hoe.
165
-
139
+ prerelease: false
140
+ version_requirements: *70213889258840
141
+ description: ! 'A manual-generation plugin for Hoe.
142
+
143
+
166
144
  This is a plugin for [Hoe][hoe] that adds tasks and resources for
145
+
167
146
  generating a manual or cookbook.
168
-
169
- It's self-documenting, so for more, see [the latest manual for hoe-manualgen itself][hoe-manualgen-manual].
170
- email:
147
+
148
+
149
+ It''s self-documenting, so for more, see [the latest manual for hoe-manualgen itself][hoe-manualgen-manual].'
150
+ email:
171
151
  - ged@FaerieMUD.org
172
152
  executables: []
173
-
174
153
  extensions: []
175
-
176
- extra_rdoc_files:
154
+ extra_rdoc_files:
177
155
  - data/hoe-manualgen/lib/api-filter.rb
178
156
  - data/hoe-manualgen/lib/editorial-filter.rb
179
157
  - data/hoe-manualgen/lib/examples-filter.rb
180
158
  - data/hoe-manualgen/lib/links-filter.rb
181
- files:
159
+ files:
182
160
  - .autotest
183
161
  - History.md
184
162
  - README.md
@@ -218,40 +196,30 @@ files:
218
196
  - data/hoe-manualgen/src/index.page.erb
219
197
  - lib/hoe/manualgen.rb
220
198
  homepage: http://deveiate.org/hoe-manualgen.html
221
- licenses:
199
+ licenses:
222
200
  - BSD
223
201
  post_install_message:
224
- rdoc_options:
202
+ rdoc_options:
225
203
  - --main
226
204
  - README.md
227
- require_paths:
205
+ require_paths:
228
206
  - lib
229
- required_ruby_version: !ruby/object:Gem::Requirement
207
+ required_ruby_version: !ruby/object:Gem::Requirement
230
208
  none: false
231
- requirements:
232
- - - ">="
233
- - !ruby/object:Gem::Version
234
- hash: 57
235
- segments:
236
- - 1
237
- - 8
238
- - 7
209
+ requirements:
210
+ - - ! '>='
211
+ - !ruby/object:Gem::Version
239
212
  version: 1.8.7
240
- required_rubygems_version: !ruby/object:Gem::Requirement
213
+ required_rubygems_version: !ruby/object:Gem::Requirement
241
214
  none: false
242
- requirements:
243
- - - ">="
244
- - !ruby/object:Gem::Version
245
- hash: 3
246
- segments:
247
- - 0
248
- version: "0"
215
+ requirements:
216
+ - - ! '>='
217
+ - !ruby/object:Gem::Version
218
+ version: '0'
249
219
  requirements: []
250
-
251
220
  rubyforge_project: hoe-manualgen
252
- rubygems_version: 1.8.4
221
+ rubygems_version: 1.8.6
253
222
  signing_key:
254
223
  specification_version: 3
255
224
  summary: A manual-generation plugin for Hoe
256
225
  test_files: []
257
-
metadata.gz.sig CHANGED
Binary file