sqlpostgres 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. data/Gemfile +8 -0
  2. data/Gemfile.lock +22 -0
  3. data/LICENSE.md +23 -0
  4. data/README.rdoc +59 -0
  5. data/Rakefile +32 -0
  6. data/VERSION +1 -0
  7. data/doc/BUGS +2 -0
  8. data/doc/examples/README +6 -0
  9. data/doc/examples/connection.rb +16 -0
  10. data/doc/examples/connection_auto.rb +22 -0
  11. data/doc/examples/connection_ctor.rb +18 -0
  12. data/doc/examples/connection_default.rb +15 -0
  13. data/doc/examples/connection_exec.rb +18 -0
  14. data/doc/examples/connection_manual.rb +12 -0
  15. data/doc/examples/connection_wrapped_new.rb +13 -0
  16. data/doc/examples/connection_wrapped_open.rb +13 -0
  17. data/doc/examples/cursor.rb +38 -0
  18. data/doc/examples/include_module.rb +9 -0
  19. data/doc/examples/include_module2.rb +12 -0
  20. data/doc/examples/insert.rb +30 -0
  21. data/doc/examples/insert2.rb +36 -0
  22. data/doc/examples/insert_bytea.rb +16 -0
  23. data/doc/examples/insert_bytea_array.rb +17 -0
  24. data/doc/examples/insert_default_values.rb +16 -0
  25. data/doc/examples/insert_insert.rb +16 -0
  26. data/doc/examples/insert_insert_default.rb +16 -0
  27. data/doc/examples/insert_insert_select.rb +20 -0
  28. data/doc/examples/insert_select.rb +20 -0
  29. data/doc/examples/interval.rb +17 -0
  30. data/doc/examples/savepoint.rb +38 -0
  31. data/doc/examples/select.rb +33 -0
  32. data/doc/examples/select2.rb +36 -0
  33. data/doc/examples/select_cross_join.rb +18 -0
  34. data/doc/examples/select_distinct.rb +18 -0
  35. data/doc/examples/select_distinct_on +19 -0
  36. data/doc/examples/select_for_update.rb +18 -0
  37. data/doc/examples/select_from.rb +17 -0
  38. data/doc/examples/select_from_subselect.rb +20 -0
  39. data/doc/examples/select_group_by.rb +19 -0
  40. data/doc/examples/select_having.rb +20 -0
  41. data/doc/examples/select_join_on.rb +18 -0
  42. data/doc/examples/select_join_using.rb +18 -0
  43. data/doc/examples/select_limit.rb +19 -0
  44. data/doc/examples/select_natural_join.rb +18 -0
  45. data/doc/examples/select_offset.rb +19 -0
  46. data/doc/examples/select_order_by.rb +20 -0
  47. data/doc/examples/select_select.rb +30 -0
  48. data/doc/examples/select_select_alias.rb +30 -0
  49. data/doc/examples/select_select_expression.rb +31 -0
  50. data/doc/examples/select_select_literal.rb +24 -0
  51. data/doc/examples/select_union.rb +21 -0
  52. data/doc/examples/select_where_array.rb +18 -0
  53. data/doc/examples/select_where_in.rb +18 -0
  54. data/doc/examples/select_where_string.rb +18 -0
  55. data/doc/examples/simple.rb +34 -0
  56. data/doc/examples/transaction.rb +30 -0
  57. data/doc/examples/transaction_abort.rb +30 -0
  58. data/doc/examples/transaction_commit.rb +34 -0
  59. data/doc/examples/translate_substitute_values.rb +17 -0
  60. data/doc/examples/update.rb +32 -0
  61. data/doc/examples/update2.rb +44 -0
  62. data/doc/examples/update_only.rb +17 -0
  63. data/doc/examples/update_set.rb +17 -0
  64. data/doc/examples/update_set_array.rb +16 -0
  65. data/doc/examples/update_set_bytea.rb +16 -0
  66. data/doc/examples/update_set_expression.rb +16 -0
  67. data/doc/examples/update_set_subselect.rb +20 -0
  68. data/doc/examples/update_where.rb +17 -0
  69. data/doc/examples/use_prefix.rb +8 -0
  70. data/doc/examples/use_prefix2.rb +11 -0
  71. data/doc/index.html +31 -0
  72. data/doc/insertexamples.rb +9 -0
  73. data/doc/makemanual +4 -0
  74. data/doc/makerdoc +5 -0
  75. data/doc/manual.dbk +622 -0
  76. data/lib/sqlpostgres/Connection.rb +198 -0
  77. data/lib/sqlpostgres/Cursor.rb +157 -0
  78. data/lib/sqlpostgres/Delete.rb +67 -0
  79. data/lib/sqlpostgres/Exceptions.rb +15 -0
  80. data/lib/sqlpostgres/Insert.rb +279 -0
  81. data/lib/sqlpostgres/NullConnection.rb +22 -0
  82. data/lib/sqlpostgres/PgBit.rb +73 -0
  83. data/lib/sqlpostgres/PgBox.rb +37 -0
  84. data/lib/sqlpostgres/PgCidr.rb +21 -0
  85. data/lib/sqlpostgres/PgCircle.rb +75 -0
  86. data/lib/sqlpostgres/PgInet.rb +21 -0
  87. data/lib/sqlpostgres/PgInterval.rb +208 -0
  88. data/lib/sqlpostgres/PgLineSegment.rb +37 -0
  89. data/lib/sqlpostgres/PgMacAddr.rb +21 -0
  90. data/lib/sqlpostgres/PgPath.rb +64 -0
  91. data/lib/sqlpostgres/PgPoint.rb +65 -0
  92. data/lib/sqlpostgres/PgPolygon.rb +56 -0
  93. data/lib/sqlpostgres/PgTime.rb +77 -0
  94. data/lib/sqlpostgres/PgTimeWithTimeZone.rb +98 -0
  95. data/lib/sqlpostgres/PgTimestamp.rb +93 -0
  96. data/lib/sqlpostgres/PgTwoPoints.rb +54 -0
  97. data/lib/sqlpostgres/PgType.rb +34 -0
  98. data/lib/sqlpostgres/PgWrapper.rb +41 -0
  99. data/lib/sqlpostgres/Savepoint.rb +98 -0
  100. data/lib/sqlpostgres/Select.rb +855 -0
  101. data/lib/sqlpostgres/Transaction.rb +120 -0
  102. data/lib/sqlpostgres/Translate.rb +436 -0
  103. data/lib/sqlpostgres/Update.rb +188 -0
  104. data/lib/sqlpostgres.rb +67 -0
  105. data/test/Assert.rb +72 -0
  106. data/test/Connection.test.rb +246 -0
  107. data/test/Cursor.test.rb +190 -0
  108. data/test/Delete.test.rb +68 -0
  109. data/test/Insert.test.rb +123 -0
  110. data/test/MockPGconn.rb +62 -0
  111. data/test/NullConnection.test.rb +32 -0
  112. data/test/PgBit.test.rb +98 -0
  113. data/test/PgBox.test.rb +108 -0
  114. data/test/PgCidr.test.rb +61 -0
  115. data/test/PgCircle.test.rb +107 -0
  116. data/test/PgInet.test.rb +61 -0
  117. data/test/PgInterval.test.rb +180 -0
  118. data/test/PgLineSegment.test.rb +108 -0
  119. data/test/PgMacAddr.test.rb +61 -0
  120. data/test/PgPath.test.rb +106 -0
  121. data/test/PgPoint.test.rb +100 -0
  122. data/test/PgPolygon.test.rb +95 -0
  123. data/test/PgTime.test.rb +120 -0
  124. data/test/PgTimeWithTimeZone.test.rb +117 -0
  125. data/test/PgTimestamp.test.rb +134 -0
  126. data/test/RandomThings.rb +25 -0
  127. data/test/Savepoint.test.rb +286 -0
  128. data/test/Select.test.rb +930 -0
  129. data/test/Test.rb +62 -0
  130. data/test/TestConfig.rb +21 -0
  131. data/test/TestSetup.rb +13 -0
  132. data/test/TestUtil.rb +92 -0
  133. data/test/Transaction.test.rb +275 -0
  134. data/test/Translate.test.rb +354 -0
  135. data/test/Update.test.rb +227 -0
  136. data/test/roundtrip.test.rb +565 -0
  137. data/test/test +34 -0
  138. data/tools/exampleinserter/ExampleInserter.rb +177 -0
  139. data/tools/rdoc/ChangeLog +796 -0
  140. data/tools/rdoc/EXAMPLE.rb +48 -0
  141. data/tools/rdoc/MANIFEST +58 -0
  142. data/tools/rdoc/Makefile +27 -0
  143. data/tools/rdoc/NEW_FEATURES +226 -0
  144. data/tools/rdoc/README +390 -0
  145. data/tools/rdoc/ToDo +6 -0
  146. data/tools/rdoc/contrib/Index +6 -0
  147. data/tools/rdoc/contrib/xslfo/ChangeLog +181 -0
  148. data/tools/rdoc/contrib/xslfo/README +106 -0
  149. data/tools/rdoc/contrib/xslfo/TODO +10 -0
  150. data/tools/rdoc/contrib/xslfo/convert.xsl +151 -0
  151. data/tools/rdoc/contrib/xslfo/demo/README +21 -0
  152. data/tools/rdoc/contrib/xslfo/demo/rdocfo +99 -0
  153. data/tools/rdoc/contrib/xslfo/fcm.xsl +54 -0
  154. data/tools/rdoc/contrib/xslfo/files.xsl +62 -0
  155. data/tools/rdoc/contrib/xslfo/labeled-lists.xsl +66 -0
  156. data/tools/rdoc/contrib/xslfo/lists.xsl +44 -0
  157. data/tools/rdoc/contrib/xslfo/modules.xsl +152 -0
  158. data/tools/rdoc/contrib/xslfo/rdoc.xsl +75 -0
  159. data/tools/rdoc/contrib/xslfo/source.xsl +66 -0
  160. data/tools/rdoc/contrib/xslfo/styles.xsl +69 -0
  161. data/tools/rdoc/contrib/xslfo/tables.xsl +67 -0
  162. data/tools/rdoc/contrib/xslfo/utils.xsl +21 -0
  163. data/tools/rdoc/debian/changelog +33 -0
  164. data/tools/rdoc/debian/compat +1 -0
  165. data/tools/rdoc/debian/control +20 -0
  166. data/tools/rdoc/debian/copyright +10 -0
  167. data/tools/rdoc/debian/dirs +2 -0
  168. data/tools/rdoc/debian/docs +2 -0
  169. data/tools/rdoc/debian/rdoc.1 +252 -0
  170. data/tools/rdoc/debian/rdoc.manpages +1 -0
  171. data/tools/rdoc/debian/rdoc.pod +149 -0
  172. data/tools/rdoc/debian/rules +9 -0
  173. data/tools/rdoc/dot/dot.rb +255 -0
  174. data/tools/rdoc/etc/rdoc.dtd +203 -0
  175. data/tools/rdoc/install.rb +137 -0
  176. data/tools/rdoc/markup/install.rb +43 -0
  177. data/tools/rdoc/markup/sample/sample.rb +42 -0
  178. data/tools/rdoc/markup/simple_markup/fragments.rb +323 -0
  179. data/tools/rdoc/markup/simple_markup/inline.rb +348 -0
  180. data/tools/rdoc/markup/simple_markup/lines.rb +147 -0
  181. data/tools/rdoc/markup/simple_markup/preprocess.rb +68 -0
  182. data/tools/rdoc/markup/simple_markup/to_html.rb +281 -0
  183. data/tools/rdoc/markup/simple_markup.rb +474 -0
  184. data/tools/rdoc/markup/test/AllTests.rb +2 -0
  185. data/tools/rdoc/markup/test/TestInline.rb +151 -0
  186. data/tools/rdoc/markup/test/TestParse.rb +411 -0
  187. data/tools/rdoc/rdoc/code_objects.rb +536 -0
  188. data/tools/rdoc/rdoc/diagram.rb +331 -0
  189. data/tools/rdoc/rdoc/generators/chm_generator.rb +112 -0
  190. data/tools/rdoc/rdoc/generators/html_generator.rb +1268 -0
  191. data/tools/rdoc/rdoc/generators/template/chm/chm.rb +86 -0
  192. data/tools/rdoc/rdoc/generators/template/html/html.rb +705 -0
  193. data/tools/rdoc/rdoc/generators/template/html/kilmer.rb +377 -0
  194. data/tools/rdoc/rdoc/generators/template/xml/rdf.rb +110 -0
  195. data/tools/rdoc/rdoc/generators/template/xml/xml.rb +110 -0
  196. data/tools/rdoc/rdoc/generators/xml_generator.rb +130 -0
  197. data/tools/rdoc/rdoc/options.rb +451 -0
  198. data/tools/rdoc/rdoc/parsers/parse_c.rb +287 -0
  199. data/tools/rdoc/rdoc/parsers/parse_f95.rb +118 -0
  200. data/tools/rdoc/rdoc/parsers/parse_rb.rb +2311 -0
  201. data/tools/rdoc/rdoc/parsers/parse_simple.rb +37 -0
  202. data/tools/rdoc/rdoc/parsers/parserfactory.rb +75 -0
  203. data/tools/rdoc/rdoc/rdoc.rb +219 -0
  204. data/tools/rdoc/rdoc/template.rb +234 -0
  205. data/tools/rdoc/rdoc/tokenstream.rb +25 -0
  206. data/tools/rdoc/rdoc.rb +9 -0
  207. metadata +291 -0
@@ -0,0 +1,377 @@
1
+ module RDoc
2
+ module Page
3
+
4
+
5
+ FONTS = "Verdana, Arial, Helvetica, sans-serif"
6
+
7
+ STYLE = %{
8
+ body,td,p { font-family: %fonts%;
9
+ color: #000040;
10
+ }
11
+
12
+ .attr-rw { font-size: xx-small; color: #444488 }
13
+
14
+ .title-row { background-color: #CCCCFF;
15
+ color: #000010;
16
+ }
17
+
18
+ .big-title-font {
19
+ color: black;
20
+ font-weight: bold;
21
+ font-family: %fonts%;
22
+ font-size: large;
23
+ height: 60px;
24
+ padding: 10px 3px 10px 3px;
25
+ }
26
+
27
+ .small-title-font { color: black;
28
+ font-family: %fonts%;
29
+ font-size:10; }
30
+
31
+ .aqua { color: black }
32
+
33
+ .method-name, .attr-name {
34
+ font-family: font-family: %fonts%;
35
+ font-weight: bold;
36
+ font-size: small;
37
+ margin-left: 20px;
38
+ color: #000033;
39
+ }
40
+
41
+ .tablesubtitle, .tablesubsubtitle {
42
+ width: 100%;
43
+ margin-top: 1ex;
44
+ margin-bottom: .5ex;
45
+ padding: 5px 0px 5px 3px;
46
+ font-size: large;
47
+ color: black;
48
+ background-color: #CCCCFF;
49
+ border: thin;
50
+ }
51
+
52
+ .name-list {
53
+ margin-left: 5px;
54
+ margin-bottom: 2ex;
55
+ line-height: 105%;
56
+ }
57
+
58
+ .description {
59
+ margin-left: 5px;
60
+ margin-bottom: 2ex;
61
+ line-height: 105%;
62
+ font-size: small;
63
+ }
64
+
65
+ .methodtitle {
66
+ font-size: small;
67
+ font-weight: bold;
68
+ text-decoration: none;
69
+ color: #000033;
70
+ background-color: white;
71
+ }
72
+
73
+ .srclink {
74
+ font-size: small;
75
+ font-weight: bold;
76
+ text-decoration: none;
77
+ color: #0000DD;
78
+ background-color: white;
79
+ }
80
+
81
+ .paramsig {
82
+ font-size: small;
83
+ }
84
+
85
+ .srcbut { float: right }
86
+
87
+ }
88
+
89
+
90
+ ############################################################################
91
+
92
+
93
+ BODY = %{
94
+ <html><head>
95
+ <title>%title%</title>
96
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
97
+ <link rel=StyleSheet href="%style_url%" type="text/css" media=screen>
98
+ <script type="text/javascript" language="JavaScript">
99
+ <!--
100
+ function popCode(url) {
101
+ parent.frames.source.location = url
102
+ }
103
+ //-->
104
+ </script>
105
+ </head>
106
+ <body bgcolor="white">
107
+
108
+ !INCLUDE! <!-- banner header -->
109
+
110
+ IF:diagram
111
+ <table width="100%"><tr><td align="center">
112
+ %diagram%
113
+ </td></tr></table>
114
+ ENDIF:diagram
115
+
116
+ IF:description
117
+ <div class="description">%description%</div>
118
+ ENDIF:description
119
+
120
+ IF:requires
121
+ <table cellpadding=5 width="100%">
122
+ <tr><td class="tablesubtitle">Required files</td></tr>
123
+ </table><br>
124
+ <div class="name-list">
125
+ START:requires
126
+ HREF:aref:name:
127
+ END:requires
128
+ ENDIF:requires
129
+ </div>
130
+
131
+ IF:methods
132
+ <table cellpadding=5 width="100%">
133
+ <tr><td class="tablesubtitle">Methods</td></tr>
134
+ </table><br>
135
+ <div class="name-list">
136
+ START:methods
137
+ HREF:aref:name:,
138
+ END:methods
139
+ </div>
140
+ ENDIF:methods
141
+
142
+ IF:attributes
143
+ <table cellpadding=5 width="100%">
144
+ <tr><td class="tablesubtitle">Attributes</td></tr>
145
+ </table><br>
146
+ <table cellspacing=5>
147
+ START:attributes
148
+ <tr valign="top">
149
+ <td align="center" class="attr-rw">&nbsp;[%rw%]&nbsp;</td>
150
+ <td class="attr-name">%name%</td>
151
+ <td>%a_desc%</td>
152
+ </tr>
153
+ END:attributes
154
+ </table>
155
+ ENDIF:attributes
156
+
157
+ IF:classlist
158
+ <table cellpadding=5 width="100%">
159
+ <tr><td class="tablesubtitle">Classes and Modules</td></tr>
160
+ </table><br>
161
+ %classlist%<br>
162
+ ENDIF:classlist
163
+
164
+ !INCLUDE! <!-- method descriptions -->
165
+
166
+ </body>
167
+ </html>
168
+ }
169
+
170
+ ###############################################################################
171
+
172
+ FILE_PAGE = <<_FILE_PAGE_
173
+ <table width="100%">
174
+ <tr class="title-row">
175
+ <td><table width="100%"><tr>
176
+ <td class="big-title-font" colspan=2><font size=-3><B>File</B><BR></font>%short_name%</td>
177
+ <td align="right"><table cellspacing=0 cellpadding=2>
178
+ <tr>
179
+ <td class="small-title-font">Path:</td>
180
+ <td class="small-title-font">%full_path%</td>
181
+ </tr>
182
+ <tr>
183
+ <td class="small-title-font">Modified:</td>
184
+ <td class="small-title-font">%dtm_modified%</td>
185
+ </tr>
186
+ </table>
187
+ </td></tr></table></td>
188
+ </tr>
189
+ </table><br>
190
+ _FILE_PAGE_
191
+
192
+ ###################################################################
193
+
194
+ CLASS_PAGE = %{
195
+ <table width="100%" border=0 cellspacing=0>
196
+ <tr class="title-row">
197
+ <td class="big-title-font">
198
+ <font size=-3><B>%classmod%</B><BR></font>%full_name%
199
+ </td>
200
+ <td align="right">
201
+ <table cellspacing=0 cellpadding=2>
202
+ <tr valign="top">
203
+ <td class="small-title-font">In:</td>
204
+ <td class="small-title-font">
205
+ START:infiles
206
+ HREF:full_path_url:full_path:
207
+ END:infiles
208
+ </td>
209
+ </tr>
210
+ IF:parent
211
+ <tr>
212
+ <td class="small-title-font">Parent:</td>
213
+ <td class="small-title-font">
214
+ IF:par_url
215
+ <a href="%par_url%" class="cyan">
216
+ ENDIF:par_url
217
+ %parent%
218
+ IF:par_url
219
+ </a>
220
+ ENDIF:par_url
221
+ </td>
222
+ </tr>
223
+ ENDIF:parent
224
+ </table>
225
+ </td>
226
+ </tr>
227
+ </table><br>
228
+ }
229
+
230
+ ###################################################################
231
+
232
+ METHOD_LIST = %{
233
+ IF:includes
234
+ <div class="tablesubsubtitle">Included modules</div><br>
235
+ <div class="name-list">
236
+ START:includes
237
+ <span class="method-name">HREF:aref:name:</span>
238
+ END:includes
239
+ </div>
240
+ ENDIF:includes
241
+
242
+ IF:method_list
243
+ START:method_list
244
+ IF:methods
245
+ <table cellpadding=5 width="100%">
246
+ <tr><td class="tablesubtitle">%type% %category% methods</td></tr>
247
+ </table>
248
+ START:methods
249
+ <table width="100%" cellspacing = 0 cellpadding=5 border=0>
250
+ <tr><td class="methodtitle">
251
+ <a name="%aref%">
252
+ <b>%name%</b>%params%
253
+ IF:codeurl
254
+ <a href="%codeurl%" target="source" class="srclink">src</a>
255
+ ENDIF:codeurl
256
+ </a></td></tr>
257
+ </table>
258
+ IF:m_desc
259
+ <div class="description">
260
+ %m_desc%
261
+ </div>
262
+ ENDIF:m_desc
263
+ END:methods
264
+ ENDIF:methods
265
+ END:method_list
266
+ ENDIF:method_list
267
+ }
268
+
269
+ =begin
270
+ =end
271
+
272
+ ########################## Source code ##########################
273
+
274
+ SRC_PAGE = %{
275
+ <html>
276
+ <head><title>%title%</title>
277
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
278
+ <style>
279
+ .kw { color: #3333FF; font-weight: bold }
280
+ .cmt { color: green; font-style: italic }
281
+ .str { color: #662222; font-style: italic }
282
+ .re { color: #662222; }
283
+ </style>
284
+ </head>
285
+ <body bgcolor="white">
286
+ <pre>%code%</pre>
287
+ </body>
288
+ </html>
289
+ }
290
+
291
+ ########################## Index ################################
292
+
293
+ FR_INDEX_BODY = %{
294
+ !INCLUDE!
295
+ }
296
+
297
+ FILE_INDEX = %{
298
+ <html>
299
+ <head>
300
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
301
+ <style>
302
+ <!--
303
+ body {
304
+ background-color: #ddddff;
305
+ font-family: #{FONTS};
306
+ font-size: 11px;
307
+ font-style: normal;
308
+ line-height: 14px;
309
+ color: #000040;
310
+ }
311
+ div.banner {
312
+ background: #0000aa;
313
+ color: white;
314
+ padding: 1;
315
+ margin: 0;
316
+ font-size: 90%;
317
+ font-weight: bold;
318
+ line-height: 1.1;
319
+ text-align: center;
320
+ width: 100%;
321
+ }
322
+
323
+ -->
324
+ </style>
325
+ <base target="docwin">
326
+ </head>
327
+ <body>
328
+ <div class="banner">%list_title%</div>
329
+ START:entries
330
+ <a href="%href%">%name%</a><br>
331
+ END:entries
332
+ </body></html>
333
+ }
334
+
335
+ CLASS_INDEX = FILE_INDEX
336
+ METHOD_INDEX = FILE_INDEX
337
+
338
+ INDEX = %{
339
+ <html>
340
+ <head>
341
+ <title>%title%</title>
342
+ <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
343
+ </head>
344
+
345
+ <frameset cols="20%,*">
346
+ <frameset rows="15%,35%,50%">
347
+ <frame src="fr_file_index.html" title="Files" name="Files">
348
+ <frame src="fr_class_index.html" name="Classes">
349
+ <frame src="fr_method_index.html" name="Methods">
350
+ </frameset>
351
+ <frameset rows="80%,20%">
352
+ <frame src="%initial_page%" name="docwin">
353
+ <frame src="blank.html" name="source">
354
+ </frameset>
355
+ <noframes>
356
+ <body bgcolor="white">
357
+ Click <a href="html/index.html">here</a> for a non-frames
358
+ version of this page.
359
+ </body>
360
+ </noframes>
361
+ </frameset>
362
+
363
+ </html>
364
+ }
365
+
366
+ # and a blank page to use as a target
367
+ BLANK = %{
368
+ <html><body bgcolor="white"></body></html>
369
+ }
370
+
371
+ def write_extra_pages
372
+ template = TemplatePage.new(BLANK)
373
+ File.open("blank.html", "w") { |f| template.write_html_on(f, {}) }
374
+ end
375
+
376
+ end
377
+ end
@@ -0,0 +1,110 @@
1
+ module RDoc
2
+ module Page
3
+
4
+
5
+
6
+ CONTENTS_RDF = %{
7
+ IF:description
8
+ <description rd:parseType="Literal">
9
+ %description%
10
+ </description>
11
+ ENDIF:description
12
+
13
+ IF:requires
14
+ START:requires
15
+ <rd:required-file rd:name="%name%" />
16
+ END:requires
17
+ ENDIF:requires
18
+
19
+ IF:attributes
20
+ START:attributes
21
+ <contents>
22
+ <Attribute rd:name="%name%">
23
+ <attribute-rw>%rw%</attribute-rw>
24
+ <description rdf:parseType="Literal">%a_desc%</description>
25
+ </Attribute>
26
+ </contents>
27
+ END:attributes
28
+ ENDIF:attributes
29
+
30
+ IF:includes
31
+ <IncludedModuleList>
32
+ START:includes
33
+ <included-module rd:name="%name%" />
34
+ END:includes
35
+ </IncludedModuleList>
36
+ ENDIF:includes
37
+
38
+ IF:method_list
39
+ START:method_list
40
+ IF:methods
41
+ START:methods
42
+ <contents>
43
+ <Method rd:name="%name%" rd:visibility="%type%"
44
+ rd:category="%category%" rd:id="%aref%">
45
+ <parameters>%params%</parameters>
46
+ IF:m_desc
47
+ <description rdf:parseType="Literal">
48
+ %m_desc%
49
+ </description>
50
+ ENDIF:m_desc
51
+ IF:sourcecode
52
+ <source-code-listing rdf:parseType="Literal">
53
+ %sourcecode%
54
+ </source-code-listing>
55
+ ENDIF:sourcecode
56
+ </Method>
57
+ </contents>
58
+ END:methods
59
+ ENDIF:methods
60
+ END:method_list
61
+ ENDIF:method_list
62
+ <!-- end method list -->
63
+ }
64
+
65
+ ########################################################################
66
+
67
+ ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
68
+ <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
69
+ xmlns="http://pragprog.com/rdoc/rdoc.rdf#"
70
+ xmlns:rd="http://pragprog.com/rdoc/rdoc.rdf#">
71
+
72
+ <!-- RDoc -->
73
+ START:files
74
+ <rd:File rd:name="%short_name%" rd:id="%href%">
75
+ <path>%full_path%</path>
76
+ <dtm-modified>%dtm_modified%</dtm-modified>
77
+ } + CONTENTS_RDF + %{
78
+ </rd:File>
79
+ END:files
80
+ START:classes
81
+ <%classmod% rd:name="%full_name%" rd:id="%full_name%">
82
+ <classmod-info>
83
+ IF:infiles
84
+ <InFiles>
85
+ START:infiles
86
+ <infile>
87
+ <File rd:name="%full_path%"
88
+ IF:full_path_url
89
+ rdf:about="%full_path_url%"
90
+ ENDIF:full_path_url
91
+ />
92
+ </infile>
93
+ END:infiles
94
+ </InFiles>
95
+ ENDIF:infiles
96
+ IF:parent
97
+ <superclass>HREF:par_url:parent:</superclass>
98
+ ENDIF:parent
99
+ </classmod-info>
100
+ } + CONTENTS_RDF + %{
101
+ </%classmod%>
102
+ END:classes
103
+ <!-- /RDoc -->
104
+ </rdf:RDF>
105
+ }
106
+
107
+
108
+ end
109
+ end
110
+
@@ -0,0 +1,110 @@
1
+ module RDoc
2
+ module Page
3
+
4
+
5
+
6
+ CONTENTS_XML = %{
7
+ IF:description
8
+ <description>
9
+ %description%
10
+ </description>
11
+ ENDIF:description
12
+ <contents>
13
+ IF:requires
14
+ <required-file-list>
15
+ START:requires
16
+ <required-file name="%name%"
17
+ IF:aref
18
+ href="%aref%"
19
+ ENDIF:aref
20
+ />
21
+ END:requires
22
+ </required-file-list>
23
+ ENDIF:requires
24
+ IF:attributes
25
+ <attribute-list>
26
+ START:attributes
27
+ <attribute name="%name%">
28
+ <attribute-rw>%rw%</attribute-rw>
29
+ <description>%a_desc%</description>
30
+ </attribute>
31
+ END:attributes
32
+ </attribute-list>
33
+ ENDIF:attributes
34
+ IF:includes
35
+ <included-module-list>
36
+ START:includes
37
+ <included-module name="%name%"
38
+ IF:aref
39
+ href="%aref%"
40
+ ENDIF:aref
41
+ />
42
+ END:includes
43
+ </included-module-list>
44
+ ENDIF:includes
45
+ IF:method_list
46
+ <method-list>
47
+ START:method_list
48
+ IF:methods
49
+ START:methods
50
+ <method name="%name%" type="%type%" category="%category%" id="%aref%">
51
+ <parameters>%params%</parameters>
52
+ IF:m_desc
53
+ <description>
54
+ %m_desc%
55
+ </description>
56
+ ENDIF:m_desc
57
+ IF:sourcecode
58
+ <source-code-listing>
59
+ %sourcecode%
60
+ </source-code-listing>
61
+ ENDIF:sourcecode
62
+ </method>
63
+ END:methods
64
+ ENDIF:methods
65
+ END:method_list
66
+ </method-list>
67
+ ENDIF:method_list
68
+ </contents>
69
+ }
70
+
71
+ ########################################################################
72
+
73
+ ONE_PAGE = %{<?xml version="1.0" encoding="utf-8"?>
74
+ <rdoc>
75
+ <file-list>
76
+ START:files
77
+ <file name="%short_name%" id="%href%">
78
+ <file-info>
79
+ <path>%full_path%</path>
80
+ <dtm-modified>%dtm_modified%</dtm-modified>
81
+ </file-info>
82
+ } + CONTENTS_XML + %{
83
+ </file>
84
+ END:files
85
+ </file-list>
86
+ <class-module-list>
87
+ START:classes
88
+ <%classmod% name="%full_name%" id="%full_name%">
89
+ <classmod-info>
90
+ IF:infiles
91
+ <infiles>
92
+ START:infiles
93
+ <infile>HREF:full_path_url:full_path:</infile>
94
+ END:infiles
95
+ </infiles>
96
+ ENDIF:infiles
97
+ IF:parent
98
+ <superclass>HREF:par_url:parent:</superclass>
99
+ ENDIF:parent
100
+ </classmod-info>
101
+ } + CONTENTS_XML + %{
102
+ </%classmod%>
103
+ END:classes
104
+ </class-module-list>
105
+ </rdoc>
106
+ }
107
+
108
+
109
+ end
110
+ end
@@ -0,0 +1,130 @@
1
+
2
+ require 'ftools'
3
+
4
+ require 'rdoc/options'
5
+ require 'markup/simple_markup'
6
+ require 'markup/simple_markup/to_html'
7
+ require 'rdoc/generators/html_generator'
8
+
9
+ module Generators
10
+
11
+ # Generate XML output as one big file
12
+
13
+ class XMLGenerator < HTMLGenerator
14
+
15
+ # Standard generator factory
16
+ def XMLGenerator.for(options)
17
+ XMLGenerator.new(options)
18
+ end
19
+
20
+
21
+ def initialize(*args)
22
+ super
23
+ end
24
+
25
+ ##
26
+ # Build the initial indices and output objects
27
+ # based on an array of TopLevel objects containing
28
+ # the extracted information.
29
+
30
+ def generate(info)
31
+ @info = info
32
+ @files = []
33
+ @classes = []
34
+ @hyperlinks = {}
35
+
36
+ build_indices
37
+ generate_xml
38
+ end
39
+
40
+
41
+ ##
42
+ # Generate:
43
+ #
44
+ # * a list of HtmlFile objects for each TopLevel object.
45
+ # * a list of HtmlClass objects for each first level
46
+ # class or module in the TopLevel objects
47
+ # * a complete list of all hyperlinkable terms (file,
48
+ # class, module, and method names)
49
+
50
+ def build_indices
51
+
52
+ @info.each do |toplevel|
53
+ @files << HtmlFile.new(toplevel, @options, FILE_DIR)
54
+ end
55
+
56
+ RDoc::TopLevel.all_classes_and_modules.each do |cls|
57
+ build_class_list(cls, @files[0], CLASS_DIR)
58
+ end
59
+ end
60
+
61
+ def build_class_list(from, html_file, class_dir)
62
+ @classes << HtmlClass.new(from, html_file, class_dir, @options)
63
+ from.each_classmodule do |mod|
64
+ build_class_list(mod, html_file, class_dir)
65
+ end
66
+ end
67
+
68
+ ##
69
+ # Generate all the HTML. For the one-file case, we generate
70
+ # all the information in to one big hash
71
+ #
72
+ def generate_xml
73
+ values = {
74
+ 'charset' => @options.charset,
75
+ 'files' => gen_into(@files),
76
+ 'classes' => gen_into(@classes)
77
+ }
78
+
79
+ # this method is defined in the template file
80
+ write_extra_pages if defined? write_extra_pages
81
+
82
+ template = TemplatePage.new(RDoc::Page::ONE_PAGE)
83
+
84
+ if @options.op_name
85
+ opfile = File.open(@options.op_name, "w")
86
+ else
87
+ opfile = $stdout
88
+ end
89
+ template.write_html_on(opfile, values)
90
+ end
91
+
92
+ def gen_into(list)
93
+ res = []
94
+ list.each do |item|
95
+ res << item.value_hash
96
+ end
97
+ res
98
+ end
99
+
100
+ def gen_file_index
101
+ gen_an_index(@files, 'Files')
102
+ end
103
+
104
+ def gen_class_index
105
+ gen_an_index(@classes, 'Classes')
106
+ end
107
+
108
+ def gen_method_index
109
+ gen_an_index(HtmlMethod.all_methods, 'Methods')
110
+ end
111
+
112
+
113
+ def gen_an_index(collection, title)
114
+ res = []
115
+ collection.sort.each do |f|
116
+ if f.document_self
117
+ res << { "href" => f.path, "name" => f.index_name }
118
+ end
119
+ end
120
+
121
+ return {
122
+ "entries" => res,
123
+ 'list_title' => title,
124
+ 'index_url' => main_url,
125
+ }
126
+ end
127
+
128
+ end
129
+
130
+ end