hs-cli 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: 01dbde2079037eab73a7d0380810276f614fb6c6ea4dfbb607027f1261458c78
4
- data.tar.gz: 375508cdfd0574107d515b080dcbe556084f4ad324ce59a586701e90266432a7
3
+ metadata.gz: ad6b106d62bb63e4670c02c361196a951278d216ea7e88d116d555a2eeaa50e7
4
+ data.tar.gz: 8796ab10636cee75f6f7afa11c16726599a1f5c8b766ebbb4218ca31b898a093
5
5
  SHA512:
6
- metadata.gz: a6117a1462bc5a5f1e1ed1c2f7a708d8edd3054bde127b60cbb4db9340dddc7ceec0e2c81804435b15a2dc51c118cca57085fd0bedf3819121d54ae24ad019c5
7
- data.tar.gz: 21b5cb8b8d1dd4b8e10f2997dd4c67175cc85cc403da8f25af4a35ec6995c51a5ef2a20c6cacdd3bbd1edab2589373b542ddd546ba91237c046e7a2fa1af73a9
6
+ metadata.gz: 277980da3de39d556216621d8953e7f461c6c7da3d43b69bbe2d7abaad3104b44b2ff2f35f9826c95be52dae430d2e26ef928723cb5a5cfc50d8cc2e30ebe7a7
7
+ data.tar.gz: 9106fbd2b3f52df9a8350ba8b6c07ffd93b922e1ec52ea912e17a91e63b72fdfc06c7ab6c8c68fd68fa55705cec88eb2c9ae8010e9598a33c446b9fffa9a1541
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hs-cli (0.3.0)
4
+ hs-cli (0.3.1)
5
5
  activesupport (~> 5.2)
6
6
  nokogiri (~> 1.8)
7
7
  rack-contrib (~> 2.0)
@@ -19,3 +19,41 @@ pre {
19
19
  border-left: 3px solid rgba(255, 0, 0, 0.75) !important;
20
20
  background-color: rgba(255, 0, 0, 0.05);
21
21
  }
22
+
23
+
24
+ /* Live code styling */
25
+
26
+ .live-code {
27
+ padding: 2em;
28
+ background: rgba(0, 0, 255, 0.1);
29
+ border: 5px dotted blue;
30
+ }
31
+
32
+ .initial-code,
33
+ .solution {
34
+ position: relative;
35
+ padding-top: 24px;
36
+ }
37
+
38
+ .initial-code::before,
39
+ .solution::before {
40
+ position: absolute;
41
+ top: 0;
42
+ left: 0;
43
+ font-size: 10px;
44
+ padding: 4px 16px;
45
+ background-color: rgba(0, 0, 255, 0.75);
46
+ color: white;
47
+ }
48
+
49
+ .initial-code::before {
50
+ content: "საწყისი მაგალითი";
51
+ }
52
+
53
+ .solution::before {
54
+ content: "ამონახსნი";
55
+ }
56
+
57
+ .live-code::after {
58
+ content: "აღდგენა /// ამოხსნის ნახვა"
59
+ }
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ class InitialCode < HS::Element
5
+ def default_class
6
+ 'initial-code'
7
+ end
8
+
9
+ def tag_name
10
+ 'pre'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ class LiveCode < HS::Element
5
+ def default_class
6
+ 'live-code'
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ class Solution < HS::Element
5
+ def default_class
6
+ 'solution'
7
+ end
8
+
9
+ def tag_name
10
+ 'pre'
11
+ end
12
+ end
13
+ end
@@ -1,7 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'hs/loaders/initializers/code_initializers'
4
+ require 'hs/loaders/initializers/list_initializers'
5
+ require 'hs/loaders/initializers/other_initializers'
6
+ require 'hs/loaders/initializers/table_initializers'
7
+ require 'hs/loaders/initializers/text_initializers'
8
+
3
9
  module HS
4
10
  module ElementLoader
11
+ include HS::CodeInitializers
12
+ include HS::ListInitializers
13
+ include HS::OtherInitializers
14
+ include HS::TableInitializers
15
+ include HS::TextInitializers
16
+
5
17
  def load_element(data)
6
18
  name = data[:_name]
7
19
  element = initialize_element(name, data)
@@ -24,104 +36,8 @@ module HS
24
36
  end.compact.to_h
25
37
  end
26
38
 
27
- def initialize_header(data)
28
- HS::Header.new(get_params(data, %i[level class_name style]))
29
- end
30
-
31
39
  def initialize_element(name, data)
32
40
  send("initialize_#{name}", data)
33
41
  end
34
-
35
- def initialize_text(data)
36
- HS::Text.new(text: data[:text])
37
- end
38
-
39
- def initialize_p(data)
40
- HS::Paragraph.new(get_params(data))
41
- end
42
-
43
- def initialize_note(data)
44
- HS::Note.new(get_params(data))
45
- end
46
-
47
- def initialize_intro(data)
48
- HS::Intro.new(get_params(data))
49
- end
50
-
51
- def initialize_em(data)
52
- HS::Emphasize.new(get_params(data))
53
- end
54
-
55
- def initialize_link(data)
56
- HS::Link.new(get_params(data, %i[to class_name style]))
57
- end
58
-
59
- def initialize_original(data)
60
- HS::Original.new(get_params(data))
61
- end
62
-
63
- def initialize_strong(data)
64
- HS::Strong.new(get_params(data))
65
- end
66
-
67
- def initialize_ul(data)
68
- HS::Ul.new(get_params(data))
69
- end
70
-
71
- def initialize_ol(data)
72
- HS::Ol.new(get_params(data))
73
- end
74
-
75
- def initialize_li(data)
76
- HS::Li.new(get_params(data))
77
- end
78
-
79
- def initialize_image(data)
80
- HS::Image.new(get_params(data, %i[src class_name style]))
81
- end
82
-
83
- def initialize_code(data)
84
- HS::Code.new(get_params(data, %i[lang class_name style]))
85
- end
86
-
87
- def initialize_dd(data)
88
- HS::Dd.new(get_params(data))
89
- end
90
-
91
- def initialize_dl(data)
92
- HS::Dl.new(get_params(data))
93
- end
94
-
95
- def initialize_dt(data)
96
- HS::Dt.new(get_params(data))
97
- end
98
-
99
- def initialize_table(data)
100
- HS::Table.new(get_params(data))
101
- end
102
-
103
- def initialize_thead(data)
104
- HS::Thead.new(get_params(data))
105
- end
106
-
107
- def initialize_tbody(data)
108
- HS::Tbody.new(get_params(data))
109
- end
110
-
111
- def initialize_tr(data)
112
- HS::Tr.new(get_params(data))
113
- end
114
-
115
- def initialize_th(data)
116
- HS::Th.new(get_params(data))
117
- end
118
-
119
- def initialize_td(data)
120
- HS::Td.new(get_params(data))
121
- end
122
-
123
- def initialize_br(_data)
124
- HS::Br.new # no params!
125
- end
126
42
  end
127
43
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ module CodeInitializers
5
+ private
6
+
7
+ def initialize_code(data)
8
+ HS::Code.new(get_params(data, %i[lang class_name style]))
9
+ end
10
+
11
+ def initialize_live_code(data)
12
+ HS::LiveCode.new(get_params(data, %i[lang]))
13
+ end
14
+
15
+ def initialize_initial_code(data)
16
+ HS::InitialCode.new(get_params(data))
17
+ end
18
+
19
+ def initialize_solution(data)
20
+ HS::Solution.new(get_params(data))
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ module ListInitializers
5
+ private
6
+
7
+ def initialize_ul(data)
8
+ HS::Ul.new(get_params(data))
9
+ end
10
+
11
+ def initialize_ol(data)
12
+ HS::Ol.new(get_params(data))
13
+ end
14
+
15
+ def initialize_li(data)
16
+ HS::Li.new(get_params(data))
17
+ end
18
+
19
+ def initialize_dd(data)
20
+ HS::Dd.new(get_params(data))
21
+ end
22
+
23
+ def initialize_dl(data)
24
+ HS::Dl.new(get_params(data))
25
+ end
26
+
27
+ def initialize_dt(data)
28
+ HS::Dt.new(get_params(data))
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ module OtherInitializers
5
+ private
6
+
7
+ def initialize_note(data)
8
+ HS::Note.new(get_params(data))
9
+ end
10
+
11
+ def initialize_intro(data)
12
+ HS::Intro.new(get_params(data))
13
+ end
14
+
15
+ def initialize_link(data)
16
+ HS::Link.new(get_params(data, %i[to class_name style]))
17
+ end
18
+
19
+ def initialize_original(data)
20
+ HS::Original.new(get_params(data))
21
+ end
22
+
23
+ def initialize_image(data)
24
+ HS::Image.new(get_params(data, %i[src class_name style]))
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ module TableInitializers
5
+ private
6
+
7
+ def initialize_table(data)
8
+ HS::Table.new(get_params(data))
9
+ end
10
+
11
+ def initialize_thead(data)
12
+ HS::Thead.new(get_params(data))
13
+ end
14
+
15
+ def initialize_tbody(data)
16
+ HS::Tbody.new(get_params(data))
17
+ end
18
+
19
+ def initialize_tr(data)
20
+ HS::Tr.new(get_params(data))
21
+ end
22
+
23
+ def initialize_th(data)
24
+ HS::Th.new(get_params(data))
25
+ end
26
+
27
+ def initialize_td(data)
28
+ HS::Td.new(get_params(data))
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module HS
4
+ module TextInitializers
5
+ private
6
+
7
+ def initialize_header(data)
8
+ HS::Header.new(get_params(data, %i[level class_name style]))
9
+ end
10
+
11
+ def initialize_text(data)
12
+ HS::Text.new(text: data[:text])
13
+ end
14
+
15
+ def initialize_p(data)
16
+ HS::Paragraph.new(get_params(data))
17
+ end
18
+
19
+ def initialize_em(data)
20
+ HS::Emphasize.new(get_params(data))
21
+ end
22
+
23
+ def initialize_strong(data)
24
+ HS::Strong.new(get_params(data))
25
+ end
26
+
27
+ def initialize_br(_data)
28
+ HS::Br.new # no params!
29
+ end
30
+ end
31
+ end
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.0'
4
+ VERSION = '0.3.1'
5
5
  end
data/lib/hs.rb CHANGED
@@ -16,13 +16,16 @@ require 'hs/elements/dt'
16
16
  require 'hs/elements/emphasize'
17
17
  require 'hs/elements/header'
18
18
  require 'hs/elements/image'
19
+ require 'hs/elements/initial_code'
19
20
  require 'hs/elements/intro'
20
21
  require 'hs/elements/li'
21
22
  require 'hs/elements/link'
23
+ require 'hs/elements/live_code'
22
24
  require 'hs/elements/note'
23
25
  require 'hs/elements/ol'
24
26
  require 'hs/elements/original'
25
27
  require 'hs/elements/paragraph'
28
+ require 'hs/elements/solution'
26
29
  require 'hs/elements/strong'
27
30
  require 'hs/elements/table'
28
31
  require 'hs/elements/text'
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.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dimitri Kurashvili
@@ -235,13 +235,16 @@ files:
235
235
  - lib/hs/elements/emphasize.rb
236
236
  - lib/hs/elements/header.rb
237
237
  - lib/hs/elements/image.rb
238
+ - lib/hs/elements/initial_code.rb
238
239
  - lib/hs/elements/intro.rb
239
240
  - lib/hs/elements/li.rb
240
241
  - lib/hs/elements/link.rb
242
+ - lib/hs/elements/live_code.rb
241
243
  - lib/hs/elements/note.rb
242
244
  - lib/hs/elements/ol.rb
243
245
  - lib/hs/elements/original.rb
244
246
  - lib/hs/elements/paragraph.rb
247
+ - lib/hs/elements/solution.rb
245
248
  - lib/hs/elements/strong.rb
246
249
  - lib/hs/elements/table.rb
247
250
  - lib/hs/elements/text.rb
@@ -249,6 +252,11 @@ files:
249
252
  - lib/hs/loaders/chapter_loader.rb
250
253
  - lib/hs/loaders/course_loader.rb
251
254
  - lib/hs/loaders/element_loader.rb
255
+ - lib/hs/loaders/initializers/code_initializers.rb
256
+ - lib/hs/loaders/initializers/list_initializers.rb
257
+ - lib/hs/loaders/initializers/other_initializers.rb
258
+ - lib/hs/loaders/initializers/table_initializers.rb
259
+ - lib/hs/loaders/initializers/text_initializers.rb
252
260
  - lib/hs/loaders/module_loader.rb
253
261
  - lib/hs/loaders/xml_parser.rb
254
262
  - lib/hs/models/chapter.rb