html_fn 0.3.1 → 0.3.2
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +19 -23
- data/lib/html_fn/version.rb +1 -1
- data/lib/html_fn.rb +3 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdefc6f385851e6d11a2d4be052f3b8a0fce71d5617eaaeeb543a6ed5a034d38
|
4
|
+
data.tar.gz: eed2a499f44f734e4f38c0432b8874fd2218a07e2c68868800aefa4fc6f0b513
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef20c9fe79087a710d28c926d916faa8e097ec8aa3184fc9505df7dbcadb56f6d81f77ae3fbd9a1791db7457a7b642052d31d424902ff39d5185bf9f608361b7
|
7
|
+
data.tar.gz: d4adb6673030a814918e7f65ad83175e623ea2ec7b2410183a10cdc6379f98d41199c8e67f01bfeb6d5467c030bf849671c5d94fab7a29400a1056ea949bae5a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# HtmlFn
|
2
2
|
|
3
|
-
DSL for building HTML without using metaprogram magic.
|
4
|
-
|
3
|
+
DSL for building HTML without using metaprogram magic.
|
5
4
|
|
6
5
|
## Installation
|
7
6
|
|
@@ -22,32 +21,29 @@ Or install it yourself as:
|
|
22
21
|
## Usage
|
23
22
|
|
24
23
|
```ruby
|
25
|
-
require '
|
26
|
-
|
24
|
+
require 'html_fn'
|
27
25
|
|
28
|
-
include
|
29
|
-
include
|
26
|
+
include HtmlFn
|
27
|
+
include HtmlFn::Attributes
|
30
28
|
|
31
|
-
|
32
|
-
my_table =
|
29
|
+
my_table =
|
33
30
|
table.([class_.("table")]).(
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
31
|
+
[thead.([]).(
|
32
|
+
[tr.([]).(
|
33
|
+
[th.([]).([text.("Name")]),
|
34
|
+
th.([]).([text.("Age")])]
|
35
|
+
)]
|
36
|
+
|
37
|
+
),
|
38
|
+
tbody.([]).(
|
39
|
+
[tr.([]).([
|
40
|
+
td.([]).([text.("Martin")]),
|
41
|
+
td.([]).([text.("34")]),
|
42
|
+
])]
|
43
|
+
)]
|
44
|
+
)
|
48
45
|
```
|
49
46
|
|
50
|
-
|
51
47
|
Note that the html will not be formated. If you want to format it, you can use a function as such:
|
52
48
|
|
53
49
|
```ruby
|
data/lib/html_fn/version.rb
CHANGED
data/lib/html_fn.rb
CHANGED
@@ -3,16 +3,14 @@ require "fn_reader"
|
|
3
3
|
require "html_fn/attributes"
|
4
4
|
|
5
5
|
module HtmlFn
|
6
|
-
fn_reader :
|
7
|
-
|
8
|
-
|
9
|
-
@@node = -> tag, attrs, elems {
|
6
|
+
fn_reader :node, :div, :table, :thead, :tr, :th, :td, :tbody, :text
|
7
|
+
@@node = ->tag, attrs, elems {
|
10
8
|
<<EOF
|
11
9
|
<#{tag} #{Attributes.attrs_to_s.(attrs)}>#{elems.join("\n")}</#{tag}>
|
12
10
|
EOF
|
13
11
|
}.curry
|
14
12
|
|
15
|
-
@@text = ->
|
13
|
+
@@text = ->a { [a.to_s] }
|
16
14
|
|
17
15
|
@@script = node.(:script)
|
18
16
|
@@table = node.(:table)
|
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.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Chabot
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
111
|
+
rubygems_version: 3.4.6
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Bunch of lamdas for building Html
|