redcarpet-form-extension 0.1.3 → 0.3.0
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +14 -14
- data/Rakefile +5 -0
- data/lib/redcarpet/form/extension/block/checkboxes.rb +4 -4
- data/lib/redcarpet/form/extension/block/radio_buttons.rb +4 -4
- data/lib/redcarpet/form/extension/block/textarea.rb +1 -1
- data/lib/redcarpet/form/extension/inline/input.rb +2 -2
- data/lib/redcarpet/form/extension/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c2cdc7a4d88212ac44275523aed5d03b3090b9a06575fdfbcda393d85b953c
|
4
|
+
data.tar.gz: b2a5e3bc85878b77431df8d70ae8f0e0185efd3fbb64c100454f430a2717f4ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dae0d412f37f7486a67e1bb00e60adb23d7a73e54d613a5424e118c0a296d400232344ba2c0e6ad15429b48c3cfa4c2c922f4867848cc72c3671d1bf7a9205c
|
7
|
+
data.tar.gz: cd80b54efb678ce4343243237c0ca6f1e3e75a102a3b134a27e88017d6d80e4258ecab034cec4d9e88e81a673876b2e47e58da6c2a61b62b7c63abcdc814137c
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -27,10 +27,10 @@ markdown = Redcarpet::Markdown.new(Redcarpet::Form::Extension::Render::HTML)
|
|
27
27
|
|
28
28
|
### Input (inline)
|
29
29
|
|
30
|
-
Use the follwoing snap code to add an input tag in your html. By default, tag attributes are `type="text" name=""` but you can use `{}` to pass the attributes you need:
|
30
|
+
Use the follwoing snap code to add an input tag in your html. By default, tag attributes are `type="text" name="[random_string]"` but you can use `{}` to pass the attributes you need:
|
31
31
|
|
32
32
|
```txt
|
33
|
-
Some text before
|
33
|
+
Some text before [input]{ type="number" } and after.
|
34
34
|
```
|
35
35
|
|
36
36
|
Returns:
|
@@ -44,16 +44,16 @@ Returns:
|
|
44
44
|
Also, you can create your fieldset of checkboxes:
|
45
45
|
|
46
46
|
```text
|
47
|
-
[]{value="bike"} I have a bike [x]{value="car"} I have a car [x]{value="boat"} I have a boat
|
47
|
+
[]{ value="bike" } I have a bike [x]{ value="car" } I have a car [x]{ value="boat" } I have a boat
|
48
48
|
```
|
49
49
|
|
50
50
|
This snap returns the following HTML:
|
51
51
|
|
52
52
|
```html
|
53
53
|
<fieldset>
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
<label><input type="checkbox" name="xekiry[]" value="bike" /><span>I have a bike</span></label>
|
55
|
+
<label><input type="checkbox" name="xekiry[]" value="car" checked /><span>I have a car</span></label>
|
56
|
+
<label><input type="checkbox" name="xekiry[]" value="boat" checked /><span>I have a boat</span></label>
|
57
57
|
</fieldset>
|
58
58
|
```
|
59
59
|
|
@@ -72,9 +72,9 @@ which will return:
|
|
72
72
|
|
73
73
|
```html
|
74
74
|
<fieldset>
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
<label><input type="radio" name="ybqkvo" value="radio_1" /><span>HTML</span></label>
|
76
|
+
<label><input type="radio" name="ybqkvo" value="radio_2" checked /><span>CSS</span></label>
|
77
|
+
<label><input type="radio" name="ybqkvo" value="radio_3" /><span>JavaScript</span></label>
|
78
78
|
</fieldset>
|
79
79
|
```
|
80
80
|
|
@@ -86,17 +86,17 @@ which will return:
|
|
86
86
|
Finally, a textarea can be generated using the follwing snap:
|
87
87
|
|
88
88
|
```txt
|
89
|
-
[textarea]{value="Hello world!" rows="4" cols="10"} Text box
|
89
|
+
[textarea]{ value="Hello world!" rows="4" cols="10" } Text box
|
90
90
|
```
|
91
91
|
|
92
92
|
The HTML result is:
|
93
93
|
|
94
94
|
```html
|
95
95
|
<fieldset>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
<label>Text box</label>
|
97
|
+
<textarea name="kaatyu" rows="4" cols="10">
|
98
|
+
Hello world!
|
99
|
+
</textarea>
|
100
100
|
</fieldset>
|
101
101
|
````
|
102
102
|
|
data/Rakefile
CHANGED
@@ -9,9 +9,9 @@ module Redcarpet
|
|
9
9
|
#
|
10
10
|
# Ex: []{value="bike"} I have a bike [x]{value="car"} I have a car [x]{value="boat"} I have a boat
|
11
11
|
# <fieldset>
|
12
|
-
# <label><input type="checkbox" name="123456[]" value="bike"
|
13
|
-
# <label><input type="checkbox" name="123456[]" value="car" checked
|
14
|
-
# <label><input type="checkbox" name="123456[]" value="boat" checked
|
12
|
+
# <label><input type="checkbox" name="123456[]" value="bike" /><span>I have a bike</span></label>
|
13
|
+
# <label><input type="checkbox" name="123456[]" value="car" checked /><span>I have a car</span></label>
|
14
|
+
# <label><input type="checkbox" name="123456[]" value="boat" checked /><span>I have a boat</span></label>
|
15
15
|
# </fieldset>
|
16
16
|
# rubocop:enable Layout/LineLength
|
17
17
|
class Checkboxes
|
@@ -41,7 +41,7 @@ module Redcarpet
|
|
41
41
|
html += "<input #{Util.attributes_to_s(attrs)}"
|
42
42
|
html += ' checked' if checked == 'x'
|
43
43
|
html += ' />'
|
44
|
-
html += "
|
44
|
+
html += "<span>#{label}</span></label>" unless label.empty?
|
45
45
|
end
|
46
46
|
|
47
47
|
html += '</fieldset>'
|
@@ -8,9 +8,9 @@ module Redcarpet
|
|
8
8
|
#
|
9
9
|
# Ex: (){value="html"} HTML (x){value="css"} CSS (){value="js"} JavaScript
|
10
10
|
# <fieldset>
|
11
|
-
# <label><input type="radio" name="123456" value="html"
|
12
|
-
# <label><input type="radio" name="123456" value="css" checked
|
13
|
-
# <label><input type="radio" name="123456" value="js"
|
11
|
+
# <label><input type="radio" name="123456" value="html" /><span>HTML</span></label>
|
12
|
+
# <label><input type="radio" name="123456" value="css" checked /><span>CSS</span></label>
|
13
|
+
# <label><input type="radio" name="123456" value="js" /><span>JavaScript</span></label>
|
14
14
|
# </fieldset>
|
15
15
|
class RadioButtons
|
16
16
|
def self.pattern
|
@@ -39,7 +39,7 @@ module Redcarpet
|
|
39
39
|
html += "<input #{Util.attributes_to_s(attrs)}"
|
40
40
|
html += ' checked' if checked == 'x'
|
41
41
|
html += ' />'
|
42
|
-
html += "
|
42
|
+
html += "<span>#{label}</span></label>" unless label.empty?
|
43
43
|
end
|
44
44
|
|
45
45
|
html += '</fieldset>'
|
@@ -6,7 +6,7 @@ module Redcarpet
|
|
6
6
|
module Block
|
7
7
|
# A textarea block
|
8
8
|
#
|
9
|
-
# Ex: [textarea]{value="Hello world!" rows="4" cols="10"} Text box
|
9
|
+
# Ex: [textarea]{ value="Hello world!" rows="4" cols="10" } Text box
|
10
10
|
# <fieldset>
|
11
11
|
# <label>Text box</label>
|
12
12
|
# <textarea name="123456" rows="4" cols="10">
|
@@ -6,11 +6,11 @@ module Redcarpet
|
|
6
6
|
module Inline
|
7
7
|
# A single input tag
|
8
8
|
#
|
9
|
-
# Ex:
|
9
|
+
# Ex: [input]{ type="number" }
|
10
10
|
# <input type="number" name="" />
|
11
11
|
class Input
|
12
12
|
def self.pattern
|
13
|
-
|
13
|
+
/\[input\]([{][^}]*[}])?/
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.default_attributes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcarpet-form-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sofia Sousa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- ".rspec"
|
38
38
|
- ".rubocop.yml"
|
39
39
|
- ".ruby-version"
|
40
|
+
- CHANGELOG.md
|
40
41
|
- CODE_OF_CONDUCT.md
|
41
42
|
- Gemfile
|
42
43
|
- Gemfile.lock
|