voloko-sdoc 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/rdoc/History.txt +254 -0
  2. data/rdoc/Manifest.txt +126 -0
  3. data/rdoc/README.txt +47 -0
  4. data/rdoc/RI.txt +58 -0
  5. data/rdoc/Rakefile +70 -0
  6. data/rdoc/bin/rdoc +35 -0
  7. data/rdoc/bin/ri +5 -0
  8. data/rdoc/lib/rdoc/alias.rb +54 -0
  9. data/rdoc/lib/rdoc/anon_class.rb +10 -0
  10. data/rdoc/lib/rdoc/any_method.rb +190 -0
  11. data/rdoc/lib/rdoc/attr.rb +79 -0
  12. data/rdoc/lib/rdoc/cache.rb +41 -0
  13. data/rdoc/lib/rdoc/class_module.rb +87 -0
  14. data/rdoc/lib/rdoc/code_object.rb +152 -0
  15. data/rdoc/lib/rdoc/code_objects.rb +23 -0
  16. data/rdoc/lib/rdoc/constant.rb +36 -0
  17. data/rdoc/lib/rdoc/context.rb +712 -0
  18. data/rdoc/lib/rdoc/diagram.rb +340 -0
  19. data/rdoc/lib/rdoc/dot.rb +249 -0
  20. data/rdoc/lib/rdoc/generator/darkfish.rb +455 -0
  21. data/rdoc/lib/rdoc/generator/markup.rb +194 -0
  22. data/rdoc/lib/rdoc/generator/ri.rb +230 -0
  23. data/rdoc/lib/rdoc/generator/template/darkfish/classpage.rhtml +281 -0
  24. data/rdoc/lib/rdoc/generator/template/darkfish/filepage.rhtml +112 -0
  25. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  26. data/rdoc/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  27. data/rdoc/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  28. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  29. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  30. data/rdoc/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  31. data/rdoc/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  32. data/rdoc/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  33. data/rdoc/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  34. data/rdoc/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  35. data/rdoc/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  36. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  37. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  38. data/rdoc/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  39. data/rdoc/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  40. data/rdoc/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  41. data/rdoc/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  42. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  43. data/rdoc/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  44. data/rdoc/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  45. data/rdoc/lib/rdoc/generator/template/darkfish/index.rhtml +64 -0
  46. data/rdoc/lib/rdoc/generator/template/darkfish/js/darkfish.js +116 -0
  47. data/rdoc/lib/rdoc/generator/template/darkfish/js/jquery.js +32 -0
  48. data/rdoc/lib/rdoc/generator/template/darkfish/js/quicksearch.js +114 -0
  49. data/rdoc/lib/rdoc/generator/template/darkfish/js/thickbox-compressed.js +10 -0
  50. data/rdoc/lib/rdoc/generator/template/darkfish/rdoc.css +696 -0
  51. data/rdoc/lib/rdoc/generator.rb +8 -0
  52. data/rdoc/lib/rdoc/ghost_method.rb +8 -0
  53. data/rdoc/lib/rdoc/include.rb +39 -0
  54. data/rdoc/lib/rdoc/known_classes.rb +68 -0
  55. data/rdoc/lib/rdoc/markup/attribute_manager.rb +311 -0
  56. data/rdoc/lib/rdoc/markup/formatter.rb +25 -0
  57. data/rdoc/lib/rdoc/markup/fragments.rb +377 -0
  58. data/rdoc/lib/rdoc/markup/inline.rb +126 -0
  59. data/rdoc/lib/rdoc/markup/lines.rb +156 -0
  60. data/rdoc/lib/rdoc/markup/preprocess.rb +80 -0
  61. data/rdoc/lib/rdoc/markup/to_flow.rb +211 -0
  62. data/rdoc/lib/rdoc/markup/to_html.rb +406 -0
  63. data/rdoc/lib/rdoc/markup/to_html_crossref.rb +140 -0
  64. data/rdoc/lib/rdoc/markup/to_latex.rb +328 -0
  65. data/rdoc/lib/rdoc/markup/to_test.rb +53 -0
  66. data/rdoc/lib/rdoc/markup/to_texinfo.rb +73 -0
  67. data/rdoc/lib/rdoc/markup.rb +378 -0
  68. data/rdoc/lib/rdoc/meta_method.rb +8 -0
  69. data/rdoc/lib/rdoc/normal_class.rb +18 -0
  70. data/rdoc/lib/rdoc/normal_module.rb +34 -0
  71. data/rdoc/lib/rdoc/options.rb +542 -0
  72. data/rdoc/lib/rdoc/parser/c.rb +678 -0
  73. data/rdoc/lib/rdoc/parser/perl.rb +165 -0
  74. data/rdoc/lib/rdoc/parser/ruby.rb +2904 -0
  75. data/rdoc/lib/rdoc/parser/simple.rb +39 -0
  76. data/rdoc/lib/rdoc/parser.rb +138 -0
  77. data/rdoc/lib/rdoc/rdoc.rb +375 -0
  78. data/rdoc/lib/rdoc/require.rb +32 -0
  79. data/rdoc/lib/rdoc/ri/cache.rb +187 -0
  80. data/rdoc/lib/rdoc/ri/descriptions.rb +156 -0
  81. data/rdoc/lib/rdoc/ri/display.rb +340 -0
  82. data/rdoc/lib/rdoc/ri/driver.rb +828 -0
  83. data/rdoc/lib/rdoc/ri/formatter.rb +654 -0
  84. data/rdoc/lib/rdoc/ri/paths.rb +93 -0
  85. data/rdoc/lib/rdoc/ri/reader.rb +106 -0
  86. data/rdoc/lib/rdoc/ri/util.rb +79 -0
  87. data/rdoc/lib/rdoc/ri/writer.rb +68 -0
  88. data/rdoc/lib/rdoc/ri.rb +8 -0
  89. data/rdoc/lib/rdoc/single_class.rb +8 -0
  90. data/rdoc/lib/rdoc/stats.rb +178 -0
  91. data/rdoc/lib/rdoc/task.rb +276 -0
  92. data/rdoc/lib/rdoc/tokenstream.rb +33 -0
  93. data/rdoc/lib/rdoc/top_level.rb +242 -0
  94. data/rdoc/lib/rdoc.rb +398 -0
  95. metadata +1 -1
@@ -0,0 +1,165 @@
1
+ require 'rdoc/parser'
2
+
3
+ ##
4
+ #
5
+ # This is an attamept to write a basic parser for Perl's
6
+ # POD (Plain old Documentation) format. Ruby code must
7
+ # co-exist with Perl, and some tasks are easier in Perl
8
+ # than Ruby because of existing libraries.
9
+ #
10
+ # One difficult is that Perl POD has no means of identifying
11
+ # the classes (packages) and methods (subs) with which it
12
+ # is associated, it is more like literate programming in so
13
+ # far as it just happens to be in the same place as the code,
14
+ # but need not be.
15
+ #
16
+ # We would like to support all the markup the POD provides
17
+ # so that it will convert happily to HTML. At the moment
18
+ # I don't think I can do that: time constraints.
19
+ #
20
+
21
+ class RDoc::Parser::PerlPOD < RDoc::Parser
22
+
23
+ parse_files_matching(/.p[lm]$/)
24
+
25
+ ##
26
+ # Prepare to parse a perl file
27
+
28
+ def initialize(top_level, file_name, content, options, stats)
29
+ super
30
+
31
+ preprocess = RDoc::Markup::PreProcess.new @file_name, @options.rdoc_include
32
+
33
+ preprocess.handle @content do |directive, param|
34
+ warn "Unrecognized directive '#{directive}' in #{@file_name}"
35
+ end
36
+ end
37
+
38
+ ##
39
+ # Extract the Pod(-like) comments from the code.
40
+ # At its most basic there will ne no need to distinguish
41
+ # between the different types of header, etc.
42
+ #
43
+ # This uses a simple finite state machine, in a very
44
+ # procedural pattern. I could "replace case with polymorphism"
45
+ # but I think it would obscure the intent, scatter the
46
+ # code all over tha place. This machine is necessary
47
+ # because POD requires that directives be preceded by
48
+ # blank lines, so reading line by line is necessary,
49
+ # and preserving state about what is seen is necesary.
50
+
51
+ def scan
52
+
53
+ @top_level.comment ||= ""
54
+ state=:code_blank
55
+ line_number = 0
56
+ line = nil
57
+
58
+ # This started out as a really long nested case statement,
59
+ # which also led to repetitive code. I'd like to avoid that
60
+ # so I'm using a "table" instead.
61
+
62
+ # Firstly we need some procs to do the transition and processing
63
+ # work. Because these are procs they are closures, and they can
64
+ # use variables in the local scope.
65
+ #
66
+ # First, the "nothing to see here" stuff.
67
+ code_noop = lambda do
68
+ if line =~ /^\s+$/
69
+ state = :code_blank
70
+ end
71
+ end
72
+
73
+ pod_noop = lambda do
74
+ if line =~ /^\s+$/
75
+ state = :pod_blank
76
+ end
77
+ @top_level.comment += filter(line)
78
+ end
79
+
80
+ begin_noop = lambda do
81
+ if line =~ /^\s+$/
82
+ state = :begin_blank
83
+ end
84
+ @top_level.comment += filter(line)
85
+ end
86
+
87
+ # Now for the blocks that process code and comments...
88
+
89
+ transit_to_pod = lambda do
90
+ case line
91
+ when /^=(?:pod|head\d+)/
92
+ state = :pod_no_blank
93
+ @top_level.comment += filter(line)
94
+ when /^=over/
95
+ state = :over_no_blank
96
+ @top_level.comment += filter(line)
97
+ when /^=(?:begin|for)/
98
+ state = :begin_no_blank
99
+ end
100
+ end
101
+
102
+ process_pod = lambda do
103
+ case line
104
+ when /^\s*$/
105
+ state = :pod_blank
106
+ @top_level.comment += filter(line)
107
+ when /^=cut/
108
+ state = :code_no_blank
109
+ when /^=end/
110
+ $stderr.puts "'=end' unexpected at #{line_number} in #{@file_name}"
111
+ else
112
+ @top_level.comment += filter(line)
113
+ end
114
+ end
115
+
116
+
117
+ process_begin = lambda do
118
+ case line
119
+ when /^\s*$/
120
+ state = :begin_blank
121
+ @top_level.comment += filter(line)
122
+ when /^=end/
123
+ state = :code_no_blank
124
+ when /^=cut/
125
+ $stderr.puts "'=cut' unexpected at #{line_number} in #{@file_name}"
126
+ else
127
+ @top_level.comment += filter(line)
128
+ end
129
+
130
+ end
131
+
132
+
133
+ transitions = { :code_no_blank => code_noop,
134
+ :code_blank => transit_to_pod,
135
+ :pod_no_blank => pod_noop,
136
+ :pod_blank => process_pod,
137
+ :begin_no_blank => begin_noop,
138
+ :begin_blank => process_begin}
139
+ @content.each_line do |l|
140
+ line = l
141
+ line_number += 1
142
+ transitions[state].call
143
+ end # each line
144
+
145
+ @top_level
146
+ end
147
+
148
+ # Filter the perl markup that does the same as the rdoc
149
+ # filtering. Only basic for now. Will probably need a
150
+ # proper parser to cope with C<<...>> etc
151
+ def filter(comment)
152
+ return '' if comment =~ /^=pod\s*$/
153
+ comment.gsub!(/^=pod/, '==')
154
+ comment.gsub!(/^=head(\d+)/) do
155
+ "=" * $1.to_i
156
+ end
157
+ comment.gsub!(/=item/, '');
158
+ comment.gsub!(/C<(.*?)>/, '<tt>\1</tt>');
159
+ comment.gsub!(/I<(.*?)>/, '<i>\1</i>');
160
+ comment.gsub!(/B<(.*?)>/, '<b>\1</b>');
161
+ comment
162
+ end
163
+
164
+ end
165
+