jsmenubuilder 0.2.12 → 0.3.0

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: 1fdc2c1787fb134b36c6d883e8809b822cbff1642542d103c8e6b965464fd227
4
- data.tar.gz: 33dd4cec053d48d5a47f2239d1d97f9428853c18ca79012a41c798c5fa239beb
3
+ metadata.gz: 0eba4d6420ecbc1a40bc3340c9b65dce19df5b09ed27d13ad93bfa0381b66ac9
4
+ data.tar.gz: f5b93fc21a025c39b9bb194a3e54c1525fd57295635986642be16f96046c215c
5
5
  SHA512:
6
- metadata.gz: 89fc1f800e9781ed67d488b65d78b1de8fac89c3bf9181200725e35295fcdceffe71ec1abb99800ad4ba64a708d1f4dec5c1536442b4e8d9cc0dd01c8ccbe784
7
- data.tar.gz: 3c058822cbe2013afc605610b3c22f4f65745c8418e077de4523820cc0dd87f86068e04c9aa77b857abcecdfa4c53fe2112d7e0aa93f243cfd83785759b9731c
6
+ metadata.gz: a597c62a7d66619d306b3ab0266b81c4b8edfd4ba991e88aa6bbc6d0a7d183078dbf7948f9245a8fc0b90775c20d9324322873d6ed41811e4a04008765bffe27
7
+ data.tar.gz: 1b5ba4cf5e40745d0fdb5b2a4c17a6dcde6028a36d740a7b6c3a0d72f87086299090b5e31e0fb1dc3f8ecc02ac7dbabc962ee74969e81cd6f6263dc8ea23376e
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/jsmenubuilder.rb CHANGED
@@ -331,6 +331,10 @@ EOF
331
331
  @css
332
332
  end
333
333
 
334
+ def to_h()
335
+ @h
336
+ end
337
+
334
338
  def to_html()
335
339
  @html
336
340
  end
@@ -341,25 +345,29 @@ EOF
341
345
 
342
346
  def to_webpage()
343
347
 
348
+ r = block_given? ? yield(@css, @html, @js) : @css, @html, @js
349
+ css, html, js = *r.flatten
350
+ puts 'css: ' + css.inspect if @debug
351
+
344
352
  a = RexleBuilder.build do |xml|
345
353
  xml.html do
346
354
  xml.head do
347
355
  xml.meta name: "viewport", content: \
348
356
  "width=device-width, initial-scale=1"
349
- xml.style "\nbody {font-family: Arial;}\n\n" + @css
357
+ xml.style "\nbody {font-family: Arial;}\n\n" + css
350
358
  end
351
359
  xml.body
352
360
  end
353
361
  end
354
362
 
355
363
  doc = Rexle.new(a)
356
- e = Rexle.new("<html>%s</html>" % @html).root
364
+ e = Rexle.new("<html>%s</html>" % html).root
357
365
 
358
366
  e.children.each {|child| doc.root.element('body').add child }
359
367
 
360
368
  doc.root.element('body').add \
361
369
  Rexle::Element.new('script').add_text "\n" +
362
- @js.gsub(/^ +\/\/[^\n]+\n/,'')
370
+ js.gsub(/^ +\/\/[^\n]+\n/,'')
363
371
 
364
372
  "<!DOCTYPE html>\n" + doc.xml(pretty: true, declaration: false)\
365
373
  .gsub(/<\/div>/,'\0' + "\n").gsub(/\n *<!--[^>]+>/,'')
@@ -537,7 +545,7 @@ EOF
537
545
 
538
546
  panels = opt[:accordion]
539
547
 
540
- h = panels.group_by {|key, value| key.upcase[0]}
548
+ @h = h = panels.group_by {|key, value| key.upcase[0]}
541
549
 
542
550
  debug = @debug
543
551
 
@@ -546,15 +554,7 @@ EOF
546
554
  a = RexleBuilder.build do |xml|
547
555
 
548
556
  xml.html do
549
-
550
- xml.div(id: 'navbar') do
551
-
552
- h.each do |char, _|
553
- xml.a({href: '#' + char.downcase}, char)
554
- end
555
-
556
- end
557
-
557
+
558
558
  h.each do |char, rows|
559
559
 
560
560
  xml.h2({id: char.downcase}, char)
@@ -580,7 +580,8 @@ EOF
580
580
 
581
581
  def sticky_navbar(opt={})
582
582
 
583
-
583
+ puts 'inside sticky_navbar' if @debug
584
+
584
585
  navhtml = if opt[:html] then
585
586
 
586
587
  opt[:html]
@@ -593,8 +594,8 @@ EOF
593
594
 
594
595
  xml.div(id: 'navbar') do
595
596
 
596
- h.each do |char, _|
597
- xml.a({href: '#' + char.downcase}, char)
597
+ opt[:sticky_navbar].each do |title, href|
598
+ xml.a({href: href}, title)
598
599
  end
599
600
 
600
601
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsmenubuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  haYJPATx3zs+9jtQoiFg+keM0CPYk/5LgCv9jxxzQcSS20C8O9MWRVvYfIr47ak7
36
36
  yXrDPmRvbJLTNjDv6Tkg3vU6
37
37
  -----END CERTIFICATE-----
38
- date: 2020-02-23 00:00:00.000000000 Z
38
+ date: 2020-02-24 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rexle
metadata.gz.sig CHANGED
Binary file