haml2phlex 0.1.12 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/haml2phlex/version.rb +1 -1
- data/lib/haml2phlex.rb +24 -15
- data/pkg/haml2phlex-0.1.12.gem +0 -0
- data/pkg/haml2phlex-0.1.13.gem +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1117318b9c7c9e61fbdc8bf59af2f2bdb33f6fc6447c49e44e0abb54292571
|
4
|
+
data.tar.gz: f8981ee3e9fbb12df97fe30ad746ce8bc0f86bce88d50ccced5c8d768647fcf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f532eb8ff68ac3dbfa099e922bf2bddb9fe758ac5224aea8ea018ead70d210ee3ee629c666cf71e38fbc1846c35fc7a9ca6fcddccce40646481d53e6d2b001f9
|
7
|
+
data.tar.gz: 0d745a0e2ca1d6fdc35a8d478887530fa414942c7e6d1e4ed7df9017d9c7eedaaf0715048427097f1ebf5e4597db88f13f2c243d8dbf95ed84b923c098a04edf
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -36,7 +36,7 @@ x = Haml2phlex::Haml2flex.new('user_customizes/_show.html.haml', spacer: "\t", b
|
|
36
36
|
puts x.out
|
37
37
|
```
|
38
38
|
|
39
|
-
or to output to a corresponding file (in this case app/views/user_customizes/show.rb)
|
39
|
+
or to output to a corresponding file with class definitions etc. (in this case app/views/user_customizes/show.rb)
|
40
40
|
```ruby
|
41
41
|
x = Haml2phlex::Haml2flex.new('user_customizes/_show.html.haml', spacer: "\t", base_root: "app/views/")
|
42
42
|
puts x.to_file
|
data/lib/haml2phlex/version.rb
CHANGED
data/lib/haml2phlex.rb
CHANGED
@@ -238,26 +238,35 @@ class Haml2phlex
|
|
238
238
|
rb_fname = self.base_root + rb_fname + ".rb"
|
239
239
|
|
240
240
|
f = File.open(rb_fname, 'w+')
|
241
|
+
|
242
|
+
super_the_template = ((defined?(Views::ApplicationView)) and (Views::ApplicationView.instance_methods.include?(:template)))
|
243
|
+
|
241
244
|
f.write %Q{
|
242
245
|
module Views
|
243
|
-
|
244
|
-
|
246
|
+
class #{rb_class} < Phlex::HTML
|
247
|
+
include ApplicationView
|
245
248
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
249
|
+
def initialize(**args)
|
250
|
+
#sets whatever you put in as a instance variable should prob delete and make optional arguments.
|
251
|
+
#it would be useful if we could automatically make every variable in the phlex output into class
|
252
|
+
#variables, then you wouldn't have to change nearly anything on conversion.
|
253
|
+
for k in args.keys
|
254
|
+
self.instance_variable_set("@\#{k}", args[k])
|
255
|
+
end
|
256
|
+
end
|
252
257
|
|
253
|
-
|
254
|
-
|
255
|
-
|
258
|
+
def template(&)
|
259
|
+
#{'super do' if super_the_template}
|
260
|
+
#{"\t" if super_the_template}base_page(&)
|
261
|
+
#{'end' if super_the_template}
|
262
|
+
end
|
256
263
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
264
|
+
def base_page(&)
|
265
|
+
#_______________________________________START
|
266
|
+
#{out}
|
267
|
+
#_______________________________________END
|
268
|
+
end
|
269
|
+
end
|
261
270
|
end}
|
262
271
|
f.close
|
263
272
|
puts 'written to ' + rb_fname
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: haml2phlex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Clancy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: this is a 'good enough' converter from haml view rendering to phlex view
|
14
14
|
.
|
@@ -30,6 +30,8 @@ files:
|
|
30
30
|
- lib/haml2phlex/version.rb
|
31
31
|
- pkg/haml2phlex-0.1.10.gem
|
32
32
|
- pkg/haml2phlex-0.1.11.gem
|
33
|
+
- pkg/haml2phlex-0.1.12.gem
|
34
|
+
- pkg/haml2phlex-0.1.13.gem
|
33
35
|
- pkg/haml2phlex-0.1.4.gem
|
34
36
|
- pkg/haml2phlex-0.1.5.gem
|
35
37
|
- pkg/haml2phlex-0.1.6.gem
|