rdoc 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (52) hide show
  1. data.tar.gz.sig +1 -0
  2. data/History.txt +30 -0
  3. data/Manifest.txt +18 -6
  4. data/Rakefile +52 -0
  5. data/lib/rdoc.rb +69 -69
  6. data/lib/rdoc/code_objects.rb +331 -112
  7. data/lib/rdoc/generator.rb +172 -144
  8. data/lib/rdoc/generator/html.rb +45 -18
  9. data/lib/rdoc/generator/html/frameless.rb +795 -0
  10. data/lib/rdoc/generator/html/hefss.rb +11 -11
  11. data/lib/rdoc/generator/html/html.rb +81 -87
  12. data/lib/rdoc/generator/html/kilmer.rb +10 -10
  13. data/lib/rdoc/generator/html/one_page_html.rb +9 -9
  14. data/lib/rdoc/generator/ri.rb +5 -8
  15. data/lib/rdoc/generator/texinfo.rb +84 -0
  16. data/lib/rdoc/generator/texinfo/class.texinfo.erb +44 -0
  17. data/lib/rdoc/generator/texinfo/file.texinfo.erb +6 -0
  18. data/lib/rdoc/generator/texinfo/method.texinfo.erb +6 -0
  19. data/lib/rdoc/generator/texinfo/texinfo.erb +28 -0
  20. data/lib/rdoc/known_classes.rb +69 -0
  21. data/lib/rdoc/markup.rb +3 -3
  22. data/lib/rdoc/markup/attribute_manager.rb +0 -9
  23. data/lib/rdoc/markup/fragments.rb +1 -1
  24. data/lib/rdoc/markup/preprocess.rb +10 -6
  25. data/lib/rdoc/markup/to_html.rb +55 -8
  26. data/lib/rdoc/markup/to_html_crossref.rb +21 -5
  27. data/lib/rdoc/markup/to_texinfo.rb +69 -0
  28. data/lib/rdoc/options.rb +37 -14
  29. data/lib/rdoc/parser.rb +109 -0
  30. data/lib/rdoc/parser/c.rb +656 -0
  31. data/lib/rdoc/parser/f95.rb +1835 -0
  32. data/lib/rdoc/{parsers/parse_rb.rb → parser/ruby.rb} +1436 -1191
  33. data/lib/rdoc/parser/simple.rb +38 -0
  34. data/lib/rdoc/rdoc.rb +48 -32
  35. data/lib/rdoc/ri.rb +5 -1
  36. data/lib/rdoc/ri/descriptions.rb +8 -5
  37. data/lib/rdoc/ri/driver.rb +148 -49
  38. data/lib/rdoc/stats.rb +94 -4
  39. data/test/test_rdoc_info_formatting.rb +175 -0
  40. data/test/test_rdoc_info_sections.rb +136 -0
  41. data/test/test_rdoc_markup_to_html.rb +30 -0
  42. data/test/test_rdoc_markup_to_html_crossref.rb +18 -0
  43. data/test/{test_rdoc_c_parser.rb → test_rdoc_parser_c.rb} +8 -11
  44. data/test/test_rdoc_parser_ruby.rb +539 -0
  45. data/test/test_rdoc_ri_default_display.rb +17 -16
  46. data/test/test_rdoc_ri_driver.rb +92 -0
  47. metadata +54 -12
  48. metadata.gz.sig +0 -0
  49. data/lib/rdoc/parsers/parse_c.rb +0 -775
  50. data/lib/rdoc/parsers/parse_f95.rb +0 -1841
  51. data/lib/rdoc/parsers/parse_simple.rb +0 -40
  52. data/lib/rdoc/parsers/parserfactory.rb +0 -99
@@ -1,40 +0,0 @@
1
- require 'rdoc'
2
- require 'rdoc/code_objects'
3
- require 'rdoc/markup/preprocess'
4
-
5
- ##
6
- # Parse a non-source file. We basically take the whole thing as one big
7
- # comment. If the first character in the file is '#', we strip leading pound
8
- # signs.
9
-
10
- class RDoc::SimpleParser
11
-
12
- ##
13
- # Prepare to parse a plain file
14
-
15
- def initialize(top_level, file_name, body, options, stats)
16
- preprocess = RDoc::Markup::PreProcess.new(file_name, options.rdoc_include)
17
-
18
- preprocess.handle(body) do |directive, param|
19
- warn "Unrecognized directive '#{directive}' in #{file_name}"
20
- end
21
-
22
- @body = body
23
- @options = options
24
- @top_level = top_level
25
- end
26
-
27
- ##
28
- # Extract the file contents and attach them to the toplevel as a comment
29
-
30
- def scan
31
- @top_level.comment = remove_private_comments(@body)
32
- @top_level
33
- end
34
-
35
- def remove_private_comments(comment)
36
- comment.gsub(/^--[^-].*?^\+\+/m, '').sub(/^--.*/m, '')
37
- end
38
-
39
- end
40
-
@@ -1,99 +0,0 @@
1
- require "rdoc/parsers/parse_simple"
2
-
3
- module RDoc
4
-
5
- # A parser is simple a class that implements
6
- #
7
- # #initialize(file_name, body, options)
8
- #
9
- # and
10
- #
11
- # #scan
12
- #
13
- # The initialize method takes a file name to be used, the body of the
14
- # file, and an RDoc::Options object. The scan method is then called
15
- # to return an appropriately parsed TopLevel code object.
16
- #
17
- # The ParseFactory is used to redirect to the correct parser given a filename
18
- # extension. This magic works because individual parsers have to register
19
- # themselves with us as they are loaded in. The do this using the following
20
- # incantation
21
- #
22
- #
23
- # require "rdoc/parsers/parsefactory"
24
- #
25
- # module RDoc
26
- #
27
- # class XyzParser
28
- # extend ParseFactory <<<<
29
- # parse_files_matching /\.xyz$/ <<<<
30
- #
31
- # def initialize(file_name, body, options)
32
- # ...
33
- # end
34
- #
35
- # def scan
36
- # ...
37
- # end
38
- # end
39
- # end
40
- #
41
- # Just to make life interesting, if we suspect a plain text file, we
42
- # also look for a shebang line just in case it's a potential
43
- # shell script
44
-
45
-
46
-
47
- module ParserFactory
48
-
49
- @@parsers = []
50
-
51
- Parsers = Struct.new(:regexp, :parser)
52
-
53
- # Record the fact that a particular class parses files that
54
- # match a given extension
55
-
56
- def parse_files_matching(regexp)
57
- @@parsers.unshift Parsers.new(regexp, self)
58
- end
59
-
60
- # Return a parser that can handle a particular extension
61
-
62
- def ParserFactory.can_parse(file_name)
63
- @@parsers.find {|p| p.regexp.match(file_name) }
64
- end
65
-
66
- # Alias an extension to another extension. After this call,
67
- # files ending "new_ext" will be parsed using the same parser
68
- # as "old_ext"
69
-
70
- def ParserFactory.alias_extension(old_ext, new_ext)
71
- parser = ParserFactory.can_parse("xxx.#{old_ext}")
72
- return false unless parser
73
- @@parsers.unshift Parsers.new(Regexp.new("\\.#{new_ext}$"), parser.parser)
74
- true
75
- end
76
-
77
- # Find the correct parser for a particular file name. Return a
78
- # SimpleParser for ones that we don't know
79
-
80
- def ParserFactory.parser_for(top_level, file_name, body, options, stats)
81
- # If no extension, look for shebang
82
- if file_name !~ /\.\w+$/ && body =~ %r{\A#!(.+)}
83
- shebang = $1
84
- case shebang
85
- when %r{env\s+ruby}, %r{/ruby}
86
- file_name = "dummy.rb"
87
- end
88
- end
89
- parser_description = can_parse(file_name)
90
- if parser_description
91
- parser = parser_description.parser
92
- else
93
- parser = SimpleParser
94
- end
95
-
96
- parser.new(top_level, file_name, body, options, stats)
97
- end
98
- end
99
- end