wunderbar 1.4.2 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/lib/wunderbar/builder.rb +6 -4
- data/lib/wunderbar/html-methods.rb +4 -11
- data/lib/wunderbar/markdown.rb +0 -1
- data/lib/wunderbar/server.rb +0 -4
- data/lib/wunderbar/vendor/Markdown.Converter.js +1 -1
- data/lib/wunderbar/version.rb +1 -1
- data/wunderbar.gemspec +1 -1
- metadata +4 -5
- data/lib/wunderbar/rails.rb +0 -43
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1753c6f65653020143af9ed4f73f15e11c7443e8fec1d26a3ae645be0f785191
|
4
|
+
data.tar.gz: 3257c0840a2d8d9aaf5f7368623dc8f487e449d6e8d8046632c1a264bb373e18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 364ab25aeab2b20e7b98d98ac0dbf537b68fb11c82046b6206039661b2d0694521d09229cc4c5832aff48eab5fbb8b4fad34cabe65d9c534921b6f015b2c6fab
|
7
|
+
data.tar.gz: '0885f9681bd7955e81de1a2920a77c736b1283c152eab4f20425ec7cebbd75c956da6efd348c388541229822c65644ad20f78f8a6911066fdfcf59616e133840'
|
data/README.md
CHANGED
@@ -226,7 +226,12 @@ convenience methods are defined:
|
|
226
226
|
* `_.submit` -- runs command (or block) as a deamon process
|
227
227
|
* `_.xhtml?` -- output as XHTML?
|
228
228
|
|
229
|
-
|
229
|
+
The `_.system` method takes an optional hash as its last parameter. This can be used to provide settings for the underlying
|
230
|
+
[Process.spawn](https://www.rubydoc.info/stdlib/core/Process.spawn) method.
|
231
|
+
For example: `._system('pwd',{ system_opts: { chdir: dir } , system_env: { 'FOO' => 'BAR' } })`
|
232
|
+
Note that environment variable names must be provided as strings, not symbols.
|
233
|
+
|
234
|
+
Access to all of the builder _defined_ methods (typically these end in an exclamation mark) and all of the Wunderbar module methods can be accessed in this way. Examples:
|
230
235
|
|
231
236
|
* `_.tag! :foo`: insert elements where the name can be dynamic
|
232
237
|
* `_.comment! "text"`: add a comment
|
@@ -366,7 +371,9 @@ Secure by default
|
|
366
371
|
|
367
372
|
Wunderbar will properly escape all HTML and JSON output, eliminating problems
|
368
373
|
of HTML or JavaScript injection. This includes calls to `_` to insert text
|
369
|
-
directly.
|
374
|
+
directly. Unless `nokogiri` was previously required (see [optional
|
375
|
+
dependencies](#optional-dependencies) below), calls to insert markup
|
376
|
+
(`_{...}`) will escape the markup.
|
370
377
|
|
371
378
|
Globals provided
|
372
379
|
---
|
@@ -426,7 +433,6 @@ The following gems are required by extensions of the same name:
|
|
426
433
|
* `coderay` - syntax highlighting
|
427
434
|
* `opal` - ruby to javascript compiler
|
428
435
|
* `rack` - webserver interface
|
429
|
-
* `rails` - web application framework
|
430
436
|
* `sinatra` - DSL for creating web applications
|
431
437
|
|
432
438
|
The following gems, if installed, will produce cleaner and prettier output:
|
data/lib/wunderbar/builder.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'shellwords'
|
2
2
|
require 'open3'
|
3
|
-
require 'thread'
|
4
3
|
|
5
4
|
module Wunderbar
|
6
5
|
@@options = {indent: 2}
|
@@ -74,7 +73,10 @@ module Wunderbar
|
|
74
73
|
|
75
74
|
semaphore = Mutex.new
|
76
75
|
env = {'LC_CTYPE' => 'en_US.UTF-8'}
|
77
|
-
|
76
|
+
sys_env = opts[:system_env] || {}
|
77
|
+
env.merge! sys_env unless sys_env.empty?
|
78
|
+
sys_opts = opts[:system_opts] || {}
|
79
|
+
Open3.popen3(env, *command, sys_opts) do |pin, pout, perr, wait|
|
78
80
|
[
|
79
81
|
Thread.new do
|
80
82
|
until pout.eof?
|
@@ -357,8 +359,8 @@ module Wunderbar
|
|
357
359
|
end
|
358
360
|
|
359
361
|
# remove leading and trailing space
|
360
|
-
if
|
361
|
-
children.shift
|
362
|
+
if not children.empty?
|
363
|
+
children.shift if children.first.text? and children.first.text.strip.empty?
|
362
364
|
end
|
363
365
|
|
364
366
|
if not children.empty?
|
@@ -188,15 +188,6 @@ module Wunderbar
|
|
188
188
|
|
189
189
|
name = name.to_s.gsub('_', '-')
|
190
190
|
|
191
|
-
if flag != '!'
|
192
|
-
if String === args.first
|
193
|
-
if not block and args.first =~ /[>&]/
|
194
|
-
markup = args.shift
|
195
|
-
block = Proc.new {_ {markup}}
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
191
|
if flag == '!'
|
201
192
|
@_x.compact! { tag! name, *args, &block }
|
202
193
|
elsif flag == '?'
|
@@ -362,7 +353,7 @@ module Wunderbar
|
|
362
353
|
def _(text=nil, &block)
|
363
354
|
unless block
|
364
355
|
if text
|
365
|
-
|
356
|
+
@_x.indented_text! text.to_s
|
366
357
|
end
|
367
358
|
return @_x
|
368
359
|
end
|
@@ -370,7 +361,9 @@ module Wunderbar
|
|
370
361
|
children = instance_eval(&block)
|
371
362
|
|
372
363
|
if String === children
|
373
|
-
|
364
|
+
ok = defined? Nokogiri
|
365
|
+
|
366
|
+
if ok and (children.include? '<' or children.include? '&')
|
374
367
|
if defined? Nokogiri::HTML5.fragment
|
375
368
|
doc = Nokogiri::HTML5.fragment(children.to_s)
|
376
369
|
else
|
data/lib/wunderbar/markdown.rb
CHANGED
data/lib/wunderbar/server.rb
CHANGED
@@ -695,7 +695,7 @@ else
|
|
695
695
|
|
696
696
|
function attributeEncode(text) {
|
697
697
|
// unconditionally replace angle brackets here -- what ends up in an attribute (e.g. alt or title)
|
698
|
-
// never makes sense to have verbatim HTML in it
|
698
|
+
// never makes sense to have verbatim HTML in it
|
699
699
|
return text.replace(/>/g, ">").replace(/</g, "<").replace(/"/g, """);
|
700
700
|
}
|
701
701
|
|
data/lib/wunderbar/version.rb
CHANGED
data/wunderbar.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.date = "2019-06-07"
|
14
14
|
s.description = " Wunderbar makes it easy to produce valid HTML5, wellformed XHTML, Unicode\n (utf-8), consistently indented, readable applications.'\n".freeze
|
15
15
|
s.email = "rubys@intertwingly.net".freeze
|
16
|
-
s.files = ["COPYING".freeze, "README.md".freeze, "lib/wunderbar".freeze, "lib/wunderbar.rb".freeze, "lib/wunderbar/asset.rb".freeze, "lib/wunderbar/backtick.rb".freeze, "lib/wunderbar/bootstrap".freeze, "lib/wunderbar/bootstrap.rb".freeze, "lib/wunderbar/bootstrap/theme.rb".freeze, "lib/wunderbar/builder.rb".freeze, "lib/wunderbar/cgi-methods.rb".freeze, "lib/wunderbar/coderay.rb".freeze, "lib/wunderbar/coffeescript.rb".freeze, "lib/wunderbar/cssproxy.rb".freeze, "lib/wunderbar/environment.rb".freeze, "lib/wunderbar/eventsource.rb".freeze, "lib/wunderbar/html-methods.rb".freeze, "lib/wunderbar/installation.rb".freeze, "lib/wunderbar/job-control.rb".freeze, "lib/wunderbar/jquery".freeze, "lib/wunderbar/jquery.rb".freeze, "lib/wunderbar/jquery/filter.rb".freeze, "lib/wunderbar/jquery/stupidtable.rb".freeze, "lib/wunderbar/listen.rb".freeze, "lib/wunderbar/logger.rb".freeze, "lib/wunderbar/markdown.rb".freeze, "lib/wunderbar/marked.rb".freeze, "lib/wunderbar/node.rb".freeze, "lib/wunderbar/pagedown.rb".freeze, "lib/wunderbar/polymer.rb".freeze, "lib/wunderbar/rack.rb".freeze, "lib/wunderbar/
|
16
|
+
s.files = ["COPYING".freeze, "README.md".freeze, "lib/wunderbar".freeze, "lib/wunderbar.rb".freeze, "lib/wunderbar/asset.rb".freeze, "lib/wunderbar/backtick.rb".freeze, "lib/wunderbar/bootstrap".freeze, "lib/wunderbar/bootstrap.rb".freeze, "lib/wunderbar/bootstrap/theme.rb".freeze, "lib/wunderbar/builder.rb".freeze, "lib/wunderbar/cgi-methods.rb".freeze, "lib/wunderbar/coderay.rb".freeze, "lib/wunderbar/coffeescript.rb".freeze, "lib/wunderbar/cssproxy.rb".freeze, "lib/wunderbar/environment.rb".freeze, "lib/wunderbar/eventsource.rb".freeze, "lib/wunderbar/html-methods.rb".freeze, "lib/wunderbar/installation.rb".freeze, "lib/wunderbar/job-control.rb".freeze, "lib/wunderbar/jquery".freeze, "lib/wunderbar/jquery.rb".freeze, "lib/wunderbar/jquery/filter.rb".freeze, "lib/wunderbar/jquery/stupidtable.rb".freeze, "lib/wunderbar/listen.rb".freeze, "lib/wunderbar/logger.rb".freeze, "lib/wunderbar/markdown.rb".freeze, "lib/wunderbar/marked.rb".freeze, "lib/wunderbar/node.rb".freeze, "lib/wunderbar/pagedown.rb".freeze, "lib/wunderbar/polymer.rb".freeze, "lib/wunderbar/rack.rb".freeze, "lib/wunderbar/react.rb".freeze, "lib/wunderbar/render.rb".freeze, "lib/wunderbar/script.rb".freeze, "lib/wunderbar/server.rb".freeze, "lib/wunderbar/sinatra.rb".freeze, "lib/wunderbar/underscore.rb".freeze, "lib/wunderbar/vendor".freeze, "lib/wunderbar/vendor/Markdown.Converter.js".freeze, "lib/wunderbar/vendor/bootstrap-theme.min.css".freeze, "lib/wunderbar/vendor/bootstrap.min.css".freeze, "lib/wunderbar/vendor/bootstrap.min.js".freeze, "lib/wunderbar/vendor/eventsource.min.js".freeze, "lib/wunderbar/vendor/jquery-3.2.1.min.js".freeze, "lib/wunderbar/vendor/marked.min.js".freeze, "lib/wunderbar/vendor/polymer-v0.0.20131003.min.js".freeze, "lib/wunderbar/vendor/react-dom-server.min.js".freeze, "lib/wunderbar/vendor/react-dom.min.js".freeze, "lib/wunderbar/vendor/react-with-addons.min.js".freeze, "lib/wunderbar/vendor/stupidtable.min.js".freeze, "lib/wunderbar/vendor/underscore-min.js".freeze, "lib/wunderbar/vendor/vue-server.min.js".freeze, "lib/wunderbar/vendor/vue.min.js".freeze, "lib/wunderbar/version.rb".freeze, "lib/wunderbar/vue.rb".freeze, "lib/wunderbar/websocket.rb".freeze, "wunderbar.gemspec".freeze]
|
17
17
|
s.homepage = "http://github.com/rubys/wunderbar".freeze
|
18
18
|
s.licenses = ["MIT".freeze]
|
19
19
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.3".freeze)
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wunderbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2019-06-07 00:00:00.000000000 Z
|
@@ -60,7 +60,6 @@ files:
|
|
60
60
|
- lib/wunderbar/pagedown.rb
|
61
61
|
- lib/wunderbar/polymer.rb
|
62
62
|
- lib/wunderbar/rack.rb
|
63
|
-
- lib/wunderbar/rails.rb
|
64
63
|
- lib/wunderbar/react.rb
|
65
64
|
- lib/wunderbar/render.rb
|
66
65
|
- lib/wunderbar/script.rb
|
@@ -90,7 +89,7 @@ homepage: http://github.com/rubys/wunderbar
|
|
90
89
|
licenses:
|
91
90
|
- MIT
|
92
91
|
metadata: {}
|
93
|
-
post_install_message:
|
92
|
+
post_install_message:
|
94
93
|
rdoc_options: []
|
95
94
|
require_paths:
|
96
95
|
- lib
|
@@ -106,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
105
|
version: '0'
|
107
106
|
requirements: []
|
108
107
|
rubygems_version: 3.1.2
|
109
|
-
signing_key:
|
108
|
+
signing_key:
|
110
109
|
specification_version: 4
|
111
110
|
summary: HTML Generator and CGI application support
|
112
111
|
test_files: []
|
data/lib/wunderbar/rails.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext'
|
2
|
-
require 'action_view'
|
3
|
-
|
4
|
-
module Wunderbar
|
5
|
-
module Rails
|
6
|
-
class HtmlHandler
|
7
|
-
cattr_accessor :default_format
|
8
|
-
self.default_format = Mime[:html]
|
9
|
-
|
10
|
-
def self.call(template, source=nil)
|
11
|
-
%{
|
12
|
-
compiled = Proc.new {#{template.source}}
|
13
|
-
x = Wunderbar::HtmlMarkup.new(self);
|
14
|
-
instance_variables.each do |var|
|
15
|
-
x.instance_variable_set var, instance_variable_get(var)
|
16
|
-
end
|
17
|
-
x.instance_eval(&compiled)
|
18
|
-
x._.target!
|
19
|
-
}.strip # take care to preserve line numbers in original source
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class JsonHandler
|
24
|
-
cattr_accessor :default_format
|
25
|
-
self.default_format = Mime[:json]
|
26
|
-
|
27
|
-
def self.call(template, source=nil)
|
28
|
-
%{
|
29
|
-
compiled = Proc.new {#{template.source}}
|
30
|
-
x = Wunderbar::JsonBuilder.new(self);
|
31
|
-
instance_variables.each do |var|
|
32
|
-
x.instance_variable_set var, instance_variable_get(var)
|
33
|
-
end
|
34
|
-
x.instance_eval(&compiled)
|
35
|
-
x.target!
|
36
|
-
}.strip # take care to preserve line numbers in original source
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
ActionView::Template.register_template_handler :_html, HtmlHandler
|
41
|
-
ActionView::Template.register_template_handler :_json, JsonHandler
|
42
|
-
end
|
43
|
-
end
|