theo-rails 0.0.1 → 0.0.3

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: 72760a93ae4af92ea6165a28783256803999a0ae3aa39dde174b5bd747a2b3cf
4
- data.tar.gz: 05b64b345ea54a808b2f80c7a8ec64ec5dc0554102fa913e222cdea6801edc3d
3
+ metadata.gz: b7a9d639ccfa8196c2577d2de2b8d1aa84e3be57430733e45abffb1f43da2604
4
+ data.tar.gz: 299e6549a9d66151a1555c6bd1841ed07444dcd2b1f63815cf08b461165f9e05
5
5
  SHA512:
6
- metadata.gz: 5c702258890cdc47fb26baa89e95b7e2d7290cf077dcc7b60be46bc97313954ee5417dca603e16388849c7fa5c404cc20557364c46fc748df64a7ca8265105d1
7
- data.tar.gz: eab46ae893713a4e8c7f9c9381e1ab40561ee8794a5db21cbe9a09e82632ba38b9f8465fe5c71c4705c2014c1169fda234f64f023776ab58613eb62dc704f484
6
+ metadata.gz: bad8fd62ca1a730c6ad0b6861376221921d070016a9655fd18ff5cde6cc18014df1bf786cd92f7bffca6f2e3a6a0a75c4fe1ab8bc2fed95669289ebf56eba2a4
7
+ data.tar.gz: 571a0df90f946f5e2cef26874174510f079c80c335572112e4e68c0aa4c95e7bee9f7fb954b20ab95d2bafa98f69c65c1d3bf2908552e0588ea226841afc1fb6
@@ -1,3 +1,4 @@
1
- <%= form_with url: local_assigns[:url] do |form| %>
1
+ <%# locals: (url: nil, **attributes) -%>
2
+ <%= form_with url:, html: attributes do |form| %>
2
3
  <% yield form %>
3
4
  <% end %>
@@ -2,7 +2,7 @@ module Theo
2
2
  module Rails
3
3
  TX = '\s*([a-z0-9-]+-partial)\s*(.*?)(?<!%)'.freeze
4
4
  RX = %r{(?:<#{TX}>(.*?)</\1>)|(?:<#{TX}/>)}im
5
- LX = /\s*([^=]+?)\s*(%)?=\s*"([^"]*)"/
5
+ LX = /\s*([^=%\s]+)\s*(?:(%)?=\s*"([^"]*)")?/
6
6
  RXA = /^<%=([^%]*)%>$/
7
7
 
8
8
  class Theo
@@ -15,7 +15,7 @@ module Theo
15
15
 
16
16
  attributes = attributes
17
17
  .scan(LX)
18
- .map { |name, literal, value| [name.to_sym, attribute(value, literal:)] }
18
+ .map { |name, literal, value| [name.to_sym, attribute(value || '', literal:)] }
19
19
  .to_h
20
20
 
21
21
  if attributes[:path]
@@ -44,7 +44,7 @@ module Theo
44
44
  end
45
45
 
46
46
  if content
47
- output = "<%= render '#{partial}', {#{attributes.map {|k,v| "#{k}: #{v}"}.join(', ')}} do #{ arg || '' } %>#{process(content)}<% end %>"
47
+ output = "<%= render '#{partial}', {#{attributes.map {|k,v| "'#{k}': #{v}"}.join(', ')}} do #{ arg || '' } %>#{process(content)}<% end %>"
48
48
  else
49
49
  output = "<%= render partial: '#{partial}'#{collection}, locals: {#{attributes.map {|k,v| "#{k}: #{v}"}.join(', ')}} %>"
50
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: theo-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarek Lipski