html_fn 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bdadb6a7633289833bc0a131f58283215d27d98b8023272849a1d193519f15e
4
- data.tar.gz: 94b142e40198d2ff66b6ffee2132c6c1fb15d58a27a76207153539d7aaa99495
3
+ metadata.gz: 17102465634775d6835f13de6bc0ca28a3d01e689a4debd729a7799cd2c97b87
4
+ data.tar.gz: 505c7de48f41cd4b047299f0975d3a8ca472e36ac0581ac4e380313f813d7f72
5
5
  SHA512:
6
- metadata.gz: ded0251185ec75a0d6a2f682b08e144278e734f4658e889c20cea2892f62ed0d636efcd01866015538ac72b7a6ce49d0944dc36f3a146c4732e9368aeaf3ca07
7
- data.tar.gz: 05d548ec4d535b58c650393645aedfb6d4c8d685a3c073d4a64ca6c3d83f2027998e2362266f105601c442672f0cd4f4bef80d76f5fd927b052e5c76ebe0feca
6
+ metadata.gz: 45f42fcc367a4fa79c396509b68b58ee6c6a910c24dd1cb8ac30306a6f53e874ac3443bda70abecec13de000ce911366349c2ae87e08b4828c38f3b069b79814
7
+ data.tar.gz: e019528fdecb6c4c5d811d3f58e7225ec6d772be366cdda5e2bd9233b5884e4234acd862c3459a71840c1e4326f904f7d629a8aca673e81c6a5dc4865019edc0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- html_fn (0.3.0)
4
+ html_fn (0.3.1)
5
5
  fn_reader
6
6
 
7
7
  GEM
@@ -9,7 +9,7 @@ GEM
9
9
  specs:
10
10
  fn_reader (0.1.0)
11
11
  minitest (5.11.3)
12
- rake (10.5.0)
12
+ rake (13.0.3)
13
13
 
14
14
  PLATFORMS
15
15
  ruby
@@ -18,7 +18,7 @@ DEPENDENCIES
18
18
  bundler (~> 1.17)
19
19
  html_fn!
20
20
  minitest (~> 5.0)
21
- rake (~> 10.0)
21
+ rake (>= 12.3.3)
22
22
 
23
23
  BUNDLED WITH
24
24
  1.17.2
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # HtmlFn
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/html_fn`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ DSL for building HTML without using metaprogram magic.
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
6
5
 
7
6
  ## Installation
8
7
 
@@ -22,7 +21,44 @@ Or install it yourself as:
22
21
 
23
22
  ## Usage
24
23
 
25
- TODO: Write usage instructions here
24
+ ```ruby
25
+ require 'htlm_fp'
26
+
27
+
28
+ include HttpFp
29
+ include HttpFp::Attributes
30
+
31
+
32
+ my_table =
33
+ table.([class_.("table")]).(
34
+ [thead.([]).(
35
+ [tr.([]).(
36
+ [th.([]).([text.("Name")]),
37
+ th.([]).([text.("Age")])]
38
+ )]
39
+
40
+ ),
41
+ tbody.([]).(
42
+ [tr.([]).([
43
+ td.([]).([text.("Martin")]),
44
+ td.([]).([text.("34")]),
45
+ ])]
46
+ )]
47
+ )
48
+ ```
49
+
50
+
51
+ Note that the html will not be formated. If you want to format it, you can use a function as such:
52
+
53
+ ```ruby
54
+ def pretty_print(a)
55
+ require "rexml/document"
56
+ d = REXML::Document.new(a)
57
+ d.write(s = "", 2)
58
+ s
59
+ end
60
+
61
+ ```
26
62
 
27
63
  ## Development
28
64
 
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.require_paths = ["lib"]
38
38
 
39
39
  spec.add_development_dependency "bundler", "~> 1.17"
40
- spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rake", ">= 12.3.3"
41
41
  spec.add_development_dependency "minitest", "~> 5.0"
42
42
  spec.add_dependency "fn_reader"
43
43
  end
@@ -2,11 +2,11 @@
2
2
  module HtmlFn
3
3
  module Attributes
4
4
  fn_reader :merge_attrs, :attrs_to_s, :string_property,
5
- :class_, :style, :name, :content, :href, :rel
5
+ :class_, :style, :name_, :content, :href, :rel
6
6
 
7
7
  # Your code goes here...
8
8
  # module HtmlFnc
9
- @@merge_attrs = -> hash {
9
+ @@merge_attrs = ->hash {
10
10
  hash.inject({}) do |group, (key, values)|
11
11
  group[key] ||= []
12
12
  group[key] += [values]
@@ -14,25 +14,25 @@ module HtmlFn
14
14
  end.map { |key, val| [key, val.join(" ")] }.to_h
15
15
  }
16
16
 
17
- @@attrs_to_s = -> attrs {
17
+ @@attrs_to_s = ->attrs {
18
18
  merged = @@merge_attrs.(attrs)
19
19
  merged.map do |(attr_name, values)|
20
20
  %{#{attr_name}="#{values}"}
21
21
  end.join(" ")
22
22
  }
23
23
 
24
- @@string_property = -> name, string {
24
+ @@string_property = ->name, string {
25
25
  [name, string]
26
26
  }.curry
27
27
 
28
- @@style = -> styles {
28
+ @@style = ->styles {
29
29
  string_property.("style").
30
30
  (styles.map { |(key, val)| %{#{key}: #{val};} }.join(" "))
31
31
  }
32
32
 
33
33
  @@class_ = string_property.(:class)
34
34
  @@id_ = string_property.(:id)
35
- @@name = string_property.(:name)
35
+ @@name_ = string_property.(:name)
36
36
  @@content = string_property.(:content)
37
37
  @@href = string_property.(:href)
38
38
  @@rel = string_property.(:rel)
@@ -1,3 +1,3 @@
1
1
  module HtmlFn
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html_fn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Chabot
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-26 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description:
69
+ description:
70
70
  email:
71
71
  - chabotm@gmail.com
72
72
  executables: []
@@ -93,7 +93,7 @@ licenses:
93
93
  metadata:
94
94
  homepage_uri: https://github.com/martinos/html_fn
95
95
  source_code_uri: https://github.com/martinos/html_fn
96
- post_install_message:
96
+ post_install_message:
97
97
  rdoc_options: []
98
98
  require_paths:
99
99
  - lib
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  requirements: []
111
- rubygems_version: 3.0.1
112
- signing_key:
111
+ rubygems_version: 3.1.4
112
+ signing_key:
113
113
  specification_version: 4
114
114
  summary: Bunch of lamdas for building Html
115
115
  test_files: []