nitro 0.17.0 → 0.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. data/CHANGELOG +124 -0
  2. data/README +2 -2
  3. data/Rakefile +4 -12
  4. data/bin/nitro +1 -1
  5. data/bin/nitrogen +47 -31
  6. data/doc/AUTHORS +3 -3
  7. data/doc/RELEASES +50 -1
  8. data/examples/README +7 -0
  9. data/lib/nitro.rb +5 -4
  10. data/lib/nitro/{adapters → adapter}/cgi.rb +2 -4
  11. data/lib/nitro/{adapters → adapter}/fastcgi.rb +1 -1
  12. data/lib/nitro/{adapters → adapter}/webrick.rb +5 -10
  13. data/lib/nitro/buffering.rb +6 -0
  14. data/lib/nitro/{builders → builder}/atom.rb +1 -5
  15. data/lib/nitro/{builders → builder}/form.rb +1 -5
  16. data/lib/nitro/{builders → builder}/rss.rb +3 -1
  17. data/lib/nitro/{builders → builder}/table.rb +2 -4
  18. data/lib/nitro/{builders → builder}/xhtml.rb +3 -5
  19. data/lib/nitro/{builders → builder}/xml.rb +2 -4
  20. data/lib/nitro/caching.rb +6 -4
  21. data/lib/nitro/caching/output.rb +18 -11
  22. data/lib/nitro/context.rb +3 -1
  23. data/lib/nitro/controller.rb +29 -18
  24. data/lib/nitro/dispatcher.rb +2 -4
  25. data/lib/nitro/element.rb +2 -0
  26. data/lib/nitro/environment.rb +2 -4
  27. data/lib/nitro/errors.rb +69 -0
  28. data/lib/nitro/mail.rb +2 -4
  29. data/lib/nitro/markup.rb +20 -3
  30. data/lib/nitro/output.rb +5 -9
  31. data/lib/nitro/part.rb +2 -3
  32. data/lib/nitro/render.rb +49 -30
  33. data/lib/nitro/request.rb +2 -1
  34. data/lib/nitro/runner.rb +23 -12
  35. data/lib/nitro/scaffold.rb +5 -3
  36. data/lib/nitro/service.rb +22 -0
  37. data/lib/nitro/service/xmlrpc.rb +42 -0
  38. data/lib/nitro/session.rb +2 -4
  39. data/lib/nitro/template.rb +8 -10
  40. data/lib/nitro/testing.rb +0 -4
  41. data/proto/public/error.xhtml +27 -2
  42. data/test/nitro/{adapters → adapter}/raw_post1.bin +0 -0
  43. data/test/nitro/{adapters → adapter}/tc_cgi.rb +1 -1
  44. data/test/nitro/{adapters → adapter}/tc_webrick.rb +1 -1
  45. data/test/nitro/{builders → builder}/tc_atom.rb +1 -1
  46. data/test/nitro/{builders → builder}/tc_rss.rb +1 -1
  47. data/test/nitro/{builders → builder}/tc_table.rb +1 -1
  48. data/test/nitro/{builders → builder}/tc_xhtml.rb +1 -1
  49. data/test/nitro/{builders → builder}/tc_xml.rb +1 -1
  50. data/test/nitro/tc_caching.rb +18 -0
  51. data/test/nitro/tc_controller.rb +1 -1
  52. data/test/nitro/tc_mail.rb +3 -1
  53. metadata +33 -168
  54. data/examples/README.windows +0 -9
  55. data/examples/ajax/controller.rb +0 -21
  56. data/examples/ajax/public/index.xhtml +0 -72
  57. data/examples/ajax/public/js/ajax.js +0 -64
  58. data/examples/ajax/run.rb +0 -14
  59. data/examples/blog/README +0 -70
  60. data/examples/blog/conf/apache.conf +0 -30
  61. data/examples/blog/conf/apache.conf.new +0 -53
  62. data/examples/blog/conf/lhttpd.conf +0 -79
  63. data/examples/blog/conf/locales/de.yml +0 -4
  64. data/examples/blog/conf/locales/en.yml +0 -4
  65. data/examples/blog/log/README +0 -3
  66. data/examples/blog/log/apache.error_log +0 -6647
  67. data/examples/blog/log/rewrite_log +0 -161
  68. data/examples/blog/public/base.xsl +0 -153
  69. data/examples/blog/public/fcgi.rb +0 -5
  70. data/examples/blog/public/m/bubbles.gif +0 -0
  71. data/examples/blog/public/m/comments_curve.gif +0 -0
  72. data/examples/blog/public/m/down.gif +0 -0
  73. data/examples/blog/public/m/footer_bg.gif +0 -0
  74. data/examples/blog/public/m/garrow.gif +0 -0
  75. data/examples/blog/public/m/gbull.gif +0 -0
  76. data/examples/blog/public/m/grbull.gif +0 -0
  77. data/examples/blog/public/m/h1_bg.gif +0 -0
  78. data/examples/blog/public/m/header_bg.gif +0 -0
  79. data/examples/blog/public/m/nitro.gif +0 -0
  80. data/examples/blog/public/m/obull.gif +0 -0
  81. data/examples/blog/public/m/page_bg.gif +0 -0
  82. data/examples/blog/public/m/rss.gif +0 -0
  83. data/examples/blog/public/m/side_title_bg.gif +0 -0
  84. data/examples/blog/public/m/sidebar_bg.gif +0 -0
  85. data/examples/blog/public/style.css +0 -305
  86. data/examples/blog/run.rb +0 -43
  87. data/examples/blog/src/blog.rb +0 -21
  88. data/examples/blog/src/controller.rb +0 -151
  89. data/examples/blog/src/mailer.rb +0 -23
  90. data/examples/blog/src/models/blog.rb +0 -33
  91. data/examples/blog/src/models/content.rb +0 -18
  92. data/examples/blog/src/views/blog_entry_email.xhtml +0 -16
  93. data/examples/blog/src/views/comments.xhtml +0 -36
  94. data/examples/blog/src/views/entry_form.xhtml +0 -22
  95. data/examples/blog/src/views/error.xhtml +0 -56
  96. data/examples/blog/src/views/index.xhtml +0 -49
  97. data/examples/blog/src/views/login.xhtml +0 -26
  98. data/examples/blog/src/views/recent_posts.xhtml +0 -14
  99. data/examples/blog/src/views/view_entry.xhtml +0 -37
  100. data/examples/blog/src/views/view_entry.xml +0 -12
  101. data/examples/blog/src/xsl/base.xsl +0 -160
  102. data/examples/blog/src/xsl/style.xsl +0 -143
  103. data/examples/blog/test/tc_blog.rb +0 -43
  104. data/examples/flash/log/README +0 -3
  105. data/examples/flash/root/index.xhtml +0 -16
  106. data/examples/flash/root/show_inline_text.xhtml +0 -17
  107. data/examples/flash/run.rb +0 -7
  108. data/examples/no_xsl_blog/README +0 -24
  109. data/examples/no_xsl_blog/conf/apache.conf +0 -30
  110. data/examples/no_xsl_blog/conf/lhttpd.conf +0 -79
  111. data/examples/no_xsl_blog/conf/locales/de.yml +0 -4
  112. data/examples/no_xsl_blog/conf/locales/en.yml +0 -4
  113. data/examples/no_xsl_blog/lib/blog.rb +0 -16
  114. data/examples/no_xsl_blog/lib/blog/controller.rb +0 -116
  115. data/examples/no_xsl_blog/lib/blog/model.rb +0 -35
  116. data/examples/no_xsl_blog/lib/blog/template.rb +0 -138
  117. data/examples/no_xsl_blog/lib/content.rb +0 -47
  118. data/examples/no_xsl_blog/log/README +0 -3
  119. data/examples/no_xsl_blog/log/apache.error_log +0 -473
  120. data/examples/no_xsl_blog/public/comments.xhtml +0 -36
  121. data/examples/no_xsl_blog/public/entry_form.xhtml +0 -22
  122. data/examples/no_xsl_blog/public/fcgi.rb +0 -5
  123. data/examples/no_xsl_blog/public/index.xhtml +0 -39
  124. data/examples/no_xsl_blog/public/login.xhtml +0 -21
  125. data/examples/no_xsl_blog/public/m/bubbles.gif +0 -0
  126. data/examples/no_xsl_blog/public/m/comments_curve.gif +0 -0
  127. data/examples/no_xsl_blog/public/m/down.gif +0 -0
  128. data/examples/no_xsl_blog/public/m/footer_bg.gif +0 -0
  129. data/examples/no_xsl_blog/public/m/garrow.gif +0 -0
  130. data/examples/no_xsl_blog/public/m/gbull.gif +0 -0
  131. data/examples/no_xsl_blog/public/m/grbull.gif +0 -0
  132. data/examples/no_xsl_blog/public/m/h1_bg.gif +0 -0
  133. data/examples/no_xsl_blog/public/m/header_bg.gif +0 -0
  134. data/examples/no_xsl_blog/public/m/nitro.gif +0 -0
  135. data/examples/no_xsl_blog/public/m/obull.gif +0 -0
  136. data/examples/no_xsl_blog/public/m/page_bg.gif +0 -0
  137. data/examples/no_xsl_blog/public/m/rss.gif +0 -0
  138. data/examples/no_xsl_blog/public/m/side_title_bg.gif +0 -0
  139. data/examples/no_xsl_blog/public/m/sidebar_bg.gif +0 -0
  140. data/examples/no_xsl_blog/public/recent_posts.xhtml +0 -14
  141. data/examples/no_xsl_blog/public/style.css +0 -299
  142. data/examples/no_xsl_blog/public/view_entry.xhtml +0 -25
  143. data/examples/no_xsl_blog/public/view_entry.xml +0 -12
  144. data/examples/no_xsl_blog/run.rb +0 -35
  145. data/examples/tiny/README +0 -14
  146. data/examples/tiny/conf/apache.conf +0 -30
  147. data/examples/tiny/conf/lhttpd.conf +0 -79
  148. data/examples/tiny/log/README +0 -3
  149. data/examples/tiny/log/apache.error_log +0 -154
  150. data/examples/tiny/public/deep/dir/hello.xhtml +0 -3
  151. data/examples/tiny/public/fcgi.rb +0 -5
  152. data/examples/tiny/public/include.xhtml +0 -3
  153. data/examples/tiny/public/index.xhtml +0 -55
  154. data/examples/tiny/public/nitro.png +0 -0
  155. data/examples/tiny/public/upload.xhtml +0 -21
  156. data/examples/tiny/run.rb +0 -7
  157. data/examples/wee_style/README +0 -10
  158. data/examples/wee_style/run.rb +0 -50
  159. data/examples/why_wiki/README +0 -5
  160. data/examples/why_wiki/run.rb +0 -59
  161. data/proto/public/js/ajax.js +0 -63
data/lib/nitro/markup.rb CHANGED
@@ -1,6 +1,4 @@
1
- # George Moschovitis <gm@navel.gr>
2
- # (c) 2004 Navel, all rights reserved.
3
- # $Id: markup.rb 7 2005-04-12 14:24:10Z gmosx $
1
+ require 'redcloth'
4
2
 
5
3
  require 'glue/property'
6
4
 
@@ -127,4 +125,23 @@ module Markup
127
125
 
128
126
  end
129
127
 
128
+ # Markup shader.
129
+ #
130
+ # === Examples
131
+ #
132
+ # <h1>#{{Welcome}}</h1>
133
+
134
+ class MarkupShader < Shader
135
+
136
+ def process(hash, text)
137
+ # handle strings
138
+ text.gsub!(/\#\{\{(.*?)\}\}/, '#{RedCloth.new(\1).to_html}')
139
+
140
+ process_next(hash, text)
141
+ end
142
+
130
143
  end
144
+
145
+ end
146
+
147
+ # * George Moschovitis <gm@navel.gr>
data/lib/nitro/output.rb CHANGED
@@ -1,12 +1,8 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: output.rb 1 2005-04-11 11:04:30Z gmosx $
4
-
5
- require 'nitro/builders/xml'
6
- require 'nitro/builders/xhtml'
7
- require 'nitro/builders/rss'
8
- require 'nitro/builders/form'
9
- require 'nitro/builders/table'
1
+ require 'nitro/builder/xml'
2
+ require 'nitro/builder/xhtml'
3
+ require 'nitro/builder/rss'
4
+ require 'nitro/builder/form'
5
+ require 'nitro/builder/table'
10
6
 
11
7
  module Nitro
12
8
 
data/lib/nitro/part.rb CHANGED
@@ -1,11 +1,11 @@
1
- # UNDER CONSTRUCTION, dont use yet!
1
+ # WARNING: UNDER CONSTRUCTION, dont use yet!
2
2
 
3
3
  require 'glue/attribute'
4
4
 
5
5
  module Nitro
6
6
 
7
7
  class Part
8
- cattr_accessor :parts_root, "/home/gmosx/private/plasma/parts"
8
+ cattr_accessor :parts_root, '/home/gmosx/private/plasma/src'
9
9
  end
10
10
 
11
11
  end
@@ -20,4 +20,3 @@ module Kernel
20
20
  end
21
21
 
22
22
  end
23
-
data/lib/nitro/render.rb CHANGED
@@ -6,6 +6,7 @@ require 'glue/object'
6
6
 
7
7
  require 'nitro/shaders'
8
8
  require 'nitro/buffering'
9
+ require 'nitro/errors'
9
10
 
10
11
  module Nitro
11
12
 
@@ -25,6 +26,10 @@ module Rendering
25
26
 
26
27
  @@sync = Sync.new
27
28
 
29
+ # The default template root
30
+
31
+ mattr_accessor :default_template_root, 'public'
32
+
28
33
  # The default template name (no extension).
29
34
 
30
35
  mattr_accessor :default_template, 'index'
@@ -54,20 +59,18 @@ module Rendering
54
59
  # Returns nil if no template file is found.
55
60
 
56
61
  def self.template_for_action(template_root, action, ext = :xhtml)
57
-
58
62
  # attempt to find a template of the form
59
63
  # template_root/action.xhtml
60
64
 
61
65
  path = "#{template_root}/#{action.gsub(/__/, '/')}.#{ext}".squeeze('/')
62
-
66
+
63
67
  unless File.exist?(path)
64
-
65
68
  # attempt to find a template of the form
66
69
  # template_root/action/index.xhtml
67
70
 
68
71
  path = "#{template_root}/#{action.gsub(/__/, '/')}/#{Rendering.default_template}.#{ext}".squeeze('/')
69
72
 
70
- unless File.exist?(path)
73
+ unless File.exist?(path)
71
74
  # No template found!
72
75
  path = nil
73
76
  end
@@ -89,7 +92,7 @@ module Rendering
89
92
 
90
93
  # Compile a controller action.
91
94
 
92
- def self.compile_action(klass, action, template_root)
95
+ def self.compile_action(klass, action)
93
96
  @@sync.synchronize do
94
97
  Aspects.include_advice_modules(klass)
95
98
 
@@ -99,7 +102,7 @@ module Rendering
99
102
 
100
103
  return false unless action
101
104
 
102
- Logger.debug "Compiling action '#{template_root}/#{action}'" if $DBG
105
+ Logger.debug "Compiling action '#{klass.template_root}/#{action}'" if $DBG
103
106
 
104
107
  valid = false
105
108
 
@@ -166,13 +169,23 @@ module Rendering
166
169
  end
167
170
  view ||= action
168
171
 
169
- if (template = template_for_action(template_root, view.to_s)) or
170
- klass.instance_methods.include?("#{action}_template")
171
- valid = true
172
-
173
- code << %{
174
- #{action}_template;
175
- }
172
+ cklass = klass
173
+
174
+ while cklass.respond_to?(:template_root)
175
+ if template = template_for_action(cklass.template_root, view.to_s)
176
+ valid = true
177
+ code << %{
178
+ #{action}_template;
179
+ }
180
+ break
181
+ end
182
+
183
+ # don't search in parent template roots if an
184
+ # action is defined.
185
+
186
+ break if valid
187
+
188
+ cklass = cklass.superclass
176
189
  end
177
190
 
178
191
  # raise "Invalid action '#{action}' for '#{klass}'!" unless valid
@@ -194,26 +207,28 @@ module Rendering
194
207
  end
195
208
  }
196
209
 
210
+ # First compile the action method.
211
+
212
+ # begin
213
+ klass.class_eval(code)
214
+ # rescue SyntaxError => e
215
+ # raise ActionCompileError.new(code, action, e)
216
+ # end
217
+
218
+ # Try to compile the template (if exists).
219
+
197
220
  if template
198
- code << %{
221
+ code = %{
199
222
  def #{action}_template
200
223
  #{transform_template(template, Rendering.shader)}
201
224
  end
202
225
  }
203
- end
204
-
205
- # puts '---', klass, '==', code, '---'
206
-
207
- begin
208
- # FIXME: replace with correct file, line. search for
209
- # lines in error radius.
210
- klass.class_eval(code, __FILE__, __LINE__)
211
- rescue SyntaxError => e
212
- where = "Action: #{action}"
213
- where += ", Template: #{template}" if template
214
- Logger.error "Action compilation error, #{where}"
215
- Logger.error e
216
- return false
226
+
227
+ begin
228
+ klass.class_eval(code, template)
229
+ rescue SyntaxError => e
230
+ raise TemplateCompileError.new(code, template, e)
231
+ end
217
232
  end
218
233
  end
219
234
 
@@ -307,9 +322,11 @@ private
307
322
  # Send a redirect response.
308
323
 
309
324
  def redirect(url, status = 303)
325
+ url = url.to_s
326
+ url = "#{@context.host_url}/#{url.gsub(/^\//, '')}" unless url =~ /http/
310
327
  @context.status = status
311
- @context.out = "<html><a href=\"#{url.to_s}\">#{url.to_s}</a>.</html>\n"
312
- @context.response_headers['location'] = url.to_s
328
+ @context.out = "<html><a href=\"#{url}\">#{url}</a>.</html>\n"
329
+ @context.response_headers['location'] = url
313
330
 
314
331
  raise RenderExit
315
332
  end
@@ -363,3 +380,5 @@ private
363
380
  end
364
381
 
365
382
  end
383
+
384
+ # * George Moschovitis <gm@navel.gr>
data/lib/nitro/request.rb CHANGED
@@ -116,9 +116,10 @@ module Request
116
116
  end
117
117
 
118
118
  # The server host name.
119
+ # Also handles proxy forwarding.
119
120
 
120
121
  def host
121
- @headers['HTTP_HOST']
122
+ @headers['HTTP_X_FORWARDED_HOST'] || @headers['HTTP_HOST']
122
123
  end
123
124
 
124
125
  def host_url
data/lib/nitro/runner.rb CHANGED
@@ -1,10 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # * George Moschovitis <gm@navel.gr>
4
- # * James Britt <james_b@neurogami.com>
5
- # (c) 2004-2005 Navel, all rights reserved.
6
- # $Id: runner.rb 9 2005-04-13 00:08:20Z nasis $
7
-
8
3
  require 'optparse'
9
4
 
10
5
  require 'glue/misc'
@@ -222,12 +217,12 @@ class Runner
222
217
  alias_method :setup_production, :setup_live
223
218
 
224
219
  def invoke_fcgi_proc(conf)
225
- require 'nitro/adapters/fastcgi'
220
+ require 'nitro/adapter/fastcgi'
226
221
  FastCGI.start(conf)
227
222
  end
228
223
 
229
224
  def invoke_cgi_proc(conf)
230
- require 'nitro/adapters/cgi'
225
+ require 'nitro/adapter/cgi'
231
226
  Cgi.start(conf)
232
227
  end
233
228
 
@@ -258,19 +253,19 @@ class Runner
258
253
 
259
254
  case @server
260
255
  when :webrick
261
- require 'nitro/adapters/webrick'
256
+ require 'nitro/adapter/webrick'
262
257
  Webrick.start(conf)
263
-
258
+
264
259
  when :lhttpd
265
- require 'nitro/adapters/fastcgi'
260
+ require 'nitro/adapter/fastcgi'
266
261
  `lighttpd -f conf/lhttpd.conf`
267
262
 
268
263
  when :apache
269
- require 'nitro/adapters/fastcgi'
264
+ require 'nitro/adapter/fastcgi'
270
265
  `apachectl -d #{Dir.pwd} -f conf/apache.conf -k start`
271
266
 
272
267
  when :cgi
273
- require 'nitro/adapters/cgi'
268
+ require 'nitro/adapter/cgi'
274
269
  end
275
270
 
276
271
  when :stop
@@ -287,6 +282,18 @@ class Runner
287
282
  end
288
283
  end
289
284
 
285
+ def daemonize
286
+ require 'daemons/daemonize'
287
+ pwd = Dir.pwd
288
+ Daemonize.daemonize(File.join(pwd, 'log/app.log'))
289
+ # Restore the original pwd (daemonize sets the
290
+ # pwd to '/').
291
+ Dir.chdir(pwd)
292
+ # Set the logger to a file (daemonize closes the
293
+ # std streams).
294
+ Logger.set(Logger.new('log/app.log'))
295
+ end
296
+
290
297
  # Helper method.
291
298
 
292
299
  def self.run(conf)
@@ -313,6 +320,7 @@ end
313
320
 
314
321
  def self.run(conf = nil)
315
322
  runner = Runner.new.setup
323
+ runner.daemonize if runner.daemon
316
324
  conf ||= Conf.new({})
317
325
  $nitro_environment = conf
318
326
  yield(conf) if block_given?
@@ -320,3 +328,6 @@ def self.run(conf = nil)
320
328
  end
321
329
 
322
330
  end
331
+
332
+ # * George Moschovitis <gm@navel.gr>
333
+ # * James Britt <james_b@neurogami.com>
@@ -1,4 +1,6 @@
1
- require 'glue/inflector'
1
+ require 'facet/string/singular'
2
+ require 'facet/string/demodulize'
3
+ require 'facet/string/underscore'
2
4
 
3
5
  module Nitro
4
6
 
@@ -23,8 +25,8 @@ module Scaffolding
23
25
  def scaffold(klass, options = {})
24
26
 
25
27
  oid = options[:oid] || 'oid'
26
- name = options[:name] || Inflector.name(klass.name)
27
- list_name = options[:list_name] || Inflector.plural_name(name)
28
+ name = options[:name] || klass.to_s.demodulize.underscore.downcase
29
+ list_name = options[:list_name] || name.plural
28
30
  options[:nosuffix] ? suffix = nil : suffix = "_#{name}"
29
31
 
30
32
  # Add methods to the scaffolded class.
@@ -0,0 +1,22 @@
1
+ require 'nitro/controller'
2
+
3
+ module Nitro
4
+
5
+ class Service < Nitro::Controller
6
+
7
+ def index
8
+ method, args = decode_request(request.raw_body)
9
+
10
+ res = send(method, *args)
11
+
12
+ response.content_type = 'text/xml'
13
+ print encode_response(method, res)
14
+
15
+ return :stop
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
22
+ # * George Moschovitis <gm@navel.gr>
@@ -0,0 +1,42 @@
1
+ require 'xmlrpc/marshal'
2
+
3
+ require 'nitro/service'
4
+
5
+ module Nitro
6
+
7
+ # The XML-RPC protocol.
8
+
9
+ module XmlRpc
10
+
11
+ # === In
12
+ #
13
+ # [+request+]
14
+ # Raw request data.
15
+ #
16
+ # === Out
17
+ #
18
+ # [+method+]
19
+ # [+args+]
20
+
21
+ def decode_request(request)
22
+ method, args = XMLRPC::Marshal.load_call(request)
23
+ return method.gsub(/\./, '__'), args
24
+ end
25
+
26
+ def encode_response(method_name, response)
27
+ XMLRPC::Marshal.dump_response(response)
28
+ end
29
+
30
+ private
31
+
32
+ end
33
+
34
+ # The XML-RPC base service.
35
+
36
+ class XmlRpcService < Service
37
+ include XmlRpc
38
+ end
39
+
40
+ end
41
+
42
+ # * George Moschovitis <gm@navel.gr>
data/lib/nitro/session.rb CHANGED
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: session.rb 1 2005-04-11 11:04:30Z gmosx $
4
-
5
1
  require 'md5'
6
2
  require 'webrick'
7
3
 
@@ -156,3 +152,5 @@ class SessionStore
156
152
  end
157
153
 
158
154
  end
155
+
156
+ # * George Moschovitis <gm@navel.gr>
@@ -1,7 +1,3 @@
1
- # * George Moschovitis <gm@navel.gr>
2
- # (c) 2004-2005 Navel, all rights reserved.
3
- # $Id: template.rb 30 2005-04-25 12:28:02Z gmosx $
4
-
5
1
  require 'glue/flexob'
6
2
 
7
3
  module Nitro
@@ -79,20 +75,20 @@ module TemplateMixin
79
75
  # Transform the processing instructions, use <?r as
80
76
  # a marker.
81
77
 
82
- text.gsub!(/\?>/, "\n#{buffer} << %^")
83
- text.gsub!(/<\?r(\s?)/, "^\n")
78
+ text.gsub!(/\?>/, "; #{buffer} << %^")
79
+ text.gsub!(/<\?r(\s?)/, "^; ")
84
80
 
85
81
  # Transform alternative code tags.
86
82
  # (very useful in xsl stylesheets)
87
83
 
88
- text.gsub!(/<\/ruby>/, "\n#{buffer} << %^")
89
- text.gsub!(/<ruby>/, "^\n")
84
+ text.gsub!(/<\/ruby>/, "; #{buffer} << %^")
85
+ text.gsub!(/<ruby>/, "^; ")
90
86
 
91
87
  # Also handle erb/asp/jsp style tags. Those tags
92
88
  # *cannot* be used with an xslt stylesheet.
93
89
 
94
- text.gsub!(/%>/, "\n#{buffer} << %^")
95
- text.gsub!(/<%/, "^\n")
90
+ text.gsub!(/%>/, "; #{buffer} << %^")
91
+ text.gsub!(/<%/, "^; ")
96
92
 
97
93
  # Alterative versions of interpolation.
98
94
  # (very useful in xsl stylesheets)
@@ -186,3 +182,5 @@ class FileTemplate < Flexob
186
182
  end
187
183
 
188
184
  end
185
+
186
+ # * George Moschovitis <gm@navel.gr>