hs-cli 0.3.1 → 0.3.2

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: ad6b106d62bb63e4670c02c361196a951278d216ea7e88d116d555a2eeaa50e7
4
- data.tar.gz: 8796ab10636cee75f6f7afa11c16726599a1f5c8b766ebbb4218ca31b898a093
3
+ metadata.gz: f03f566c25908333d147575e0340d64712f18ec6978e1e88b9e0e43d7aa3a9f9
4
+ data.tar.gz: 6cb2f722f4ffcca481bcf1aac33919e72fcd46587c371ea053d0c90496afb10c
5
5
  SHA512:
6
- metadata.gz: 277980da3de39d556216621d8953e7f461c6c7da3d43b69bbe2d7abaad3104b44b2ff2f35f9826c95be52dae430d2e26ef928723cb5a5cfc50d8cc2e30ebe7a7
7
- data.tar.gz: 9106fbd2b3f52df9a8350ba8b6c07ffd93b922e1ec52ea912e17a91e63b72fdfc06c7ab6c8c68fd68fa55705cec88eb2c9ae8010e9598a33c446b9fffa9a1541
6
+ metadata.gz: 1a663e741828d7548f2f66cc9f3e140be2a7388816f4362510304dad12a7676eca72e5f00be4436322699bccc035b7e054e055930c8a2c2231f1a0c952e9ded3
7
+ data.tar.gz: 36208386fc8adc820823aae93606b9107eeb5815232f3ea7d0c02373104e4d0e98008700492774d2f387cda133b6315bc181bef376fe63126b395cacdd55c405
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hs-cli (0.3.1)
4
+ hs-cli (0.3.2)
5
5
  activesupport (~> 5.2)
6
6
  nokogiri (~> 1.8)
7
7
  rack-contrib (~> 2.0)
@@ -23,10 +23,12 @@ pre {
23
23
 
24
24
  /* Live code styling */
25
25
 
26
- .live-code {
26
+ .live-code,
27
+ .code-preview {
27
28
  padding: 2em;
28
- background: rgba(0, 0, 255, 0.1);
29
- border: 5px dotted blue;
29
+ background: rgba(100, 255, 255, 0.1);
30
+ border: 3px dotted blue;
31
+ margin-bottom: 1em;
30
32
  }
31
33
 
32
34
  .initial-code,
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ class CodePreview < HS::Element
5
+ def preview
6
+ wrap_into_tag 'div', class: 'code-preview' do
7
+ children.map(&:preview_raw)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -34,6 +34,10 @@ module HS
34
34
  element_preview(tag_name, params, children)
35
35
  end
36
36
 
37
+ def preview_raw
38
+ preview
39
+ end
40
+
37
41
  private
38
42
 
39
43
  def element_class_name
@@ -17,5 +17,9 @@ module HS
17
17
  def preview
18
18
  text_preview(text)
19
19
  end
20
+
21
+ def preview_raw
22
+ text
23
+ end
20
24
  end
21
25
  end
@@ -19,5 +19,9 @@ module HS
19
19
  def initialize_solution(data)
20
20
  HS::Solution.new(get_params(data))
21
21
  end
22
+
23
+ def initialize_code_preview(_data)
24
+ HS::CodePreview.new
25
+ end
22
26
  end
23
27
  end
@@ -17,6 +17,15 @@ module HS
17
17
  ].join
18
18
  end
19
19
 
20
+ def wrap_into_tag(tag_name, params)
21
+ children = yield
22
+ [
23
+ element_start(tag_name, params, children),
24
+ children.join(''),
25
+ element_end(tag_name, children)
26
+ ].join
27
+ end
28
+
20
29
  private
21
30
 
22
31
  def element_start(tag, params, children)
data/lib/hs/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HS
4
- VERSION = '0.3.1'
4
+ VERSION = '0.3.2'
5
5
  end
data/lib/hs.rb CHANGED
@@ -10,6 +10,7 @@ require 'hs/models/module'
10
10
  require 'hs/elements/element'
11
11
  require 'hs/elements/br'
12
12
  require 'hs/elements/code'
13
+ require 'hs/elements/code_preview'
13
14
  require 'hs/elements/dd'
14
15
  require 'hs/elements/dl'
15
16
  require 'hs/elements/dt'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hs-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Kurashvili
@@ -228,6 +228,7 @@ files:
228
228
  - lib/hs/devserver.rb
229
229
  - lib/hs/elements/br.rb
230
230
  - lib/hs/elements/code.rb
231
+ - lib/hs/elements/code_preview.rb
231
232
  - lib/hs/elements/dd.rb
232
233
  - lib/hs/elements/dl.rb
233
234
  - lib/hs/elements/dt.rb