htmlcom 0.2.1 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/htmlcom.rb +100 -12
  5. metadata +60 -39
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d63b26341bc033396dbfd9b65865b655c47ba2fccff5854b0f98074de69433f
4
- data.tar.gz: d3471f1e55a310f8c8d1536d4f558c8c014fcf60d3c5f32f624c9676c8e91c09
3
+ metadata.gz: 10e65ec30c633da273e20802b6fc81ad1a4c4f4506f33425439f1073829098e9
4
+ data.tar.gz: ef59c86481a1081f6b5eb1ddb6fe272f9177cd16e22cba454945a28427853a03
5
5
  SHA512:
6
- metadata.gz: d2df0df4fd5b6b41b99dede576b31cc06c2da5043f120f639ad40b2db82eefeb7a982f34c5ad9358bdc82101051ccf24ff7675cb13a7adda64b99165c37e1fbd
7
- data.tar.gz: 2ddd93aa77b67123c2b50b5d3f3fe42a93f0ad7ffa32358791674305ee69bcec8ecc771a98f3a7975574e67d4acc229f4ffbeab4992994a0f30da71009ef4889
6
+ metadata.gz: 9d1f6037e43eed61531cbfbfe92ea8d95b0b620dbd9a786d679135c9d22c0c3988bcc2df3c3a85fd48b4354dc1278094053ae3575b62b65bedca6017a3c0d479
7
+ data.tar.gz: 17bbb185d6ac10e162c9a9e2dfd17239a5b79283992ca1df02265277693e478e600506f8b39a52ca0b169d59609772f80fbcfc3363f098fdd4deb16de8cbdd51
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -8,13 +8,14 @@ require 'nokogiri'
8
8
  require 'xml_to_sliml'
9
9
  require 'jsajax_wizard'
10
10
  require 'jsmenubuilder'
11
+ require 'jstreebuilder'
11
12
 
12
13
 
13
14
  module HtmlCom
14
15
 
15
16
  class Accordion
16
17
 
17
- attr_reader :to_html, :to_css, :to_js
18
+ attr_reader :to_html, :to_css, :to_js, :to_tags
18
19
 
19
20
  def initialize(xml, debug: false)
20
21
 
@@ -23,12 +24,43 @@ module HtmlCom
23
24
  # transform the accordion XML to tags XML
24
25
  tags = Nokogiri::XSLT(xsl()).transform(Nokogiri::XML(xml))\
25
26
  .to_xhtml(indent: 0)
27
+
28
+ @to_tags = tags # used for debugging the structure
29
+
26
30
  jmb = JsMenuBuilder.new(tags, debug: debug)
27
- @to_css = jmb.to_css
28
- @to_js = jmb.to_js
31
+
32
+ pg = if Rexle.new(xml).root.attributes[:navbar] then
33
+
34
+ a = jmb.to_h.keys.sort.map {|key, _| [key, '#' + key.downcase]}
35
+
36
+ navbar = JsMenuBuilder.new(:sticky_navbar, {sticky_navbar: a,
37
+ debug: debug})
38
+
39
+ @to_css = navbar.to_css + "\n" + jmb.to_css
40
+ @to_js = navbar.to_js + "\n" + jmb.to_js
41
+
42
+
43
+ jmb.to_webpage do |css, html, js|
44
+
45
+ [
46
+ navbar.to_css + "\n" + css,
47
+ navbar.to_html + "\n" + html,
48
+ navbar.to_js + "\n" + js
49
+ ]
50
+
51
+ end
52
+
53
+ else
54
+
55
+ @to_css = jmb.to_css
56
+ @to_js = jmb.to_js
57
+
58
+ jmb.to_webpage
59
+
60
+ end
29
61
 
30
- # apply the AJAX
31
- @to_html = JsAjaxWizard.new(jmb.to_webpage).to_html
62
+ # apply the AJAX
63
+ @to_html = JsAjaxWizard.new(pg).to_html
32
64
 
33
65
  end
34
66
 
@@ -55,6 +87,10 @@ xsl= %q(
55
87
  <xsl:attribute name='title'>
56
88
  <xsl:value-of select='@title'/>
57
89
  </xsl:attribute>
90
+
91
+ <xsl:attribute name='class'>
92
+ <xsl:value-of select='@class'/>
93
+ </xsl:attribute>
58
94
 
59
95
  <xsl:element name="input">
60
96
  <xsl:attribute name="type">hidden</xsl:attribute>
@@ -90,8 +126,8 @@ xsl= %q(
90
126
 
91
127
  attr_accessor :title, :content
92
128
 
93
- def initialize(title, content: '', callback: nil)
94
- @title, @content, @callback = title, content, callback
129
+ def initialize(title, content: '', callback: nil, debug: false)
130
+ @title, @content, @callback, @debug = title, content, callback, debug
95
131
  end
96
132
 
97
133
  def content=(s)
@@ -120,13 +156,16 @@ xsl= %q(
120
156
  # current options for type:
121
157
  # :tabs, :full_page_tabs
122
158
 
123
- def initialize(type=:tabs, headings: [], xml: nil)
159
+ def initialize(type=:tabs, headings: [], xml: nil, debug: false)
124
160
 
125
- @type = type
161
+ @type, @debug = type, debug
126
162
  @build = JsMenuBuilder.new(type, headings: headings)
163
+
164
+ @active_tab = 1
127
165
 
128
166
  @tab = headings.map do |heading|
129
- Tab.new heading, content: "<h3>#{heading}</h3>", callback: self
167
+ Tab.new heading, content: "<h3>#{heading}</h3>",
168
+ callback: self, debug: debug
130
169
  end
131
170
 
132
171
  if xml then
@@ -164,17 +203,30 @@ xsl= %q(
164
203
  tabs = @tab.map do |tab|
165
204
  tab.title ? tab.to_a : nil
166
205
  end.compact.to_h
167
-
168
- @build = JsMenuBuilder.new(@type, tabs: tabs, active: @active_tab)
206
+
207
+ if @debug then
208
+ puts 'inside ping; tabs: ' + tabs.inspect
209
+ puts '@active_tab: ' + @active_tab.inspect
210
+ end
211
+
212
+ @build = JsMenuBuilder.new(@type, tabs: tabs,
213
+ active: @active_tab, debug: @debug)
169
214
 
170
215
  end
171
216
 
172
217
  alias refresh ping
218
+
219
+ def to_css()
220
+ @build.to_css
221
+ end
173
222
 
174
223
  def to_html()
175
224
  @build.to_html
176
225
  end
177
226
 
227
+ def to_js()
228
+ @build.to_js
229
+ end
178
230
 
179
231
  # not yet working properly
180
232
  def to_bangtag()
@@ -188,5 +240,41 @@ xsl= %q(
188
240
 
189
241
  end
190
242
 
243
+ class Tree
244
+
245
+ def initialize(s, debug: false, hn: 2)
246
+ jtb = JsTreeBuilder.new(:sidebar, {src: s, hn: hn, debug: debug})
247
+ @html = jtb.to_webpage
248
+ end
249
+
250
+ def to_webpage()
251
+ @html
252
+ end
253
+
254
+ end
255
+
256
+ class VerticalMenu
257
+
258
+ def initialize(links, debug: false)
259
+ @jtb = JsMenuBuilder.new(:vertical_menu, {items: links, debug: debug})
260
+ end
261
+
262
+ def to_css()
263
+ @jtb.to_css
264
+ end
265
+
266
+ def to_html()
267
+ @jtb.to_html
268
+ end
269
+
270
+ def to_js()
271
+ @jtb.to_js
272
+ end
273
+
274
+ def to_webpage()
275
+ @jtb.to_webpage
276
+ end
277
+
278
+ end
191
279
 
192
280
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlcom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -11,34 +11,54 @@ cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
13
  MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTkwNzEyMTkwOTA2WhcN
15
- MjAwNzExMTkwOTA2WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCzzWXZ
17
- TL6xk999BKr4lVCAlobCVnxEotwgpmtPQPhhGGg7PsQPP/QUCt23JrmsSBfpPmIH
18
- MpPjC1dfhwjGQgcmkjB5sNSprB6z0zFTJ8MdoxZAAioq7peDiKSkSeojhivGKKmG
19
- XfL0NeMdLl3wr0fU7rmKw1Q3Kev3/GPPZSxyjhvgB1+eHTxDkGpCLi3z6mFsZd+2
20
- /o88Knl3bLCyJ/yU8V09/UKl0uIessRu5WUV3KKg4rxUmQEloi2FHDQy+Qztlk+s
21
- J1gb5YJwoHxF2L09kSB7KTSXHpe58wuwUQevDy20DvTbMJAFSb3FUG3AnP8hgHh8
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x+VQYBDedjbHCevrleL6REiRQ0LhkEpPi
32
+ 6beXYDQ6kQfSx368fAS8NLwNuozMTcRgRUl7xqP0+ul8nSJZLLWIXmsrs6cyHnw9
33
+ HwdPlwmYQHY1xkBxGI9yW8rB4FrO3JUOgLgDnMZ57q9iNKMS9uIqXaWEm0MQLY6m
34
+ 0KaSzHUAYca+U2kPPE5/bYl/PRm6PEwzKh9gvxP9DfOsvMo5zx6nIwTk7q9OBGVh
35
+ Y7ogWFuR7xV5C2r4jFG/ETJJx68h+Dq4axa5mkEdMQz1iBbVr7SAq4Uoad0IbYtV
36
+ 9JH57w1VS3ePSOlwBmm2yWGh
37
37
  -----END CERTIFICATE-----
38
- date: 2020-01-22 00:00:00.000000000 Z
38
+ date: 2021-01-17 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: jsmenubuilder
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.3'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.3.4
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '0.3'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 0.3.4
60
+ - !ruby/object:Gem::Dependency
61
+ name: jstreebuilder
42
62
  requirement: !ruby/object:Gem::Requirement
43
63
  requirements:
44
64
  - - "~>"
@@ -46,7 +66,7 @@ dependencies:
46
66
  version: '0.2'
47
67
  - - ">="
48
68
  - !ruby/object:Gem::Version
49
- version: 0.2.10
69
+ version: 0.2.4
50
70
  type: :runtime
51
71
  prerelease: false
52
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -56,27 +76,27 @@ dependencies:
56
76
  version: '0.2'
57
77
  - - ">="
58
78
  - !ruby/object:Gem::Version
59
- version: 0.2.10
79
+ version: 0.2.4
60
80
  - !ruby/object:Gem::Dependency
61
81
  name: jsajax_wizard
62
82
  requirement: !ruby/object:Gem::Requirement
63
83
  requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- version: 0.3.0
67
84
  - - "~>"
68
85
  - !ruby/object:Gem::Version
69
86
  version: '0.3'
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.3.1
70
90
  type: :runtime
71
91
  prerelease: false
72
92
  version_requirements: !ruby/object:Gem::Requirement
73
93
  requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 0.3.0
77
94
  - - "~>"
78
95
  - !ruby/object:Gem::Version
79
96
  version: '0.3'
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 0.3.1
80
100
  - !ruby/object:Gem::Dependency
81
101
  name: xml_to_sliml
82
102
  requirement: !ruby/object:Gem::Requirement
@@ -86,7 +106,7 @@ dependencies:
86
106
  version: '0.1'
87
107
  - - ">="
88
108
  - !ruby/object:Gem::Version
89
- version: 0.1.1
109
+ version: 0.1.2
90
110
  type: :runtime
91
111
  prerelease: false
92
112
  version_requirements: !ruby/object:Gem::Requirement
@@ -96,27 +116,27 @@ dependencies:
96
116
  version: '0.1'
97
117
  - - ">="
98
118
  - !ruby/object:Gem::Version
99
- version: 0.1.1
119
+ version: 0.1.2
100
120
  - !ruby/object:Gem::Dependency
101
121
  name: nokogiri
102
122
  requirement: !ruby/object:Gem::Requirement
103
123
  requirements:
104
124
  - - "~>"
105
125
  - !ruby/object:Gem::Version
106
- version: '1.10'
126
+ version: '1.11'
107
127
  - - ">="
108
128
  - !ruby/object:Gem::Version
109
- version: 1.10.7
129
+ version: 1.11.1
110
130
  type: :runtime
111
131
  prerelease: false
112
132
  version_requirements: !ruby/object:Gem::Requirement
113
133
  requirements:
114
134
  - - "~>"
115
135
  - !ruby/object:Gem::Version
116
- version: '1.10'
136
+ version: '1.11'
117
137
  - - ">="
118
138
  - !ruby/object:Gem::Version
119
- version: 1.10.7
139
+ version: 1.11.1
120
140
  description:
121
141
  email: james@jamesrobertson.eu
122
142
  executables: []
@@ -143,7 +163,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
163
  - !ruby/object:Gem::Version
144
164
  version: '0'
145
165
  requirements: []
146
- rubygems_version: 3.0.3
166
+ rubyforge_project:
167
+ rubygems_version: 2.7.10
147
168
  signing_key:
148
169
  specification_version: 4
149
170
  summary: Generates HTML components and is designed for rendering dynamic web pages
metadata.gz.sig CHANGED
Binary file