markaby 0.9.2 → 0.9.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dc12cb3b6384a562bf884e5fb8478ced1bfdb1334cbf861340b7bcad1eb6ea4
4
- data.tar.gz: f313b51ab7011ea110dd3a1f5bcfd4b702b66edfb3401f9bcca4e35ee5906fc8
3
+ metadata.gz: a6bf58bcd04bd76cee97bdf153192eae567d6607aeb7461b0cd006bd618e0b0d
4
+ data.tar.gz: adfa965e6b1b10ab06f64e09077e4cecd4cd42b0eb11dfb16c976941bab55635
5
5
  SHA512:
6
- metadata.gz: 358e8500a7b6c8a418308f02d408dff670a1a201a0bb4af60445af98aa21e1c093ce835bea52e13403b9a9349f5f9672352673f452b185d8137e98e3edf72557
7
- data.tar.gz: 3d377ee8f1d7982c7a4bfaa08b7f6f0f0839b6b37cccc515035e3b729946727a1f28db4dea130ab8338c7dafa6b92aa2774c3278be67baa228820187d7e3a231
6
+ metadata.gz: c919ddcba6bfb3ce0be0f24e5d63f23f418b552261fde81a9e9ab286c2dcabb3025fbbfe7e0cb3b0075931f67fa0360acbdce0d22320ed6d4567799a9017956a
7
+ data.tar.gz: a5cef34204f13670992f9ccbe82b3ab42e9743d59328f5a6292b5a04c643d30ce910cce09ac1c1e08635d8a7aab4e21344a28ac97f2e8c677c0d159b922864c6
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,15 @@
1
1
  = HEAD
2
2
 
3
+ = 0.9.4
4
+
5
+ * Earlopain - Fix compatibility with latest builder release #49
6
+ - https://github.com/markaby/markaby/pull/49
7
+ * Aesthetikx Add Missing HTML5 Tags #48 - https://github.com/markaby/markaby/pull/48
8
+ * MrPowers - Small Refactorings - https://github.com/markaby/markaby/pull/50, https://github.com/markaby/markaby/pull/34
9
+
10
+ = 0.9.3
11
+ = 0.9.2
12
+
3
13
  = 0.9.1
4
14
 
5
15
  * update release tasks [tech task]
data/Gemfile.lock CHANGED
@@ -2,7 +2,7 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  ast (2.4.2)
5
- builder (3.2.4)
5
+ builder (3.3.0)
6
6
  byebug (11.1.3)
7
7
  diff-lcs (1.5.0)
8
8
  json (2.6.3)
@@ -15,7 +15,8 @@ GEM
15
15
  rainbow (3.1.1)
16
16
  rake (13.0.6)
17
17
  regexp_parser (2.8.0)
18
- rexml (3.2.5)
18
+ rexml (3.2.8)
19
+ strscan (>= 3.0.9)
19
20
  rspec (3.12.0)
20
21
  rspec-core (~> 3.12.0)
21
22
  rspec-expectations (~> 3.12.0)
@@ -58,6 +59,7 @@ GEM
58
59
  rubocop-performance (~> 1.16.0)
59
60
  standardrb (1.0.1)
60
61
  standard
62
+ strscan (3.1.0)
61
63
  test-unit (3.5.8)
62
64
  power_assert
63
65
  unicode-display_width (2.4.2)
@@ -97,20 +97,9 @@ module Markaby
97
97
  @_helper = helper
98
98
  end
99
99
 
100
- def metaclass(&block)
101
- metaclass = class << self; self; end
102
- metaclass.class_eval(&block)
103
- end
104
-
105
- private :metaclass
106
-
107
100
  def locals=(locals)
108
101
  locals.each do |key, value|
109
- metaclass do
110
- define_method key do
111
- value
112
- end
113
- end
102
+ define_singleton_method(key) { value }
114
103
  end
115
104
  end
116
105
 
@@ -245,7 +234,7 @@ module Markaby
245
234
  # is never used, though, and the stream stays intact.
246
235
  #
247
236
  # For a more practical explanation, check out the README.
248
- class Fragment < ::Builder::BlankSlate
237
+ class Fragment < BasicObject
249
238
  def initialize(*args)
250
239
  @stream, @start, @length = args
251
240
  @transformed_stream = false
@@ -255,6 +244,12 @@ module Markaby
255
244
  undef_method method if method_defined?(method)
256
245
  end
257
246
 
247
+ def to_s
248
+ transform_stream unless transformed_stream?
249
+ @str.to_s
250
+ end
251
+ alias_method :to_str, :to_s
252
+
258
253
  private
259
254
 
260
255
  def method_missing(...)
@@ -271,7 +266,7 @@ module Markaby
271
266
 
272
267
  # We can't do @stream.slice!(@start, @length),
273
268
  # as it would invalidate the @starts and @lengths of other Fragment instances.
274
- @str = @stream[@start, @length].to_s
269
+ @str = @stream[@start, @length].join.to_s
275
270
  @stream[@start, @length] = [nil] * @length
276
271
  end
277
272
 
data/lib/markaby/html5.rb CHANGED
@@ -44,8 +44,10 @@ module Markaby
44
44
  bdi: Attrs,
45
45
  canvas: Attrs,
46
46
  command: Attrs,
47
+ data: Attrs,
47
48
  datalist: Attrs,
48
49
  details: Attrs,
50
+ dialog: Attrs,
49
51
  embed: Attrs,
50
52
  figure: Attrs,
51
53
  figcaption: Attrs,
@@ -53,17 +55,23 @@ module Markaby
53
55
  header: Attrs,
54
56
  hgroup: Attrs,
55
57
  keygen: Attrs,
58
+ main: Attrs,
56
59
  mark: Attrs,
57
60
  menu: Attrs,
61
+ menuitem: Attrs,
58
62
  meter: Attrs,
59
63
  nav: Attrs,
60
64
  output: Attrs,
65
+ picture: Attrs,
61
66
  progress: Attrs,
62
67
  rp: Attrs,
63
68
  rt: Attrs,
64
69
  ruby: Attrs,
65
70
  section: Attrs,
66
71
  source: Attrs,
72
+ summary: Attrs,
73
+ svg: Attrs,
74
+ template: Attrs,
67
75
  time: Attrs,
68
76
  track: Attrs,
69
77
  video: Attrs,
@@ -77,6 +85,8 @@ module Markaby
77
85
  base: [:target],
78
86
  button: [:autofocus, :form, :formaction, :formenctype, :formmethod,
79
87
  :formnovalidate, :formtarget],
88
+ data: [:value],
89
+ dialog: [:open],
80
90
  fieldset: [:form, :disabled, :name],
81
91
  form: [:novalidate],
82
92
  label: [:form],
@@ -90,6 +100,8 @@ module Markaby
90
100
  link: [:sizes],
91
101
  meta: [:charset],
92
102
  menu: [:type, :label],
103
+ menuitem: [:checked, :command, :default, :disabled, :icon, :label,
104
+ :radiogroup, :type],
93
105
  object: [:form, :typemustmatch],
94
106
  ol: [:reversed],
95
107
  output: [:form],
@@ -1,7 +1,7 @@
1
1
  module Markaby
2
2
  MAJOR = 0
3
3
  MINOR = 9
4
- TINY = 2
4
+ TINY = 4
5
5
 
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{TINY}"
7
7
  end
@@ -47,6 +47,16 @@ describe Markaby do
47
47
  builder.three.should == "four"
48
48
  end
49
49
 
50
+ it "should create locals as singleton methods" do
51
+ builder = Markaby::Builder.new
52
+ builder.locals = { :one => "two", :three => "four" }
53
+ builder.singleton_methods.should == [:one, :three]
54
+ end
55
+
56
+ it "should work with builder bang methods" do
57
+ mab { instruct! }.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
58
+ end
59
+
50
60
  it "should be able to produce the correct html from a fragment" do
51
61
  str = ""
52
62
  str += "<div>"
@@ -122,6 +132,45 @@ describe Markaby do
122
132
  builder.three.should == "four"
123
133
  end
124
134
 
135
+ it "should be able to concat with to_s" do
136
+ str = ""
137
+ str += "<div class=\"title\">"
138
+ str += "Rock Bottom <span>by Robert Wyatt</span>"
139
+ str += "</div>"
140
+
141
+ generated = mab {
142
+ div.title { "Rock Bottom " + span("by Robert Wyatt").to_s }
143
+ }
144
+
145
+ generated.should == str
146
+ end
147
+
148
+ it "should be able to contact without to_s, but with +" do
149
+ str = ""
150
+ str += "<div class=\"title\">"
151
+ str += "Rock Bottom <span>by Robert Wyatt</span>"
152
+ str += "</div>"
153
+
154
+ generated = mab {
155
+ div.title { "Rock Bottom " + span("by Robert Wyatt") }
156
+ }
157
+
158
+ generated.should == str
159
+ end
160
+
161
+ it "should be able to contact by interpolation" do
162
+ str = ""
163
+ str += "<div class=\"title\">"
164
+ str += "Rock Bottom <span>by Robert Wyatt</span>"
165
+ str += "</div>"
166
+
167
+ generated = mab {
168
+ div.title { "Rock Bottom #{span("by Robert Wyatt")}" }
169
+ }
170
+
171
+ generated.should == str
172
+ end
173
+
125
174
  it "should be able to produce the correct html from a fragment" do
126
175
  str = ""
127
176
  str += "<div>"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markaby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Taylor
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-12-08 00:00:00.000000000 Z
13
+ date: 2024-06-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: builder
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.4.22
115
+ rubygems_version: 3.5.9
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: A pure ruby based, html markup language