yard-docco 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.0.2 / 2013-01-02
2
+
3
+ - Compat with YARD 0.8.3
4
+
1
5
  === 1.0.1 / 2011-08-01
2
6
 
3
7
  - FIX an issue with some inline comments not appearing
data/Rakefile CHANGED
@@ -8,6 +8,6 @@ task :clean do
8
8
  end
9
9
 
10
10
  task :gendoc => :clean do
11
- `yardoc -e ./lib/yard-docco.rb 'example/**/*' --debug`
11
+ puts `yardoc -e ./lib/yard-docco.rb 'example/**/*' --debug`
12
12
  #`open doc/index.html`
13
13
  end
data/lib/yard-docco.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module DoccoInTheYARD
2
- VERSION = '1.0.1'
2
+ VERSION = '1.0.2'
3
3
  end
4
4
 
5
5
  YARD::Templates::Engine.register_template_path File.dirname(__FILE__) + '/../templates'
@@ -1,13 +1,18 @@
1
1
  function createAnnotatedSourceLinks() {
2
- $('.method_details_list .annotated_source_code').
3
- before("<span class='showSource'>[<a href='#' class='annotatedToggleSource'>View annotated source</a>]</span>");
2
+ $('.method_details_list .annotated_source_code').each(function(index,element) {
3
+
4
+ var spanToggleAnnotatedSource = "<span class='showSource'>[<a href='#' class='annotatedToggleSource'>View Annotated source</a>]</span>";
5
+
6
+ $(element).before(spanToggleAnnotatedSource);
7
+ });
8
+
4
9
  $('.annotatedToggleSource').toggle(function() {
5
10
  $(this).parent().next().slideDown(100);
6
- $(this).text("Hide annotated source");
11
+ $(this).text("Hide Annotated source");
7
12
  },
8
13
  function() {
9
14
  $(this).parent().next().slideUp(100);
10
- $(this).text("View annotated source");
15
+ $(this).text("View Annotated source");
11
16
  });
12
17
  }
13
18
 
@@ -1,7 +1,7 @@
1
1
  def init
2
2
  super
3
-
3
+
4
4
  asset("js/docco.js",file("js/docco.js",true))
5
5
  asset("css/docco.css",file("css/docco.css",true))
6
-
6
+
7
7
  end
@@ -1,32 +1,29 @@
1
1
  def init
2
2
  super
3
-
4
- # Added the annotated source template to the end of the sections to be rendered.
5
- sections.push(:annotated_source)
6
-
7
- # object contains the method details that are about to be processed.
8
- #
3
+
4
+ # object contains the method details that are about to be processed.
5
+ #
9
6
  # object.source contains all the source within the method that we can use
10
7
  # to generate the inline documentation. We should allow for the normal sour
11
- #
12
- # Source with annotations would simply look at the source and each line with
8
+ #
9
+ # Source with annotations would simply look at the source and each line with
13
10
  # a comment would be lumped together with comments.
14
11
  object.annotated_source = annotate_source(object.source)
15
-
12
+
16
13
  end
17
14
 
18
15
  #
19
16
  # The comments within a method are just strings and have not been converted into
20
17
  # Docstrings. Here we hijack the method object and send it to the docstring
21
18
  # template to be rendered with the new docstring.
22
- #
19
+ #
23
20
  # @param [String] comments that should be converted into a docstring and then
24
21
  # rendered with the docstring template.
25
22
  # @return [String] the rendered results of the docstring
26
23
  def docstring_comment(comments)
27
24
  method_object = object.dup
28
25
  object.docstring = Docstring.new(comments,object)
29
-
26
+
30
27
  result = T('docstring').run(options)
31
28
  object = method_object
32
29
  result
@@ -36,94 +33,94 @@ end
36
33
  # This method will find the comments and then the source code (non-comments) and
37
34
  # generate an array of comment-code pairs which should be displayed next to each
38
35
  # other.
39
- #
36
+ #
40
37
  # @param [String] source that will be scanned and annotated
41
- #
38
+ #
42
39
  # @return [Array<Array<String,String>>] an array of arrays. Each element contains
43
40
  # in the first element the comments, the second contains the source code.
44
41
  def annotate_source(source)
45
-
42
+
46
43
  annotated = []
47
44
  current_comment = nil
48
45
  current_code = nil
49
46
  finished_comment = nil
50
-
47
+
51
48
  # Move through the source code line by line.
52
49
  # When we come to a comment line (starts with #) then we add a source
53
50
  # When we come to a non-comment line we are done builing that comment
54
51
  # we would then start to build the source up line by line
55
52
  source.split("\n").each do |line|
56
-
53
+
57
54
  if line =~ /^\s*#.*$/
58
-
55
+
59
56
  # When parsing a comment
60
- #
57
+ #
61
58
  # If we are parsing the first comment then we need to look to see if there
62
59
  # was some code that we were parsing and finish that code. Then we need to
63
60
  # add the comment to a new array of comments
64
- #
61
+ #
65
62
  # If this is another comment, after the first one then we need to add it
66
63
  # to the list of comments.
67
64
  if current_comment
68
65
  current_comment << line[/^\s*#\s?(.+)/,1].to_s
69
66
  else
70
-
67
+
71
68
  if current_code
72
69
  annotated << [ finished_comment, current_code ]
73
70
  finished_comment = current_code = nil
74
-
71
+
75
72
  end
76
-
73
+
77
74
  (current_comment ||=[]) << line[/^\s*#\s?(.+)/,1].to_s
78
75
  end
79
-
76
+
80
77
  else
81
78
 
82
79
  # When parsing a line of code
83
- #
80
+ #
84
81
  # If we are parsing the first line of code then if there are any comments
85
82
  # then we are done with the comments that are associated with this line of
86
83
  # code (and any lines that follow). We want to save the finished block of
87
84
  # comments so that we can put it together with the code when we are finished
88
85
  # with it.
89
- #
86
+ #
90
87
  if current_comment
91
88
  finished_comment = current_comment
92
89
  current_comment = nil
93
90
  else
94
91
  # We were not working on a comment
95
92
  end
96
-
93
+
97
94
  # Add the current code line to the current_code if one exists (create one if it does not exist)
98
95
  (current_code ||= []) << line.to_s
99
-
96
+
100
97
  end
101
-
98
+
102
99
  end
103
-
100
+
104
101
  # If we have finished parsing lines and we still have code within a home, which
105
102
  # is likely if the the source code ends with an end. We want to create a new pair
106
103
  if current_code
107
104
  annotated << [ finished_comment, current_code ]
108
105
  current_code = nil
109
106
  end
110
-
107
+
111
108
  # If we have a comment that still remains, then the comment exists without
112
109
  # source and we should add it the pairs.
113
110
  if current_comment
114
111
  annotated << [ current_comment, "" ]
115
112
  current_comment = nil
116
113
  end
117
-
114
+
118
115
  return annotated
119
116
  end
120
117
 
121
118
  def show_annotated_lines(section)
122
119
  @current_count ||= object.line
123
-
120
+
124
121
  # Add the comment line length to the line number
125
122
  @current_count += Array(section.first).length
126
-
123
+
127
124
  lines = (@current_count..(@current_count+Array(section.last).length)).to_a.join("\n")
128
125
  @current_count += Array(section.last).length
129
126
  lines
data/yard-docco.gemspec CHANGED
@@ -52,7 +52,7 @@ Gem::Specification.new do |s|
52
52
 
53
53
  }
54
54
 
55
- s.add_dependency 'yard', '>= 0.7.0'
55
+ s.add_dependency 'yard', '~> 0.8.3'
56
56
 
57
57
  s.rubygems_version = "1.3.7"
58
58
  s.files = `git ls-files`.split("\n")
metadata CHANGED
@@ -1,39 +1,42 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: yard-docco
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
4
5
  prerelease:
5
- version: 1.0.1
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Franklin Webber
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-01 00:00:00 -07:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2013-01-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: yard
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.7.0
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.8.3
25
22
  type: :runtime
26
- version_requirements: *id001
27
- description: " \n YARD-Docco is a YARD extension that provides an additional source view that\n will show comments alongside the source code within a method. "
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.3
30
+ description: ! " \n YARD-Docco is a YARD extension that provides an additional
31
+ source view that\n will show comments alongside the source code within a method.
32
+ \ "
28
33
  email: franklin.webber@gmail.com
29
34
  executables: []
30
-
31
35
  extensions: []
32
-
33
- extra_rdoc_files:
36
+ extra_rdoc_files:
34
37
  - README.md
35
38
  - History.txt
36
- files:
39
+ files:
37
40
  - History.txt
38
41
  - README.md
39
42
  - Rakefile
@@ -42,40 +45,37 @@ files:
42
45
  - templates/default/fulldoc/html/css/docco.css
43
46
  - templates/default/fulldoc/html/js/docco.js
44
47
  - templates/default/fulldoc/html/setup.rb
45
- - templates/default/layout/html/setup.rb
46
48
  - templates/default/method_details/html/annotated_source.erb
47
49
  - templates/default/method_details/html/setup.rb
48
50
  - templates/default/method_details/html/source.erb
49
51
  - yard-docco.gemspec
50
- has_rdoc: true
51
52
  homepage: http://github.com/burtlo/yard-docco
52
53
  licenses: []
53
-
54
- post_install_message: "\n\
55
- (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==)\n\n Thank you for installing yard-docco 1.0.1 / 2011-08-01.\n \n Changes:\n \n - FIX an issue with some inline comments not appearing\n \n\n\
56
- (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==)\n\n"
57
- rdoc_options:
54
+ post_install_message: ! "\n(==) (==) (==) (==) (==) (==) (==) (==) (==) (==) (==)
55
+ (==) (==) (==) (==)\n\n Thank you for installing yard-docco 1.0.2 / 2013-01-02.\n
56
+ \ \n Changes:\n \n - Compat with YARD 0.8.3\n \n\n(==) (==) (==) (==) (==)
57
+ (==) (==) (==) (==) (==) (==) (==) (==) (==) (==)\n\n"
58
+ rdoc_options:
58
59
  - --charset=UTF-8
59
- require_paths:
60
+ require_paths:
60
61
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
62
+ required_ruby_version: !ruby/object:Gem::Requirement
62
63
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: "0"
67
- required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
69
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- version: "0"
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
73
74
  requirements: []
74
-
75
75
  rubyforge_project:
76
- rubygems_version: 1.6.2
76
+ rubygems_version: 1.8.24
77
77
  signing_key:
78
78
  specification_version: 3
79
79
  summary: Docco style documentation within methods
80
80
  test_files: []
81
-
81
+ has_rdoc:
@@ -1,17 +0,0 @@
1
- def init
2
- super
3
- end
4
-
5
- #
6
- # Append yard-docco stylesheet to yard core stylesheets
7
- #
8
- def stylesheets
9
- super + %w(css/docco.css)
10
- end
11
-
12
- #
13
- # Append yard-docco javascript to yard core javascripts
14
- #
15
- def javascripts
16
- super + %w(js/docco.js)
17
- end