phlex 2.0.0.beta1 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -11
- data/lib/phlex/context.rb +3 -2
- data/lib/phlex/csv.rb +4 -11
- data/lib/phlex/error.rb +1 -0
- data/lib/phlex/fifo.rb +1 -0
- data/lib/phlex/helpers.rb +3 -1
- data/lib/phlex/html/standard_elements.rb +1033 -722
- data/lib/phlex/html/void_elements.rb +94 -56
- data/lib/phlex/html.rb +1 -7
- data/lib/phlex/kit.rb +23 -11
- data/lib/phlex/{elements.rb → sgml/elements.rb} +18 -44
- data/lib/phlex/sgml.rb +221 -263
- data/lib/phlex/svg/standard_elements.rb +480 -449
- data/lib/phlex/svg.rb +0 -3
- data/lib/phlex/{black_hole.rb → vanish.rb} +1 -1
- data/lib/phlex/version.rb +1 -1
- data/lib/phlex.rb +2 -5
- metadata +5 -7
- data/lib/phlex/deferred_render.rb +0 -29
- data/lib/phlex/element_clobbering_guard.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a6338c8f3742ef6e6bc493e259ba3681d9a651e79c067e030e4aaba8b889396
|
4
|
+
data.tar.gz: b0f21d0994c3ec89bb16f4037997e1327e068e7dce4b9b9bad2355df95f40de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff0f545fe87d54db6170264df314eaf9190a1ac5718fc66e905b295c66771b61bcf76a302c94df85d1242ba804790707bb387867e25685c112e402516fb2a58e
|
7
|
+
data.tar.gz: 9b4b4615a772814e0b2bb9774802832bd007dd61a08ef5145e750fd43a5984327664050462e6f2cb82f57c9dc46d0d3858d29aa09404c62c9aa1d381c9b32b94
|
data/README.md
CHANGED
@@ -2,21 +2,18 @@
|
|
2
2
|
|
3
3
|
Phlex lets you compose web views in pure Ruby.
|
4
4
|
|
5
|
-
- [
|
6
|
-
- [
|
5
|
+
- [v1 Stable Docs](https://www.phlex.fun)
|
6
|
+
- [v2 Beta Docs](https://beta.phlex.fun)
|
7
7
|
|
8
|
-
## Maintenance
|
8
|
+
## Versioning and Maintenance
|
9
9
|
|
10
|
-
|
10
|
+
Phlex does not follow semantic versioning (SemVer). Instead, we follow [BreakVer](https://www.taoensso.com/break-versioning).
|
11
11
|
|
12
|
-
|
13
|
-
- We may choose to fix bugs by releasing a new minor version rather than patching the existing minor version
|
14
|
-
- Major versions will stop receiving bug fixes one year after the next major version is released
|
12
|
+
When a security issue is brought to our attention, we aim to release patches as soon as possible. We aim to patch with a new `non-breaking` version:
|
15
13
|
|
16
|
-
|
17
|
-
|
18
|
-
-
|
19
|
-
- Additionally, the latest minor version of the latest major version will receive security patches, even if that version is over a year old.
|
14
|
+
- every `minor` version that was released in the last year;
|
15
|
+
- the latest `minor` version of the latest two `major` versions, even if over a year old; and
|
16
|
+
- the `main` branch in GitHub.
|
20
17
|
|
21
18
|
## Prior Art 🎨
|
22
19
|
|
data/lib/phlex/context.rb
CHANGED
@@ -2,18 +2,19 @@
|
|
2
2
|
|
3
3
|
# @api private
|
4
4
|
class Phlex::Context
|
5
|
-
def initialize(user_context
|
5
|
+
def initialize(user_context: {}, view_context: nil)
|
6
6
|
@buffer = +""
|
7
7
|
@capturing = false
|
8
8
|
@user_context = user_context
|
9
9
|
@fragments = nil
|
10
10
|
@in_target_fragment = false
|
11
11
|
@halt_signal = nil
|
12
|
+
@view_context = view_context
|
12
13
|
end
|
13
14
|
|
14
15
|
attr_accessor :buffer, :capturing, :user_context, :in_target_fragment
|
15
16
|
|
16
|
-
attr_reader :fragments
|
17
|
+
attr_reader :fragments, :view_context
|
17
18
|
|
18
19
|
def target_fragments(fragments)
|
19
20
|
@fragments = fragments.to_h { |it| [it, true] }
|
data/lib/phlex/csv.rb
CHANGED
@@ -9,13 +9,12 @@ class Phlex::CSV
|
|
9
9
|
@_headers = []
|
10
10
|
@_current_row = []
|
11
11
|
@_current_column_index = 0
|
12
|
-
@_view_context = nil
|
13
12
|
@_first = true
|
14
13
|
end
|
15
14
|
|
16
15
|
attr_reader :collection
|
17
16
|
|
18
|
-
def call(buffer = +"",
|
17
|
+
def call(buffer = +"", context: nil)
|
19
18
|
unless escape_csv_injection? == true || escape_csv_injection? == false
|
20
19
|
raise <<~MESSAGE
|
21
20
|
You need to define escape_csv_injection? in #{self.class.name}, returning either `true` or `false`.
|
@@ -40,8 +39,6 @@ class Phlex::CSV
|
|
40
39
|
MESSAGE
|
41
40
|
end
|
42
41
|
|
43
|
-
@_view_context = view_context
|
44
|
-
|
45
42
|
each_item do |record|
|
46
43
|
yielder(record) do |*args, **kwargs|
|
47
44
|
view_template(*args, **kwargs)
|
@@ -73,12 +70,12 @@ class Phlex::CSV
|
|
73
70
|
|
74
71
|
def column(header = nil, value)
|
75
72
|
if @_first
|
76
|
-
@_headers <<
|
73
|
+
@_headers << __escape__(header)
|
77
74
|
elsif header != @_headers[@_current_column_index]
|
78
75
|
raise "Inconsistent header."
|
79
76
|
end
|
80
77
|
|
81
|
-
@_current_row <<
|
78
|
+
@_current_row << __escape__(value)
|
82
79
|
@_current_column_index += 1
|
83
80
|
end
|
84
81
|
|
@@ -105,11 +102,7 @@ class Phlex::CSV
|
|
105
102
|
nil
|
106
103
|
end
|
107
104
|
|
108
|
-
def
|
109
|
-
@_view_context
|
110
|
-
end
|
111
|
-
|
112
|
-
def escape(value)
|
105
|
+
def __escape__(value)
|
113
106
|
value = trim_whitespace? ? value.to_s.strip : value.to_s
|
114
107
|
first_char = value[0]
|
115
108
|
last_char = value[-1]
|
data/lib/phlex/error.rb
CHANGED
data/lib/phlex/fifo.rb
CHANGED
data/lib/phlex/helpers.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# @api private
|
3
4
|
module Phlex::Helpers
|
4
5
|
private
|
5
6
|
|
6
|
-
# @return [Hash]
|
7
7
|
def mix(*args)
|
8
8
|
args.each_with_object({}) do |object, result|
|
9
9
|
result.merge!(object) do |_key, old, new|
|
@@ -26,6 +26,8 @@ module Phlex::Helpers
|
|
26
26
|
[old] + new.to_a
|
27
27
|
in [String, String]
|
28
28
|
"#{old} #{new}"
|
29
|
+
in [_, nil]
|
30
|
+
old
|
29
31
|
else
|
30
32
|
new
|
31
33
|
end
|