narf 0.6.2 → 0.6.3

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 (424) hide show
  1. data/ChangeLog +22 -0
  2. data/lib/web/htmltools/xmltree.rb +2 -2
  3. data/lib/web/htmltools/xpath.rb +1 -1
  4. data/narf.gemspec +1 -1
  5. metadata +2 -460
  6. data/InstalledFiles +0 -2227
  7. data/config.save +0 -12
  8. data/doc/apache_cgi.txt~ +0 -17
  9. data/doc/fastcgi.txt~ +0 -19
  10. data/doc/rdoc/classes/Web.html +0 -369
  11. data/doc/rdoc/classes/Web.src/M000002.html +0 -15
  12. data/doc/rdoc/classes/Web.src/M000003.html +0 -15
  13. data/doc/rdoc/classes/Web.src/M000004.html +0 -15
  14. data/doc/rdoc/classes/Web.src/M000005.html +0 -15
  15. data/doc/rdoc/classes/Web.src/M000006.html +0 -20
  16. data/doc/rdoc/classes/Web.src/M000007.html +0 -18
  17. data/doc/rdoc/classes/Web.src/M000008.html +0 -18
  18. data/doc/rdoc/classes/Web.src/M000009.html +0 -18
  19. data/doc/rdoc/classes/Web.src/M000010.html +0 -15
  20. data/doc/rdoc/classes/Web.src/M000011.html +0 -15
  21. data/doc/rdoc/classes/Web.src/M000012.html +0 -15
  22. data/doc/rdoc/classes/Web/CGD.html +0 -173
  23. data/doc/rdoc/classes/Web/CGD.src/M000037.html +0 -24
  24. data/doc/rdoc/classes/Web/CGD.src/M000038.html +0 -24
  25. data/doc/rdoc/classes/Web/CGD.src/M000039.html +0 -15
  26. data/doc/rdoc/classes/Web/CGD.src/M000040.html +0 -15
  27. data/doc/rdoc/classes/Web/CGD.src/M000041.html +0 -23
  28. data/doc/rdoc/classes/Web/CGI.html +0 -946
  29. data/doc/rdoc/classes/Web/CGI.src/M000051.html +0 -15
  30. data/doc/rdoc/classes/Web/CGI.src/M000052.html +0 -24
  31. data/doc/rdoc/classes/Web/CGI.src/M000053.html +0 -15
  32. data/doc/rdoc/classes/Web/CGI.src/M000054.html +0 -15
  33. data/doc/rdoc/classes/Web/CGI.src/M000055.html +0 -15
  34. data/doc/rdoc/classes/Web/CGI.src/M000056.html +0 -15
  35. data/doc/rdoc/classes/Web/CGI.src/M000057.html +0 -17
  36. data/doc/rdoc/classes/Web/CGI.src/M000058.html +0 -34
  37. data/doc/rdoc/classes/Web/CGI.src/M000059.html +0 -22
  38. data/doc/rdoc/classes/Web/CGI.src/M000060.html +0 -15
  39. data/doc/rdoc/classes/Web/CGI.src/M000061.html +0 -15
  40. data/doc/rdoc/classes/Web/CGI.src/M000062.html +0 -19
  41. data/doc/rdoc/classes/Web/CGI.src/M000063.html +0 -18
  42. data/doc/rdoc/classes/Web/CGI.src/M000064.html +0 -19
  43. data/doc/rdoc/classes/Web/CGI.src/M000065.html +0 -15
  44. data/doc/rdoc/classes/Web/CGI.src/M000066.html +0 -15
  45. data/doc/rdoc/classes/Web/CGI.src/M000067.html +0 -15
  46. data/doc/rdoc/classes/Web/CGI.src/M000068.html +0 -13
  47. data/doc/rdoc/classes/Web/CGI.src/M000069.html +0 -13
  48. data/doc/rdoc/classes/Web/CGI.src/M000070.html +0 -13
  49. data/doc/rdoc/classes/Web/CGI.src/M000071.html +0 -13
  50. data/doc/rdoc/classes/Web/CGI.src/M000072.html +0 -19
  51. data/doc/rdoc/classes/Web/CGI.src/M000073.html +0 -15
  52. data/doc/rdoc/classes/Web/CGI.src/M000074.html +0 -19
  53. data/doc/rdoc/classes/Web/CGI.src/M000075.html +0 -15
  54. data/doc/rdoc/classes/Web/CGI.src/M000076.html +0 -15
  55. data/doc/rdoc/classes/Web/CGI.src/M000077.html +0 -15
  56. data/doc/rdoc/classes/Web/CGI.src/M000078.html +0 -20
  57. data/doc/rdoc/classes/Web/CGI.src/M000079.html +0 -36
  58. data/doc/rdoc/classes/Web/CGI.src/M000080.html +0 -19
  59. data/doc/rdoc/classes/Web/CGI.src/M000081.html +0 -18
  60. data/doc/rdoc/classes/Web/CGI.src/M000082.html +0 -15
  61. data/doc/rdoc/classes/Web/CGI.src/M000083.html +0 -17
  62. data/doc/rdoc/classes/Web/CGI.src/M000084.html +0 -15
  63. data/doc/rdoc/classes/Web/CGI.src/M000085.html +0 -16
  64. data/doc/rdoc/classes/Web/CGI.src/M000086.html +0 -15
  65. data/doc/rdoc/classes/Web/CGI.src/M000087.html +0 -15
  66. data/doc/rdoc/classes/Web/CGI.src/M000088.html +0 -15
  67. data/doc/rdoc/classes/Web/CGI.src/M000089.html +0 -16
  68. data/doc/rdoc/classes/Web/CGI.src/M000090.html +0 -15
  69. data/doc/rdoc/classes/Web/CGI.src/M000091.html +0 -15
  70. data/doc/rdoc/classes/Web/CGI.src/M000092.html +0 -15
  71. data/doc/rdoc/classes/Web/CGI.src/M000093.html +0 -15
  72. data/doc/rdoc/classes/Web/CGI.src/M000094.html +0 -15
  73. data/doc/rdoc/classes/Web/CGI.src/M000095.html +0 -15
  74. data/doc/rdoc/classes/Web/CGI.src/M000096.html +0 -19
  75. data/doc/rdoc/classes/Web/CGI.src/M000097.html +0 -15
  76. data/doc/rdoc/classes/Web/CGI.src/M000098.html +0 -15
  77. data/doc/rdoc/classes/Web/CGI.src/M000099.html +0 -43
  78. data/doc/rdoc/classes/Web/CGI.src/M000100.html +0 -18
  79. data/doc/rdoc/classes/Web/CGI.src/M000101.html +0 -20
  80. data/doc/rdoc/classes/Web/CGI.src/M000102.html +0 -15
  81. data/doc/rdoc/classes/Web/CGI.src/M000103.html +0 -15
  82. data/doc/rdoc/classes/Web/CGI.src/M000104.html +0 -15
  83. data/doc/rdoc/classes/Web/CGI.src/M000105.html +0 -24
  84. data/doc/rdoc/classes/Web/CGI.src/M000106.html +0 -24
  85. data/doc/rdoc/classes/Web/CGI.src/M000107.html +0 -22
  86. data/doc/rdoc/classes/Web/CaseInsensitiveHash.html +0 -104
  87. data/doc/rdoc/classes/Web/CaseInsensitiveHash.src/M000118.html +0 -15
  88. data/doc/rdoc/classes/Web/CaseInsensitiveHash.src/M000119.html +0 -15
  89. data/doc/rdoc/classes/Web/CaseInsensitiveHash.src/M000120.html +0 -15
  90. data/doc/rdoc/classes/Web/Mime.html +0 -122
  91. data/doc/rdoc/classes/Web/Mime.src/M000118.html +0 -15
  92. data/doc/rdoc/classes/Web/Mime.src/M000119.html +0 -15
  93. data/doc/rdoc/classes/Web/Mime.src/M000120.html +0 -23
  94. data/doc/rdoc/classes/Web/Mime.src/M000121.html +0 -15
  95. data/doc/rdoc/classes/Web/Mime.src/M000122.html +0 -15
  96. data/doc/rdoc/classes/Web/Mime.src/M000123.html +0 -23
  97. data/doc/rdoc/classes/Web/Mime.src/M000124.html +0 -15
  98. data/doc/rdoc/classes/Web/Narflates.html +0 -134
  99. data/doc/rdoc/classes/Web/Parser.html +0 -219
  100. data/doc/rdoc/classes/Web/Parser.src/M000013.html +0 -21
  101. data/doc/rdoc/classes/Web/Parser.src/M000014.html +0 -19
  102. data/doc/rdoc/classes/Web/Parser.src/M000015.html +0 -21
  103. data/doc/rdoc/classes/Web/Parser.src/M000016.html +0 -15
  104. data/doc/rdoc/classes/Web/Parser.src/M000017.html +0 -30
  105. data/doc/rdoc/classes/Web/Parser.src/M000018.html +0 -15
  106. data/doc/rdoc/classes/Web/Parser.src/M000019.html +0 -19
  107. data/doc/rdoc/classes/Web/Parser.src/M000020.html +0 -27
  108. data/doc/rdoc/classes/Web/Parser.src/M000021.html +0 -15
  109. data/doc/rdoc/classes/Web/Parser.src/M000022.html +0 -16
  110. data/doc/rdoc/classes/Web/Parser.src/M000023.html +0 -18
  111. data/doc/rdoc/classes/Web/Session.html +0 -178
  112. data/doc/rdoc/classes/Web/Session.src/M000042.html +0 -20
  113. data/doc/rdoc/classes/Web/Session.src/M000043.html +0 -19
  114. data/doc/rdoc/classes/Web/Session.src/M000044.html +0 -21
  115. data/doc/rdoc/classes/Web/Session.src/M000045.html +0 -21
  116. data/doc/rdoc/classes/Web/Session.src/M000046.html +0 -15
  117. data/doc/rdoc/classes/Web/Session.src/M000047.html +0 -17
  118. data/doc/rdoc/classes/Web/Session.src/M000048.html +0 -15
  119. data/doc/rdoc/classes/Web/Session.src/M000049.html +0 -15
  120. data/doc/rdoc/classes/Web/Session.src/M000050.html +0 -16
  121. data/doc/rdoc/classes/Web/Testing.html +0 -474
  122. data/doc/rdoc/classes/Web/Testing.src/M000024.html +0 -15
  123. data/doc/rdoc/classes/Web/Testing.src/M000025.html +0 -25
  124. data/doc/rdoc/classes/Web/Testing.src/M000026.html +0 -15
  125. data/doc/rdoc/classes/Web/Testing.src/M000027.html +0 -25
  126. data/doc/rdoc/classes/Web/Testing.src/M000028.html +0 -57
  127. data/doc/rdoc/classes/Web/Testing.src/M000029.html +0 -15
  128. data/doc/rdoc/classes/Web/Testing.src/M000030.html +0 -15
  129. data/doc/rdoc/classes/Web/Testing.src/M000031.html +0 -15
  130. data/doc/rdoc/classes/Web/Testing.src/M000032.html +0 -15
  131. data/doc/rdoc/classes/Web/Testing.src/M000033.html +0 -15
  132. data/doc/rdoc/classes/Web/Testing.src/M000034.html +0 -15
  133. data/doc/rdoc/classes/Web/Testing.src/M000035.html +0 -15
  134. data/doc/rdoc/classes/Web/Testing.src/M000036.html +0 -18
  135. data/doc/rdoc/classes/Web/Upload.html +0 -160
  136. data/doc/rdoc/classes/Web/Upload.src/M000108.html +0 -25
  137. data/doc/rdoc/classes/Web/Upload.src/M000109.html +0 -18
  138. data/doc/rdoc/classes/Web/Upload.src/M000110.html +0 -16
  139. data/doc/rdoc/classes/Web/Upload.src/M000111.html +0 -16
  140. data/doc/rdoc/classes/Web/Wiki.html +0 -249
  141. data/doc/rdoc/classes/Web/Wiki.src/M000112.html +0 -25
  142. data/doc/rdoc/classes/Web/Wiki.src/M000113.html +0 -15
  143. data/doc/rdoc/classes/Web/Wiki.src/M000114.html +0 -26
  144. data/doc/rdoc/classes/Web/Wiki.src/M000115.html +0 -21
  145. data/doc/rdoc/classes/Web/Wiki.src/M000116.html +0 -18
  146. data/doc/rdoc/classes/Web/Wiki.src/M000117.html +0 -19
  147. data/doc/rdoc/created.rid +0 -1
  148. data/doc/rdoc/files/README.html +0 -230
  149. data/doc/rdoc/files/doc/apache_cgi_txt.html +0 -76
  150. data/doc/rdoc/files/doc/fastcgi_txt.html +0 -82
  151. data/doc/rdoc/files/doc/mod_ruby_txt.html +0 -62
  152. data/doc/rdoc/files/doc/webrick_txt.html +0 -79
  153. data/doc/rdoc/files/examples/examples_rdoc.html +0 -73
  154. data/doc/rdoc/files/lib/web/cgi_rb.html +0 -75
  155. data/doc/rdoc/files/lib/web/mime_rb.html +0 -67
  156. data/doc/rdoc/files/lib/web/parser_rb.html +0 -73
  157. data/doc/rdoc/files/lib/web/session_rb.html +0 -73
  158. data/doc/rdoc/files/lib/web/template_rb.html +0 -73
  159. data/doc/rdoc/files/lib/web/testing_rb.html +0 -67
  160. data/doc/rdoc/files/lib/web/upload_rb.html +0 -73
  161. data/doc/rdoc/files/lib/web/wiki_rb.html +0 -79
  162. data/doc/rdoc/files/lib/web_rb.html +0 -116
  163. data/doc/rdoc/files/lib/web_rb.src/M000001.html +0 -15
  164. data/doc/rdoc/fr_class_index.html +0 -47
  165. data/doc/rdoc/fr_file_index.html +0 -52
  166. data/doc/rdoc/fr_method_index.html +0 -158
  167. data/doc/rdoc/index.html +0 -22
  168. data/doc/rdoc/rdoc-style.css +0 -99
  169. data/examples/admin.rb~ +0 -5
  170. data/examples/cookbook.rdoc~ +0 -238
  171. data/examples/examples.rdoc~ +0 -17
  172. data/examples/hello.world.rb~ +0 -3
  173. data/examples/session.rb~ +0 -31
  174. data/examples/test/test.hello.world.rb~ +0 -9
  175. data/examples/test/test.session.rb~ +0 -37
  176. data/examples/wiki.rb~ +0 -5
  177. data/lib/web.rb~ +0 -290
  178. data/lib/web/#assertinclude.rb# +0 -110
  179. data/lib/web/assertinclude.rb~ +0 -110
  180. data/lib/web/cgi.rb~ +0 -640
  181. data/lib/web/htmlparser/html-parser.rb~ +0 -429
  182. data/lib/web/htmlparser/sgml-parser.rb~ +0 -332
  183. data/lib/web/htmltools/element.rb~ +0 -296
  184. data/lib/web/htmltools/stparser.rb~ +0 -276
  185. data/lib/web/htmltools/tags.rb~ +0 -286
  186. data/lib/web/htmltools/tree.rb~ +0 -139
  187. data/lib/web/htmltools/xmltree.rb~ +0 -160
  188. data/lib/web/htmltools/xpath.rb~ +0 -71
  189. data/lib/web/parser.rb~ +0 -288
  190. data/lib/web/request.rb~ +0 -238
  191. data/lib/web/runner.rb~ +0 -26
  192. data/lib/web/sapi/fastcgi.rb~ +0 -25
  193. data/lib/web/sapi/mod_ruby.rb~ +0 -46
  194. data/lib/web/sapi/webrick.rb~ +0 -89
  195. data/lib/web/session.rb~ +0 -75
  196. data/lib/web/tagparser.rb~ +0 -96
  197. data/lib/web/template.rb~ +0 -613
  198. data/lib/web/testing.rb~ +0 -546
  199. data/lib/web/unit/response.rb~ +0 -461
  200. data/lib/web/unit/ui/cui/testrunner.rb~ +0 -50
  201. data/lib/web/upload.rb~ +0 -262
  202. data/lib/web/wiki.rb~ +0 -517
  203. data/lib/web/wiki/linker.rb~ +0 -72
  204. data/lib/web/wiki/mime.rb~ +0 -68
  205. data/lib/web/wiki/page.rb~ +0 -192
  206. data/lib/web/wiki/resources/#edit.html# +0 -65
  207. data/lib/web/wiki/resources/admin.html~ +0 -13
  208. data/lib/web/wiki/resources/default-content_editor.html~ +0 -1
  209. data/lib/web/wiki/resources/edit.html~ +0 -2
  210. data/lib/web/wiki/resources/home.html~ +0 -10
  211. data/lib/web/wiki/resources/htmlarea/ChangeLog +0 -1185
  212. data/lib/web/wiki/resources/htmlarea/dialog.js +0 -72
  213. data/lib/web/wiki/resources/htmlarea/examples/2-areas.cgi +0 -16
  214. data/lib/web/wiki/resources/htmlarea/examples/2-areas.html +0 -158
  215. data/lib/web/wiki/resources/htmlarea/examples/context-menu.html +0 -95
  216. data/lib/web/wiki/resources/htmlarea/examples/core.html +0 -184
  217. data/lib/web/wiki/resources/htmlarea/examples/css.html +0 -88
  218. data/lib/web/wiki/resources/htmlarea/examples/custom.css +0 -29
  219. data/lib/web/wiki/resources/htmlarea/examples/full-page.html +0 -75
  220. data/lib/web/wiki/resources/htmlarea/examples/fully-loaded.html +0 -248
  221. data/lib/web/wiki/resources/htmlarea/examples/index.html +0 -40
  222. data/lib/web/wiki/resources/htmlarea/examples/spell-checker.html +0 -132
  223. data/lib/web/wiki/resources/htmlarea/examples/table-operations.html +0 -116
  224. data/lib/web/wiki/resources/htmlarea/examples/test.cgi +0 -21
  225. data/lib/web/wiki/resources/htmlarea/htmlarea.css +0 -180
  226. data/lib/web/wiki/resources/htmlarea/htmlarea.js +0 -2175
  227. data/lib/web/wiki/resources/htmlarea/images/ed_about.gif +0 -0
  228. data/lib/web/wiki/resources/htmlarea/images/ed_align_center.gif +0 -0
  229. data/lib/web/wiki/resources/htmlarea/images/ed_align_justify.gif +0 -0
  230. data/lib/web/wiki/resources/htmlarea/images/ed_align_left.gif +0 -0
  231. data/lib/web/wiki/resources/htmlarea/images/ed_align_right.gif +0 -0
  232. data/lib/web/wiki/resources/htmlarea/images/ed_blank.gif +0 -0
  233. data/lib/web/wiki/resources/htmlarea/images/ed_charmap.gif +0 -0
  234. data/lib/web/wiki/resources/htmlarea/images/ed_color_bg.gif +0 -0
  235. data/lib/web/wiki/resources/htmlarea/images/ed_color_fg.gif +0 -0
  236. data/lib/web/wiki/resources/htmlarea/images/ed_copy.gif +0 -0
  237. data/lib/web/wiki/resources/htmlarea/images/ed_custom.gif +0 -0
  238. data/lib/web/wiki/resources/htmlarea/images/ed_cut.gif +0 -0
  239. data/lib/web/wiki/resources/htmlarea/images/ed_delete.gif +0 -0
  240. data/lib/web/wiki/resources/htmlarea/images/ed_format_bold.gif +0 -0
  241. data/lib/web/wiki/resources/htmlarea/images/ed_format_italic.gif +0 -0
  242. data/lib/web/wiki/resources/htmlarea/images/ed_format_strike.gif +0 -0
  243. data/lib/web/wiki/resources/htmlarea/images/ed_format_sub.gif +0 -0
  244. data/lib/web/wiki/resources/htmlarea/images/ed_format_sup.gif +0 -0
  245. data/lib/web/wiki/resources/htmlarea/images/ed_format_underline.gif +0 -0
  246. data/lib/web/wiki/resources/htmlarea/images/ed_help.gif +0 -0
  247. data/lib/web/wiki/resources/htmlarea/images/ed_hr.gif +0 -0
  248. data/lib/web/wiki/resources/htmlarea/images/ed_html.gif +0 -0
  249. data/lib/web/wiki/resources/htmlarea/images/ed_image.gif +0 -0
  250. data/lib/web/wiki/resources/htmlarea/images/ed_indent_less.gif +0 -0
  251. data/lib/web/wiki/resources/htmlarea/images/ed_indent_more.gif +0 -0
  252. data/lib/web/wiki/resources/htmlarea/images/ed_left_to_right.gif +0 -0
  253. data/lib/web/wiki/resources/htmlarea/images/ed_link.gif +0 -0
  254. data/lib/web/wiki/resources/htmlarea/images/ed_list_bullet.gif +0 -0
  255. data/lib/web/wiki/resources/htmlarea/images/ed_list_num.gif +0 -0
  256. data/lib/web/wiki/resources/htmlarea/images/ed_paste.gif +0 -0
  257. data/lib/web/wiki/resources/htmlarea/images/ed_redo.gif +0 -0
  258. data/lib/web/wiki/resources/htmlarea/images/ed_right_to_left.gif +0 -0
  259. data/lib/web/wiki/resources/htmlarea/images/ed_save.gif +0 -0
  260. data/lib/web/wiki/resources/htmlarea/images/ed_show_border.gif +0 -0
  261. data/lib/web/wiki/resources/htmlarea/images/ed_splitcel.gif +0 -0
  262. data/lib/web/wiki/resources/htmlarea/images/ed_undo.gif +0 -0
  263. data/lib/web/wiki/resources/htmlarea/images/fullscreen_maximize.gif +0 -0
  264. data/lib/web/wiki/resources/htmlarea/images/fullscreen_minimize.gif +0 -0
  265. data/lib/web/wiki/resources/htmlarea/images/insert_table.gif +0 -0
  266. data/lib/web/wiki/resources/htmlarea/index.html +0 -199
  267. data/lib/web/wiki/resources/htmlarea/lang/b5.js +0 -36
  268. data/lib/web/wiki/resources/htmlarea/lang/cz.js +0 -63
  269. data/lib/web/wiki/resources/htmlarea/lang/da.js +0 -38
  270. data/lib/web/wiki/resources/htmlarea/lang/de.js +0 -54
  271. data/lib/web/wiki/resources/htmlarea/lang/ee.js +0 -63
  272. data/lib/web/wiki/resources/htmlarea/lang/el.js +0 -75
  273. data/lib/web/wiki/resources/htmlarea/lang/en.js +0 -88
  274. data/lib/web/wiki/resources/htmlarea/lang/es.js +0 -51
  275. data/lib/web/wiki/resources/htmlarea/lang/fi.js +0 -46
  276. data/lib/web/wiki/resources/htmlarea/lang/fr.js +0 -61
  277. data/lib/web/wiki/resources/htmlarea/lang/gb.js +0 -36
  278. data/lib/web/wiki/resources/htmlarea/lang/he.js +0 -63
  279. data/lib/web/wiki/resources/htmlarea/lang/hu.js +0 -63
  280. data/lib/web/wiki/resources/htmlarea/lang/it.js +0 -54
  281. data/lib/web/wiki/resources/htmlarea/lang/ja-euc.js +0 -37
  282. data/lib/web/wiki/resources/htmlarea/lang/ja-jis.js +0 -37
  283. data/lib/web/wiki/resources/htmlarea/lang/ja-sjis.js +0 -37
  284. data/lib/web/wiki/resources/htmlarea/lang/ja-utf8.js +0 -37
  285. data/lib/web/wiki/resources/htmlarea/lang/lt.js +0 -55
  286. data/lib/web/wiki/resources/htmlarea/lang/lv.js +0 -55
  287. data/lib/web/wiki/resources/htmlarea/lang/nb.js +0 -36
  288. data/lib/web/wiki/resources/htmlarea/lang/nl.js +0 -90
  289. data/lib/web/wiki/resources/htmlarea/lang/no.js +0 -79
  290. data/lib/web/wiki/resources/htmlarea/lang/pl.js +0 -36
  291. data/lib/web/wiki/resources/htmlarea/lang/pt_br.js +0 -37
  292. data/lib/web/wiki/resources/htmlarea/lang/ro.js +0 -80
  293. data/lib/web/wiki/resources/htmlarea/lang/ru.js +0 -63
  294. data/lib/web/wiki/resources/htmlarea/lang/se.js +0 -38
  295. data/lib/web/wiki/resources/htmlarea/lang/si.js +0 -63
  296. data/lib/web/wiki/resources/htmlarea/lang/vn.js +0 -51
  297. data/lib/web/wiki/resources/htmlarea/license.txt +0 -30
  298. data/lib/web/wiki/resources/htmlarea/plugins/CSS/css.js +0 -116
  299. data/lib/web/wiki/resources/htmlarea/plugins/CSS/lang/en.js +0 -2
  300. data/lib/web/wiki/resources/htmlarea/plugins/ContextMenu/context-menu.js +0 -416
  301. data/lib/web/wiki/resources/htmlarea/plugins/ContextMenu/lang/de.js +0 -59
  302. data/lib/web/wiki/resources/htmlarea/plugins/ContextMenu/lang/el.js +0 -57
  303. data/lib/web/wiki/resources/htmlarea/plugins/ContextMenu/lang/en.js +0 -66
  304. data/lib/web/wiki/resources/htmlarea/plugins/ContextMenu/lang/nl.js +0 -66
  305. data/lib/web/wiki/resources/htmlarea/plugins/ContextMenu/menu.css +0 -64
  306. data/lib/web/wiki/resources/htmlarea/plugins/FullPage/full-page.js +0 -143
  307. data/lib/web/wiki/resources/htmlarea/plugins/FullPage/img/docprop.gif +0 -0
  308. data/lib/web/wiki/resources/htmlarea/plugins/FullPage/lang/en.js +0 -25
  309. data/lib/web/wiki/resources/htmlarea/plugins/FullPage/lang/ro.js +0 -25
  310. data/lib/web/wiki/resources/htmlarea/plugins/FullPage/popups/docprop.html +0 -131
  311. data/lib/web/wiki/resources/htmlarea/plugins/FullPage/test.html +0 -89
  312. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/img/spell-check.gif +0 -0
  313. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/cz.js +0 -37
  314. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/da.js +0 -37
  315. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/de.js +0 -28
  316. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/en.js +0 -38
  317. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/hu.js +0 -37
  318. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/it.js +0 -28
  319. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/lang/ro.js +0 -37
  320. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/readme-tech.html +0 -114
  321. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/spell-check-logic.cgi +0 -210
  322. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/spell-check-style.css +0 -10
  323. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/spell-check-ui.html +0 -122
  324. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/spell-check-ui.js +0 -397
  325. data/lib/web/wiki/resources/htmlarea/plugins/SpellChecker/spell-checker.js +0 -79
  326. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/cell-delete.gif +0 -0
  327. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/cell-insert-after.gif +0 -0
  328. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/cell-insert-before.gif +0 -0
  329. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/cell-merge.gif +0 -0
  330. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/cell-prop.gif +0 -0
  331. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/cell-split.gif +0 -0
  332. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/col-delete.gif +0 -0
  333. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/col-insert-after.gif +0 -0
  334. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/col-insert-before.gif +0 -0
  335. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/col-split.gif +0 -0
  336. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/row-delete.gif +0 -0
  337. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/row-insert-above.gif +0 -0
  338. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/row-insert-under.gif +0 -0
  339. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/row-prop.gif +0 -0
  340. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/row-split.gif +0 -0
  341. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/img/table-prop.gif +0 -0
  342. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/cz.js +0 -90
  343. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/da.js +0 -90
  344. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/de.js +0 -81
  345. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/el.js +0 -81
  346. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/en.js +0 -90
  347. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/fi.js +0 -66
  348. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/hu.js +0 -63
  349. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/it.js +0 -81
  350. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/nl.js +0 -90
  351. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/no.js +0 -91
  352. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/lang/ro.js +0 -90
  353. data/lib/web/wiki/resources/htmlarea/plugins/TableOperations/table-operations.js +0 -1160
  354. data/lib/web/wiki/resources/htmlarea/popupdiv.js +0 -369
  355. data/lib/web/wiki/resources/htmlarea/popups/about.html +0 -378
  356. data/lib/web/wiki/resources/htmlarea/popups/blank.html +0 -2
  357. data/lib/web/wiki/resources/htmlarea/popups/custom2.html +0 -35
  358. data/lib/web/wiki/resources/htmlarea/popups/editor_help.html +0 -16
  359. data/lib/web/wiki/resources/htmlarea/popups/fullscreen.html +0 -133
  360. data/lib/web/wiki/resources/htmlarea/popups/insert_image.html +0 -191
  361. data/lib/web/wiki/resources/htmlarea/popups/insert_table.html +0 -174
  362. data/lib/web/wiki/resources/htmlarea/popups/link.html +0 -142
  363. data/lib/web/wiki/resources/htmlarea/popups/old-fullscreen.html +0 -131
  364. data/lib/web/wiki/resources/htmlarea/popups/old_insert_image.html +0 -206
  365. data/lib/web/wiki/resources/htmlarea/popups/popup.js +0 -109
  366. data/lib/web/wiki/resources/htmlarea/popups/select_color.html +0 -347
  367. data/lib/web/wiki/resources/htmlarea/popupwin.js +0 -139
  368. data/lib/web/wiki/resources/htmlarea/reference.html +0 -523
  369. data/lib/web/wiki/resources/htmlarea/release-notes.html +0 -165
  370. data/lib/web/wiki/resources/illustration.html~ +0 -1
  371. data/lib/web/wiki/resources/index.html~ +0 -4
  372. data/lib/web/wiki/resources/more_news.html~ +0 -5
  373. data/lib/web/wiki/resources/more_news_rss_0.91.html +0 -23
  374. data/lib/web/wiki/resources/page_history.html~ +0 -19
  375. data/lib/web/wiki/resources/template.html~ +0 -13
  376. data/narf.gemspec~ +0 -40
  377. data/sapi/apache_cgi/INSTALL.txt~ +0 -9
  378. data/sapi/apache_cgi/README~ +0 -0
  379. data/sapi/fastcgi/INSTALL.txt~ +0 -17
  380. data/sapi/mod_ruby/INSTALL.txt~ +0 -5
  381. data/sapi/webrick/INSTALL.txt~ +0 -21
  382. data/sapi/webrick/run_webrick.rb~ +0 -16
  383. data/scripts/makedist.rb~ +0 -49
  384. data/test/mod_ruby_stub.rb~ +0 -38
  385. data/test/test.action.rb~ +0 -142
  386. data/test/test.assertinclude.rb~ +0 -109
  387. data/test/test.narf.cgi.rb~ +0 -105
  388. data/test/test.request.rb~ +0 -328
  389. data/test/test.response.rb~ +0 -556
  390. data/test/test.template.rb~ +0 -832
  391. data/test/test.web.test.rb~ +0 -461
  392. data/test/webunit/test_cookie.rb~ +0 -128
  393. data/test/webunit/test_form.rb~ +0 -43
  394. data/test/webunit/test_multipart.rb~ +0 -53
  395. data/test/webunit/test_params.rb~ +0 -211
  396. data/test/webunit/test_response.rb~ +0 -145
  397. data/test/webunit/test_site/assert.html~ +0 -1
  398. data/test/webunit/test_site/auth/index.html~ +0 -1
  399. data/test/webunit/test_site/badtags.html~ +0 -1
  400. data/test/webunit/test_site/cookie.cgi~ +0 -35
  401. data/test/webunit/test_site/document.xml~ +0 -1
  402. data/test/webunit/test_site/form.html~ +0 -1
  403. data/test/webunit/test_site/frame-0.html~ +0 -1
  404. data/test/webunit/test_site/frame-1.html~ +0 -1
  405. data/test/webunit/test_site/frame.html~ +0 -1
  406. data/test/webunit/test_site/image.html~ +0 -1
  407. data/test/webunit/test_site/include.cgi~ +0 -10
  408. data/test/webunit/test_site/jscript-0.html~ +0 -1
  409. data/test/webunit/test_site/jscript-1.html~ +0 -1
  410. data/test/webunit/test_site/jscript.html~ +0 -1
  411. data/test/webunit/test_site/link.html~ +0 -1
  412. data/test/webunit/test_site/multipart.cgi~ +0 -25
  413. data/test/webunit/test_site/multipart.html~ +0 -1
  414. data/test/webunit/test_site/params.html~ +0 -1
  415. data/test/webunit/test_site/redirect.cgi~ +0 -14
  416. data/test/webunit/test_site/response.html~ +0 -1
  417. data/test/webunit/test_site/simple.cgi~ +0 -17
  418. data/test/webunit/test_site/stock.cgi~ +0 -34
  419. data/test/webunit/test_site/table.html~ +0 -1
  420. data/test/webunit/test_site/test.cgi~ +0 -25
  421. data/test/wiki/test.history.rb~ +0 -254
  422. data/test/wiki/test.illustration_page.rb~ +0 -287
  423. data/test/wiki/test.tarpit.rb~ +0 -40
  424. data/test/wiki/test.wiki.rb~ +0 -295
data/examples/admin.rb~ DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/local/bin/narf
2
-
3
- require 'web/wiki'
4
-
5
- Web::Wiki.handle_request
@@ -1,238 +0,0 @@
1
- Narf offers a set of methods for testing. This document explains the
2
- use of these methods.
3
-
4
- === Using cgi.assert_content
5
-
6
- 1. The simplest form of testing is to use assert methods on the cgi:
7
-
8
- class TestHello < Test::Unit::TestCase
9
- def test_hello
10
- cgi = Web.process{ |cgi|
11
- handle_request( cgi )
12
- }
13
- cgi.assert_content "Hello, World"
14
- end
15
- end
16
-
17
- def handle_request cgi
18
- cgi.write "Hello, World"
19
- end
20
-
21
- 2. Narf provides a Web::App stub to wrap these methods:
22
-
23
- class TestHello < Test::Unit::TestCase
24
- def test_hello
25
- cgi = HelloApp.run
26
- cgi.assert_content "Hello, World"
27
- end
28
- end
29
-
30
- class HelloApp < Web::App
31
- def handle_request cgi
32
- cgi.write "Hello, World"
33
- end
34
- end
35
-
36
- 3. You can pass parameters into the process / run methods to mock a form
37
- submission:
38
-
39
- class TestHello < Test::Unit::TestCase
40
- def test_hello
41
- cgi = HelloApp.run( :params => { "greeting" => "Welcome" } )
42
- cgi.assert_content "Welcome, World"
43
- end
44
- end
45
-
46
- class HelloApp < Web::App
47
- def handle_request cgi
48
- cgi.write cgi["greeting"] + ", World"
49
- end
50
- end
51
-
52
-
53
- === A Simple Test Case using a Template
54
-
55
- Explaining the use of assert_content is simple, but using
56
- assert_content is frustrating on a typical project. Imagine if the
57
- expected results for the previous example was an HTML page:
58
-
59
- <html>
60
- <head>
61
- <title>HelloApp</title>
62
- </head>
63
- <body>
64
- <h1>Welcome, World</h1>
65
- </body>
66
- </html>
67
-
68
- Just writing this example shows the need. Most of the HTML doesn't
69
- change often, but it still needs to be typed twice to make
70
- assert_content work. As a result, more time is spent matching tabs and
71
- spaces between potential large strings of HTML than on improving the
72
- utility and quality of the web pages.
73
-
74
- We don't want to test the values of the constants on the page, we want
75
- to test what changes. This is the purpose of Narf's templating
76
- functions. Writing a testcase is only slightly more complicated than
77
- the normal test-case.
78
-
79
- class TestHello < Test::Unit::TestCase
80
- def test_hello
81
- cgi = HelloApp.run(:params => { "greeting" => "foo"} )
82
- cgi.assert_template_used "hello_template.html"
83
- cgi.assert_vars_includes { "var" => "foo" }
84
- end
85
- end
86
-
87
- class HelloApp < Web::App
88
- def handle_request cgi
89
- end
90
- end
91
-
92
- Now the tests will fail giving an error saying that the
93
- template hello_template.html hasn't been displayed. So, we create it.
94
- The template contains a parameter which we expect to be replaced:
95
-
96
- <html>
97
- <head>
98
- <title>HelloApp</title>
99
- </head>
100
- <body>
101
- <h1>{$var}, World</h1>
102
- </body>
103
- </html>
104
-
105
- We also need to change the application to print this template:
106
-
107
- class HelloApp < Web::App
108
- def handle_request cgi
109
- print_template "hello_template.html"
110
- end
111
- end
112
-
113
- Now, the first assertion will pass, but the second will fail
114
- complaining that the field var has not been set.
115
-
116
- In order to resolve this, we now need to modify the code to
117
- actually set the values, We do this by passing a hash defining
118
- the values we want printed in the template. The keys in the hash
119
- correspond to the embedded variables in the template, allowing
120
- us to print the hashed values in the template.
121
-
122
- class TestDisplay < Test::Unit::TestCase
123
- def test_hello
124
- cgi = HelloApp.run(:params => {"greeting" => "foo"})
125
- cgi.assert_template_used "hello_template.html"
126
- cgi.assert_vars_includes { "var" => "foo" }
127
- end
128
- end
129
-
130
- class HelloApp < Web::App
131
- def handle_request cgi
132
- print_template "hello_template.html", { "var" => "foo" }
133
- end
134
- end
135
-
136
- Now the tests all pass, but the application is not responding to
137
- the parameter being passed in. To make it respond to this, we need
138
- to add one more test and make one final change to the code.
139
-
140
- class TestHello < Test::Unit::TestCase
141
- def test_template1
142
- ....
143
- end
144
-
145
- def test_template2
146
- cgi = HelloApp.run(:params => {"greeting" => "Hola"})
147
- cgi.assert_template_used "hello_template.html"
148
- cgi.assert_vars_includes { "var" => "Hola" }
149
- end
150
- end
151
-
152
- class MyWebApp < WebApplication
153
- def handle_request cgi
154
- print_template "hello_template.html", { "var" => cgi["Hola"] }
155
- end
156
- end
157
-
158
- Running the tests, we have completed this trivial application.
159
-
160
- === More Complex Examples
161
-
162
- Now we can try to build a slightly more complicated form
163
- structure. By adding some repeating elements. For this we now
164
- want to check
165
-
166
-
167
- Testing with forms
168
-
169
- In addition to the presentation of data, many web
170
- applications also interact with the user using forms. NARF
171
- includes features for this as well - those who have used the
172
- Java HTTPUnit will find some of this API familiar. Using this
173
- API it is possible to test the correct displaying of forms and
174
- their interactions. In the following example we test that a form
175
- is displayed with the correct values.
176
-
177
- class TestDisplay < Test::Unit::TestCase
178
- def test_default_form_value
179
- cgi = HelloApp.run()
180
- application.run
181
- application.assert_template_used "mytemplatename.html"
182
- application.assert_form_value "item", "foo"
183
- end
184
- end
185
-
186
- This can be implemented with the following code:
187
-
188
- class MyWebApp < WebApplication
189
- def handle_request cgi
190
- print_template "test.template.html", { "item" => "foo" }
191
- end
192
- end
193
-
194
- <html>
195
- <body>
196
- <h1>Page Displaying Form</h1>
197
-
198
- {form name="test"}
199
- {input name=item value="foo"}
200
- {submit name=submitbutton value="Submit"}
201
- {/form}
202
-
203
- </body>
204
- </html>
205
-
206
- The following test checks that the form had a particular value,
207
- and then makes use of the templating library to make sure it was
208
- displayed correctly.
209
-
210
- class TestDisplay < Test::Unit::TestCase
211
- .....
212
-
213
- def test_submitting_form_displays_thankyou
214
- cgi = HelloApp.run()
215
- application.run
216
- application.submit! "foo", { name => "Tom" }
217
- application.assert_template_used "display_thankyou.html"
218
- application.assert_includes { "name" => "Tom" }
219
- end
220
- end
221
-
222
- class MyWebApp < WebApplication
223
- def handle_request cgi
224
- if cgi.has_key?("submitbutton")
225
- print_template "display_thankyou.html", { "item" => cgi["name"] }
226
- else
227
- print_template "test.template.html", { "item" => "foo" }
228
- end
229
- end
230
- end
231
-
232
- === Dynamically Created Forms
233
-
234
- === Using Sessions
235
-
236
-
237
-
238
-
@@ -1,17 +0,0 @@
1
- These directories contains examples of the narf api's.
2
-
3
- === Tested examples:
4
-
5
- hello.world.rb:: the classic
6
- wiki.rb:: The NARF libary includes the wiki. Preview it at http://www.narf-lib.org
7
-
8
- === Untested examples
9
-
10
- * session.rb - Illustrates using the session api
11
-
12
- === Examples to be written
13
-
14
- * cookie.rb
15
- * params.rb
16
- * multipart.rb
17
- * template.rb
@@ -1,3 +0,0 @@
1
- #!/usr/local/bin/narf
2
-
3
- puts "Hello World"
data/examples/session.rb~ DELETED
@@ -1,31 +0,0 @@
1
- #!/usr/bin/narf
2
-
3
- require 'web'
4
-
5
- # Add session values
6
- unless Web["key"].empty?
7
- Web.session[ Web["key"] ] = Web["value"]
8
- end
9
-
10
- # Delete session values
11
- Web["delete[]"].each { |key|
12
- Web.session.delete key
13
- }
14
-
15
- # Printing the form
16
- Web.puts '<html><body>'
17
- Web.puts '<form name="session_test">'
18
- Web.puts '<h3>Session Values:</h3>'
19
-
20
- Web.session.each { |key, val|
21
- Web.puts "<b>#{key}</b> => <i>#{val}</i><br>"
22
- Web.puts "Delete #{key}? <input type=\"checkbox\" name=\"delete[]\" value=\"#{key}\"><br>"
23
- }
24
-
25
- Web.print <<-HTML
26
- <h3>Enter new value:</h3>
27
- Key: <input type="text" name="key"> => Value:<input type="text" name="value">
28
- <p><input type="submit" value="Save"></p>
29
- </form>
30
- </body></html>
31
- HTML
@@ -1,9 +0,0 @@
1
- class TestHelloWorld < Test::Unit::TestCase
2
- include Web::Testing
3
-
4
- def test_default
5
- do_request "hello.world.rb"
6
- assert_content( "Hello World" )
7
- end
8
- end
9
-
@@ -1,37 +0,0 @@
1
- class TestSession < Test::Unit::TestCase
2
- include Web::Testing
3
-
4
- def test_session
5
- do_request "session.rb"
6
-
7
- assert_form_includes( "session_test",
8
- "key" => nil,
9
- "value" => nil )
10
-
11
- do_submit( "session_test",
12
- "key" => "patrick",
13
- "value" => "a person of dubious motives" )
14
-
15
- assert_equal( { "patrick" => "a person of dubious motives" },
16
- Web.session )
17
-
18
-
19
- do_submit( "session_test",
20
- "key" => "tom",
21
- "value" => "a speedy programmer" )
22
-
23
- assert_equal( { "patrick" => "a person of dubious motives",
24
- "tom" => "a speedy programmer" },
25
- Web.session )
26
-
27
- assert_form_includes( "session_test", "delete[]" => select([ ],
28
- "patrick",
29
- "tom" ) )
30
-
31
- do_submit( "session_test", "delete[]" => "patrick" )
32
-
33
- #assert_equal( { "tom" => "a speedy programmer" },
34
- # Web.session )
35
-
36
- end
37
- end
data/examples/wiki.rb~ DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/local/bin/narf
2
-
3
- require 'web/wiki'
4
-
5
- Web::Wiki.handle_request
data/lib/web.rb~ DELETED
@@ -1,290 +0,0 @@
1
- require 'test/unit/assertions'
2
-
3
- require 'web/strscanparser'
4
- require 'web/action'
5
- require 'web/buffer'
6
- require 'web/upload'
7
- require 'web/parser'
8
- require 'web/session'
9
- require 'web/writableio'
10
- require 'web/template'
11
- require 'web/assertinclude'
12
- require 'web/forms'
13
- require 'web/tagparser'
14
- require 'web/testing'
15
- require 'web/formreader.rb'
16
- require 'web/simpledispatcher'
17
- require 'web/traceoutput'
18
- require 'web/mime'
19
- require 'web/cgi'
20
-
21
- require 'web/htmltools/tree'
22
-
23
- # Write output to client. Replaces Kernel.puts;
24
- # use that or $stderr.puts if you want the standard puts.
25
- def puts( *args )
26
- Web.puts args
27
- end
28
-
29
- begin
30
- require('stringio')
31
- rescue LoadError
32
- module Web
33
- class StringIO # :nodoc:
34
- def initialize
35
- @___content___ = ""
36
- end
37
-
38
- def read
39
- @___content___
40
- end
41
-
42
- def clear
43
- @___content___ = ""
44
- end
45
-
46
- def string
47
- @___content___
48
- end
49
-
50
- def puts(*args)
51
- @___content___ << args.join("\n") << "\n"
52
- end
53
-
54
- def << var
55
- @___content___ << var.to_s
56
- end
57
-
58
- def write var
59
- @___content___ << var.to_s
60
- end
61
-
62
- def print var
63
- @___content___ << var.to_s
64
- end
65
- end
66
- end
67
-
68
- unless Kernel.const_defined? "StringIO"
69
- StringIO = Web::StringIO.clone
70
- end
71
- end
72
-
73
- # == Purpose
74
- # Web provides an infrastructure for building and testing
75
- # web applications.
76
- #
77
- # == Usage
78
- # Use the Web module to interact with the client. The module
79
- # delegates to a Web::CGI object, which does the actual work.
80
- #
81
- # #!/usr/bin/narf
82
- # Web["field"] # access parameters
83
- # Web.cookies["muppet"] # access cookies
84
- # Web.session["key"] ||= "value" # get and set session values
85
- # Web.set_cookie( "muppet", "cookie monster" ) # set cookies
86
- # Web.puts "something" # print 'something' out
87
- #
88
- # If the request contained multipart/form-data, uploaded files are returned as
89
- # Web::Upload objects. Other parameters are treated as strings.
90
- #
91
- # == Output
92
- #
93
- # You write output as if it were an IO:
94
- # Web << "<h1>Hello World!</h1>"
95
- # Web.print "<p>We have lots of tricks for you.<br>"
96
- # Web.write "From kungfu to jiujitsu<br>"
97
- # Web.puts "anything and everything works</p>."
98
- # or even:
99
- # puts "hello world"
100
- #
101
- # Narf buffers output by default. Buffered output allows you to set headers
102
- # (cookies, redirects, status, etc.) at any point before the cgi is flushed.
103
- # You can force this by calling:
104
- # Web.flush
105
- #
106
- # Once the headers are sent to the client, you cannot set any more headers.
107
- #
108
- # == Error Handling
109
- #
110
- # For cgi-scripts under Apache, one can use the 'bin/narf'
111
- # script instead of using the ruby executable. This little c program
112
- # doesn't do much fancy, but it can trap syntax errors and send them
113
- # back to the browser. <i>I would especially appreciate security-related
114
- # feedback; narf.c is contributed and I am not a c programmer.</i>
115
- #
116
- # == Sessions:
117
- #
118
- # Sessions provide a way of storing data between Web
119
- # requests. Anything that can be marshalled can be stored in the
120
- # session.
121
- #
122
- # === Getting and Setting values in a session
123
- #
124
- # Web.session["key"] = "value"
125
- # Web.session["key"] # => "value"
126
- #
127
- # === Deleting session values
128
- #
129
- # Web.session["key"] = "value"
130
- # Web.session["key"].delete # => "value"
131
- # Web.session["key"] # => "nil"
132
- #
133
- # === Iterating through session keys
134
- #
135
- # Web.session.each do |key, val|
136
- # Web.puts "#{key} => #{val}<br>"
137
- # end
138
- #
139
- # === Resetting the Session
140
- #
141
- # Reseting the session to an empty hash is simple:
142
- # Web.session.reset
143
- #
144
- # === Testing
145
- #
146
- # Narf takes testing very seriously. I consider supporting
147
- # testing to be part of the contract when writing a IO library.
148
- # See Web::Testing for more details.
149
- #
150
- module Web
151
- class << self
152
- # Web delegates to the current
153
- # cgi object. This is the recommended
154
- # way to use narf:
155
- #
156
- # Web["param"]
157
- # Web << "hello world"
158
- # Web.set_redirect( "http://www.narf-lib.org" )
159
- # ...
160
- #
161
- # The documentation for these methods is on the Web::CGI object.
162
- def method_missing(method, *args, &block)
163
- CGI.get_cgi.send(method,*args, &block)
164
- end
165
-
166
- def set_cgi( cgi )
167
- CGI.set_cgi( cgi )
168
- end
169
-
170
- def get_cgi
171
- CGI.get_cgi
172
- end
173
-
174
- def process(options={}, &block)
175
- CGI.process(options, &block)
176
- end
177
- end
178
-
179
- # this is a bit incomplete -- only encodes ampersands
180
- def Web::html_encode(string)
181
- return nil unless string
182
- newstring = string.dup
183
- { /&/ => '&amp;' }.each{ |char, entity|
184
- newstring.gsub!( char, entity )
185
- }
186
- newstring
187
- end
188
-
189
- # Escape URL encode
190
- # url_encoded_string = Web::escape("string")
191
- def Web::escape(string)
192
- return nil unless string
193
- string.gsub(/([^ a-zA-Z0-9_.-]+)/n) do
194
- '%' + $1.unpack('H2' * $1.size).join('%').upcase
195
- end.tr(' ', '+')
196
- end
197
-
198
- # Unescape URL encoded
199
- # string = Web::unescape("url encoded string")
200
- def Web::unescape(string)
201
- return nil unless string
202
- string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do
203
- [$1.delete('%')].pack('H*')
204
- end
205
- end
206
-
207
- RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
208
- RFC822_MONTHS = %w[ Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ]
209
- # Make RFC1123 date string
210
- # Web::rfc1123_date(Time.now) # => Sat, 01 Jan 2000 00:00:00 GMT
211
- def Web::rfc1123_date(time)
212
- t = time.clone.gmtime
213
- return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
214
- RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
215
- t.hour, t.min, t.sec)
216
- end
217
-
218
- HTTP_STATUS = {"200" => "OK",
219
- "206" => "Partial Content",
220
- "300" => "Multiple Choices",
221
- "301" => "Moved Permanently",
222
- "302" => "Found",
223
- "304" => "Not Modified",
224
- "400" => "Bad Request",
225
- "401" => "Authorization Required",
226
- "403" => "Forbidden",
227
- "404" => "Not Found",
228
- "405" => "Method Not Allowed",
229
- "406" => "Not Acceptable",
230
- "411" => "Length Required",
231
- "412" => "Precondition Failed",
232
- "500" => "Internal Server Error",
233
- "501" => "Method Not Implemented",
234
- "502" => "Bad Gateway",
235
- "506" => "Variant Also Negotiates"
236
- }
237
-
238
-
239
- TRACE_STYLESHEET=<<-EOF
240
- <style type="text/css">
241
- span.tracecontent { background-color:white; color:black;font: 10pt verdana, arial; }
242
- span.tracecontent table { font: 10pt verdana, arial; cellspacing:0; cellpadding:0; margin-bottom:25}
243
- span.tracecontent tr.subhead { background-color:cccccc;}
244
- span.tracecontent th { padding:0,3,0,3 }
245
- span.tracecontent th.alt { background-color:black; color:white; padding:3,3,2,3; }
246
- span.tracecontent td { padding:0,3,0,3 }
247
- span.tracecontent tr.alt { background-color:eeeeee }
248
- span.tracecontent h1 { font: 24pt verdana, arial; margin:0,0,0,0}
249
- span.tracecontent h2 { font: 18pt verdana, arial; margin:0,0,0,0}
250
- span.tracecontent h3 { font: 12pt verdana, arial; margin:0,0,0,0}
251
- span.tracecontent th a { color:darkblue; font: 8pt verdana, arial; }
252
- span.tracecontent a { color:darkblue;text-decoration:none }
253
- span.tracecontent a:hover { color:darkblue;text-decoration:underline; }
254
- span.tracecontent div.outer { width:90%; margin:15,15,15,15}
255
- span.tracecontent table.viewmenu td { background-color:006699; color:white; padding:0,5,0,5; }
256
- span.tracecontent table.viewmenu td.end { padding:0,0,0,0; }
257
- span.tracecontent table.viewmenu a {color:white; font: 8pt verdana, arial; }
258
- span.tracecontent table.viewmenu a:hover {color:white; font: 8pt verdana, arial; }
259
- span.tracecontent a.tinylink {color:darkblue; font: 8pt verdana, arial;text-decoration:underline;}
260
- span.tracecontent a.link {color:darkblue; text-decoration:underline;}
261
- span.tracecontent div.buffer {padding-top:7; padding-bottom:17;}
262
- span.tracecontent .small { font: 8pt verdana, arial }
263
- span.tracecontent table td { padding-right:20 }
264
- span.tracecontent table td.nopad { padding-right:5 }
265
- </style>
266
- EOF
267
-
268
-
269
- # wrapper for web errors
270
- class Error < Exception # :nodoc:
271
-
272
- end
273
-
274
- end
275
-
276
- module HTMLTree # :nodoc: all
277
- module TreeElement
278
- def get_elements aname, elements=[]
279
- children.each { |element|
280
- if element.tag == aname
281
- elements.push element
282
- else
283
- element.get_elements aname, elements
284
- end
285
- }
286
- elements
287
- end
288
- end
289
- end
290
-