wunderbar 0.8.13 → 0.8.14

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.
data/README.md CHANGED
@@ -192,15 +192,6 @@ HTML methods
192
192
  Note that adding an exclamation mark to the end of the tag name disables this
193
193
  behavior.
194
194
 
195
- CGI methods (deprecated?)
196
- ---
197
- * `json` - produce JSON output using the block specified
198
- * `json!` - produce JSON output using the block specified and exit
199
- * `html` - produce HTML output using the block specified
200
- * `html!` - produce HTML output using the block specified and exit
201
- * `post` - execute block only if method is POST
202
- * `post!` - if POST, produce HTML output using the block specified and exit
203
-
204
195
  OpenStruct methods (for $params and $env)
205
196
  ---
206
197
  * `untaint_if_match`: untaints value if it matches a regular expression
@@ -1,135 +1,163 @@
1
- # produce json
2
- def $cgi.json(&block)
3
- return unless $XHR_JSON
4
- $param.each {|key,value| instance_variable_set "@#{key}", value.first}
5
- output = instance_eval(&block)
6
- rescue Exception => exception
7
- Kernel.print "Status: 500 Internal Error\r\n"
8
- output = {
9
- :exception => exception.inspect,
10
- :backtrace => exception.backtrace
11
- }
12
- ensure
13
- if $XHR_JSON
14
- Kernel.print "Status: 404 Not Found\r\n" unless output
15
- $cgi.out? 'type' => 'application/json', 'Cache-Control' => 'no-cache' do
16
- begin
17
- JSON.pretty_generate(output)+ "\n"
18
- rescue
19
- output.to_json + "\n"
1
+ module Wunderbar
2
+
3
+ module CGI
4
+
5
+ # produce json
6
+ def self.json(&block)
7
+ $param.each do |key,value|
8
+ instance_variable_set "@#{key}", value.first if key =~ /^\w+$/
9
+ end
10
+ output = instance_eval(&block)
11
+ rescue Exception => exception
12
+ Kernel.print "Status: 500 Internal Error\r\n"
13
+ output = {
14
+ :exception => exception.inspect,
15
+ :backtrace => exception.backtrace
16
+ }
17
+ ensure
18
+ Kernel.print "Status: 404 Not Found\r\n" unless output
19
+ out? 'type' => 'application/json', 'Cache-Control' => 'no-cache' do
20
+ begin
21
+ JSON.pretty_generate(output)+ "\n"
22
+ rescue
23
+ output.to_json + "\n"
24
+ end
20
25
  end
21
26
  end
22
- end
23
- end
24
27
 
25
- # produce json and quit
26
- def $cgi.json! &block
27
- return unless $XHR_JSON
28
- json(&block)
29
- Process.exit
30
- end
31
-
32
- # produce text
33
- def $cgi.text &block
34
- return unless $TEXT
35
- @output = []
36
- def $cgi.puts(line='')
37
- @output << line + "\n"
38
- end
39
- def $cgi.print(line=nil)
40
- @output << line
41
- end
42
- $param.each {|key,value| instance_variable_set "@#{key}", value.first}
43
- self.instance_eval &block
44
- rescue Exception => exception
45
- Kernel.print "Status: 500 Internal Error\r\n"
46
- @output << "\n" unless @output.empty?
47
- @output << exception.inspect + "\n"
48
- exception.backtrace.each {|frame| @output << " #{frame}\n"}
49
- ensure
50
- class << $cgi
51
- undef puts
52
- undef print
53
- end
54
- if $TEXT
55
- Kernel.print "Status: 404 Not Found\r\n" if @output.empty?
56
- $cgi.out? 'type' => 'text/plain', 'Cache-Control' => 'no-cache' do
57
- @output.join
28
+ # produce text
29
+ def self.text &block
30
+ require 'stringio'
31
+ buffer = StringIO.new
32
+ $param.each do |key,value|
33
+ instance_variable_set "@#{key}", value.first if key =~ /^\w+$/
34
+ end
35
+ buffer.instance_eval &block
36
+ rescue Exception => exception
37
+ Kernel.print "Status: 500 Internal Error\r\n"
38
+ buffer << "\n" unless buffer.size == 0
39
+ buffer << exception.inspect + "\n"
40
+ exception.backtrace.each {|frame| buffer << " #{frame}\n"}
41
+ ensure
42
+ Kernel.print "Status: 404 Not Found\r\n" if buffer.size == 0
43
+ out? 'type' => 'text/plain', 'Cache-Control' => 'no-cache' do
44
+ buffer.string
45
+ end
58
46
  end
59
- @output = nil
60
- end
61
- end
62
47
 
63
- # produce text and quit
64
- def $cgi.text! &block
65
- return unless $TEXT
66
- json(&block)
67
- Process.exit
68
- end
48
+ # Conditionally provide output, based on ETAG
49
+ def self.out?(headers, &block)
50
+ content = block.call
51
+ require 'digest/md5'
52
+ etag = Digest::MD5.hexdigest(content)
69
53
 
70
- # Conditionally provide output, based on ETAG
71
- def $cgi.out?(headers, &block)
72
- content = block.call
73
- require 'digest/md5'
74
- etag = Digest::MD5.hexdigest(content)
75
-
76
- if ENV['HTTP_IF_NONE_MATCH'] == etag.inspect
77
- Kernel.print "Status: 304 Not Modified\r\n\r\n"
78
- else
79
- $cgi.out headers.merge('Etag' => etag.inspect) do
80
- content
54
+ if ENV['HTTP_IF_NONE_MATCH'] == etag.inspect
55
+ Kernel.print "Status: 304 Not Modified\r\n\r\n"
56
+ else
57
+ $cgi.out headers.merge('Etag' => etag.inspect) do
58
+ content
59
+ end
60
+ end
61
+ rescue
81
62
  end
82
- end
83
- end
84
63
 
85
- # produce html/xhtml
86
- def $cgi.html(*args, &block)
87
- return if $XHR_JSON or $TEXT
88
- args << {} if args.empty?
89
- args.first[:xmlns] ||= 'http://www.w3.org/1999/xhtml' if Hash === args.first
90
- mimetype = ($XHTML ? 'application/xhtml+xml' : 'text/html')
91
- x = HtmlMarkup.new
92
- $cgi.out? 'type' => mimetype, 'charset' => 'UTF-8' do
93
- x._! "\xEF\xBB\xBF"
94
- x._.declare :DOCTYPE, :html
95
- x.html *args, &block
96
- end
97
- end
64
+ # produce html/xhtml
65
+ def self.html(*args, &block)
66
+ args << {} if args.empty?
67
+ if Hash === args.first
68
+ args.first[:xmlns] ||= 'http://www.w3.org/1999/xhtml'
69
+ end
70
+ mimetype = ($XHTML ? 'application/xhtml+xml' : 'text/html')
71
+ x = HtmlMarkup.new
72
+ x._! "\xEF\xBB\xBF"
73
+ x._.declare :DOCTYPE, :html
98
74
 
99
- # produce html and quit
100
- def $cgi.html! *args, &block
101
- return if $XHR_JSON or $TEXT
102
- html(*args, &block)
103
- Process.exit
104
- end
75
+ begin
76
+ output = x.html *args, &block
77
+ rescue ::Exception => exception
78
+ Kernel.print "Status: 500 Internal Error\r\n"
79
+ x.clear!
80
+ x._! "\xEF\xBB\xBF"
81
+ x._.declare :DOCTYPE, :html
82
+ output = x.html(*args) do
83
+ _head do
84
+ _title 'Internal Error'
85
+ end
86
+ _body do
87
+ _h1 'Internal Error'
88
+ text = exception.inspect
89
+ Wunderbar.error text
90
+ exception.backtrace.each do |frame|
91
+ next if frame =~ %r{/wunderbar/}
92
+ next if frame =~ %r{/gems/.*/builder/}
93
+ Wunderbar.warn " #{frame}"
94
+ text += "\n #{frame}"
95
+ end
96
+
97
+ _pre text
98
+ end
99
+ end
100
+ end
105
101
 
106
- # post specific logic (doesn't produce output)
107
- def $cgi.post
108
- yield if $HTTP_POST
109
- end
102
+ out? 'type' => mimetype, 'charset' => 'UTF-8' do
103
+ output
104
+ end
105
+ end
106
+ end
110
107
 
111
- # post specific content (produces output)
112
- def $cgi.post! &block
113
- html!(&block) if $HTTP_POST
114
- end
108
+ @queue = []
115
109
 
116
- # canonical interface
117
- module Wunderbar
110
+ # canonical interface
118
111
  def self.html(*args, &block)
119
- $XHTML = false unless ARGV.delete('--xhtml')
120
- $cgi.html!(*args, &block)
112
+ @queue << [:html, args, block]
121
113
  end
122
114
 
123
115
  def self.xhtml(*args, &block)
124
- $XHTML = false if ARGV.delete('--html')
125
- $cgi.html!(*args, &block)
116
+ @queue << [:xhtml, args, block]
126
117
  end
127
118
 
128
119
  def self.json(*args, &block)
129
- $cgi.json!(*args, &block)
120
+ @queue << [:json, args, block]
130
121
  end
131
122
 
132
123
  def self.text(*args, &block)
133
- $cgi.text!(*args, &block)
124
+ @queue << [:text, args, block]
134
125
  end
126
+
127
+ def self.evaluate
128
+ queue, @queue = @queue, []
129
+ xhtml = ARGV.delete('--xhtml')
130
+ html = ARGV.delete('--html')
131
+
132
+ queue.each do |type, args, block|
133
+ case type
134
+ when :html
135
+ unless $XHR_JSON or $TEXT
136
+ $XHTML = false unless xhtml
137
+ CGI.html(*args, &block)
138
+ break
139
+ end
140
+ when :xhtml
141
+ unless $XHR_JSON or $TEXT
142
+ $XHTML = false if html
143
+ CGI.html(*args, &block)
144
+ break
145
+ end
146
+ when :json
147
+ if $XHR_JSON
148
+ CGI.json(*args, &block)
149
+ break
150
+ end
151
+ when :text
152
+ if $TEXT
153
+ CGI.text(*args, &block)
154
+ break
155
+ end
156
+ end
157
+ end
158
+ end
159
+ end
160
+
161
+ at_exit do
162
+ Wunderbar.evaluate
135
163
  end
@@ -16,7 +16,7 @@ class HtmlMarkup
16
16
  end
17
17
  instance_exec(@x, &block)
18
18
  end
19
- target!
19
+ @x.target!.join
20
20
  end
21
21
 
22
22
  def method_missing(name, *args, &block)
@@ -138,7 +138,7 @@ class HtmlMarkup
138
138
  _script text, :lang => 'text/coffeescript'
139
139
  end
140
140
 
141
- def target!
142
- @x.target!.join
141
+ def clear!
142
+ @x.target!.clear
143
143
  end
144
144
  end
@@ -25,6 +25,14 @@ module Wunderbar
25
25
  end
26
26
  end
27
27
 
28
+ def self.log_level
29
+ return 'debug' if logger.level == Logger::DEBUG
30
+ return 'info' if logger.level == Logger::INFO
31
+ return 'warn' if logger.level == Logger::WARN
32
+ return 'error' if logger.level == Logger::ERROR
33
+ return 'fatal' if logger.level == Logger::FATAL
34
+ end
35
+
28
36
  # convenience methods
29
37
  def self.debug(*args, &block)
30
38
  logger.debug *args, &block
@@ -2,7 +2,7 @@ module Wunderbar
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 8
5
- TINY = 13
5
+ TINY = 14
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/wunderbar.gemspec CHANGED
@@ -2,35 +2,31 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "wunderbar"
5
- s.version = "0.8.13"
5
+ s.version = "0.8.14"
6
6
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Ruby"]
9
- s.date = "2012-03-24"
10
- s.description = " Provides a number of globals, helper methods, and monkey patches which\n simplify the generation of HTML and the development of CGI scripts.\n"
9
+ s.date = "2012-03-30"
10
+ s.description = " Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode\n (utf-8), consistently indented, readable applications. This includes\n output that conforms to the Polyglot specification and the emerging\n results from the XML Error Recovery Community Group.\n"
11
11
  s.email = "rubys@intertwingly.net"
12
- s.extra_rdoc_files = ["COPYING", "README.md", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/version.rb"]
13
- s.files = ["COPYING", "README.md", "Rakefile", "demo/envdump.rb", "demo/helloworld.rb", "demo/wiki.html", "demo/wiki.rb", "lib/wunderbar.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/installation.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/version.rb", "test/test_builder.rb", "test/test_html_markup.rb", "test/test_logger.rb", "tools/web2script.rb", "wunderbar.gemspec", "Manifest"]
12
+ s.files = ["wunderbar.gemspec", "README.md", "COPYING", "lib/wunderbar.rb", "lib/wunderbar", "lib/wunderbar/installation.rb", "lib/wunderbar/html-methods.rb", "lib/wunderbar/job-control.rb", "lib/wunderbar/logger.rb", "lib/wunderbar/builder.rb", "lib/wunderbar/environment.rb", "lib/wunderbar/cgi-methods.rb", "lib/wunderbar/cssproxy.rb", "lib/wunderbar/version.rb"]
14
13
  s.homepage = "http://github.com/rubys/wunderbar"
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Wunderbar", "--main", "README.md"]
16
14
  s.require_paths = ["lib"]
17
- s.rubyforge_project = "wunderbar"
18
15
  s.rubygems_version = "1.8.15"
19
16
  s.summary = "HTML Generator and CGI application support"
20
- s.test_files = ["test/test_logger.rb", "test/test_html_markup.rb", "test/test_builder.rb"]
21
17
 
22
18
  if s.respond_to? :specification_version then
23
19
  s.specification_version = 3
24
20
 
25
21
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<builder>, [">= 0"])
22
+ s.add_runtime_dependency(%q<builder>, [">= 3.0"])
27
23
  s.add_runtime_dependency(%q<json>, [">= 0"])
28
24
  else
29
- s.add_dependency(%q<builder>, [">= 0"])
25
+ s.add_dependency(%q<builder>, [">= 3.0"])
30
26
  s.add_dependency(%q<json>, [">= 0"])
31
27
  end
32
28
  else
33
- s.add_dependency(%q<builder>, [">= 0"])
29
+ s.add_dependency(%q<builder>, [">= 3.0"])
34
30
  s.add_dependency(%q<json>, [">= 0"])
35
31
  end
36
32
  end
metadata CHANGED
@@ -1,111 +1,105 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: wunderbar
3
- version: !ruby/object:Gem::Version
4
- version: 0.8.13
3
+ version: !ruby/object:Gem::Version
4
+ hash: 35
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 14
10
+ version: 0.8.14
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Sam Ruby
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-03-24 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-03-30 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: builder
16
- requirement: &13219860 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
17
24
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 7
29
+ segments:
30
+ - 3
31
+ - 0
32
+ version: "3.0"
22
33
  type: :runtime
23
- prerelease: false
24
- version_requirements: *13219860
25
- - !ruby/object:Gem::Dependency
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
26
36
  name: json
27
- requirement: &13219000 !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
28
39
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
33
47
  type: :runtime
34
- prerelease: false
35
- version_requirements: *13219000
36
- description: ! " Provides a number of globals, helper methods, and monkey patches
37
- which\n simplify the generation of HTML and the development of CGI scripts.\n"
48
+ version_requirements: *id002
49
+ description: " Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode\n (utf-8), consistently indented, readable applications. This includes\n output that conforms to the Polyglot specification and the emerging\n results from the XML Error Recovery Community Group.\n"
38
50
  email: rubys@intertwingly.net
39
51
  executables: []
52
+
40
53
  extensions: []
41
- extra_rdoc_files:
42
- - COPYING
54
+
55
+ extra_rdoc_files: []
56
+
57
+ files:
58
+ - wunderbar.gemspec
43
59
  - README.md
60
+ - COPYING
44
61
  - lib/wunderbar.rb
45
- - lib/wunderbar/builder.rb
46
- - lib/wunderbar/cgi-methods.rb
47
- - lib/wunderbar/cssproxy.rb
48
- - lib/wunderbar/environment.rb
49
- - lib/wunderbar/html-methods.rb
50
62
  - lib/wunderbar/installation.rb
63
+ - lib/wunderbar/html-methods.rb
51
64
  - lib/wunderbar/job-control.rb
52
65
  - lib/wunderbar/logger.rb
53
- - lib/wunderbar/version.rb
54
- files:
55
- - COPYING
56
- - README.md
57
- - Rakefile
58
- - demo/envdump.rb
59
- - demo/helloworld.rb
60
- - demo/wiki.html
61
- - demo/wiki.rb
62
- - lib/wunderbar.rb
63
66
  - lib/wunderbar/builder.rb
67
+ - lib/wunderbar/environment.rb
64
68
  - lib/wunderbar/cgi-methods.rb
65
69
  - lib/wunderbar/cssproxy.rb
66
- - lib/wunderbar/environment.rb
67
- - lib/wunderbar/html-methods.rb
68
- - lib/wunderbar/installation.rb
69
- - lib/wunderbar/job-control.rb
70
- - lib/wunderbar/logger.rb
71
70
  - lib/wunderbar/version.rb
72
- - test/test_builder.rb
73
- - test/test_html_markup.rb
74
- - test/test_logger.rb
75
- - tools/web2script.rb
76
- - wunderbar.gemspec
77
- - Manifest
78
71
  homepage: http://github.com/rubys/wunderbar
79
72
  licenses: []
73
+
80
74
  post_install_message:
81
- rdoc_options:
82
- - --line-numbers
83
- - --inline-source
84
- - --title
85
- - Wunderbar
86
- - --main
87
- - README.md
88
- require_paths:
75
+ rdoc_options: []
76
+
77
+ require_paths:
89
78
  - lib
90
- required_ruby_version: !ruby/object:Gem::Requirement
79
+ required_ruby_version: !ruby/object:Gem::Requirement
91
80
  none: false
92
- requirements:
93
- - - ! '>='
94
- - !ruby/object:Gem::Version
95
- version: '0'
96
- required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
89
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '1.2'
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ hash: 3
94
+ segments:
95
+ - 0
96
+ version: "0"
102
97
  requirements: []
103
- rubyforge_project: wunderbar
98
+
99
+ rubyforge_project:
104
100
  rubygems_version: 1.8.15
105
101
  signing_key:
106
102
  specification_version: 3
107
103
  summary: HTML Generator and CGI application support
108
- test_files:
109
- - test/test_logger.rb
110
- - test/test_html_markup.rb
111
- - test/test_builder.rb
104
+ test_files: []
105
+
data/Manifest DELETED
@@ -1,23 +0,0 @@
1
- COPYING
2
- README.md
3
- Rakefile
4
- demo/envdump.rb
5
- demo/helloworld.rb
6
- demo/wiki.html
7
- demo/wiki.rb
8
- lib/wunderbar.rb
9
- lib/wunderbar/builder.rb
10
- lib/wunderbar/cgi-methods.rb
11
- lib/wunderbar/cssproxy.rb
12
- lib/wunderbar/environment.rb
13
- lib/wunderbar/html-methods.rb
14
- lib/wunderbar/installation.rb
15
- lib/wunderbar/job-control.rb
16
- lib/wunderbar/logger.rb
17
- lib/wunderbar/version.rb
18
- test/test_builder.rb
19
- test/test_html_markup.rb
20
- test/test_logger.rb
21
- tools/web2script.rb
22
- wunderbar.gemspec
23
- Manifest
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'echoe'
4
-
5
- require File.expand_path(File.dirname(__FILE__) + "/lib/wunderbar/version")
6
-
7
- mkdir_p 'pkg' unless File.exist? 'pkg'
8
-
9
- Echoe.new('wunderbar', Wunderbar::VERSION::STRING) do |p|
10
- p.summary = "HTML Generator and CGI application support"
11
- p.description = <<-EOF
12
- Provides a number of globals, helper methods, and monkey patches which
13
- simplify the generation of HTML and the development of CGI scripts.
14
- EOF
15
- p.url = "http://github.com/rubys/wunderbar"
16
- p.author = "Sam Ruby"
17
- p.email = "rubys@intertwingly.net"
18
- p.dependencies = %w(
19
- builder
20
- json
21
- )
22
- end
23
-
24
- Rake::TestTask.new do |t|
25
- t.libs << 'test'
26
- t.test_files = FileList['test/test*.rb']
27
- end
data/demo/envdump.rb DELETED
@@ -1,36 +0,0 @@
1
- require 'wunderbar'
2
-
3
- W_.html do
4
- _head_ do
5
- _title 'CGI Environment'
6
- _style %{
7
- table {border-spacing: 0}
8
- th, td {padding: 0.2em 0.5em}
9
- thead th {border-bottom: solid 1px #000}
10
- tbody tr:nth-child(5n) td {border-bottom: solid 1px #888}
11
- th:last-child, td:last-child {border-left: solid 1px #000}
12
- tr:hover {background-color: #FF8}
13
- }
14
- end
15
-
16
- _body? do
17
- _h1 'Environment Variables'
18
- _table do
19
- _thead_ do
20
- _tr do
21
- _th 'Name'
22
- _th 'Value'
23
- end
24
- end
25
-
26
- _tbody do
27
- ENV.sort.each do |name, value|
28
- _tr_ do
29
- _td name
30
- _td value
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
data/demo/helloworld.rb DELETED
@@ -1,22 +0,0 @@
1
- require 'wunderbar'
2
-
3
- W_.html do
4
- _head_ do
5
- _title 'Greeter'
6
- _style %{
7
- input {display: block; margin: 2em}
8
- }
9
- end
10
-
11
- _body? do
12
- if @name
13
- _p "Hello #{@name}!"
14
- else
15
- _form method: 'post' do
16
- _p 'Please enter your name:'
17
- _input name: 'name'
18
- _input type: 'submit'
19
- end
20
- end
21
- end
22
- end