martile 1.4.0 → 1.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fb9f0c5d9cf0623795ba66a2116f33dc06a756de0aea99a8cf954b82cd1a088
4
- data.tar.gz: 918cff6aa70177d109dae4a82bd7da1eb69a0e3cf821e0cdf80223462c9bd6b3
3
+ metadata.gz: 57fb8dcb688e8dacc6aa9201a11e27a8677e00d5e8fd6f77faff1cf6b3932bc1
4
+ data.tar.gz: 2d1f43f87a9f167f77d41d8876b8dc2b4f93cf353b598fb5c2bfdd49dce4f42d
5
5
  SHA512:
6
- metadata.gz: '0788c91db51446b301d09e5010e6b9578a0b0e937df178cbcb61ec17c3cc7a829e09ae6c287ef49e672aa6caa6d4bdc1ebe4081a29e3b8d6ef3b32233138dc2a'
7
- data.tar.gz: ecfbe6d3e77975c97f315c3fb8d52258eac355412e6a4fbef5fe44d0898873442c017a8d6502b209f9a97dbca2339a42d8d87d72bc4a88b25b23232832995dd4
6
+ metadata.gz: 4d8fbdb4e965ae5cbb26e001d40cb19b84e5046f95b0a9d3a62646a71e3a676373eb60c4a47a48301d156b09c45443e2ea264b0e9438cf89c728fb12a5a6b271
7
+ data.tar.gz: 7545ab60ade0306951aa45905511a9fd56a23af9904c58f4b2f81ea471a6caabc03454ed0a55171aeeb2e412db2c7c0881fd55654247cc2ecfb84bbb07e3874f
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/martile.rb CHANGED
@@ -15,6 +15,7 @@ require 'jsmenubuilder'
15
15
  require 'htmlcom'
16
16
 
17
17
 
18
+ # feature: 29-Feb-2020 The sidenav tag can now contain a raw hierachical list
18
19
  # feature: 22-Jan-2020 An HtmlCom::Accordion component can now be generated
19
20
  # using the tag <accordion>
20
21
  # feature: 16-Sep-2019 An HTML Tree component can now be generated when
@@ -776,13 +777,37 @@ class Martile
776
777
  def sidenav(s1)
777
778
 
778
779
  s = s1.clone
779
- if s =~ /^<sidenav\/>/ then
780
+ if s =~ /^<sidenav/ then
781
+
782
+ content = s[/<sidenav[^>]+>[^<]+<[^>]+>/]
783
+ puts ('content: ' + content.inspect) if @debug
784
+
785
+ doc = if content then
786
+
787
+ s.sub!(content,'')
788
+ doc2 = Rexle.new(content)
789
+ target = doc2.root.attributes[:target] || 'pgview'
790
+ txt = doc2.root.text
791
+ puts 'txt: ' + txt.inspect if @debug
792
+
793
+ html = HtmlCom::Tree.new(txt).to_webpage
794
+ puts 'html: ' + html.inspect if @debug
795
+
796
+ doc2 = Rexle.new(html)
797
+
798
+ doc2.root.xpath('body/ul[@class="sidenav"]/li//a').each do |node|
799
+ node.attributes[:target] = target
800
+ end
801
+
802
+ doc2
803
+
804
+ else
805
+ s.sub!(/^<sidenav\/>/,'')
806
+ html = HtmlCom::Tree.new(s).to_webpage
807
+ Rexle.new(html)
808
+ end
809
+
780
810
 
781
- s.sub!(/^<sidenav\/>/,'')
782
- #jtb = JsTreeBuilder.new :tree, {src: tree, debug: true}
783
- jtb = JsTreeBuilder.new(:sidebar, {src: s, hn: 2, debug: @debug})
784
- html = jtb.to_webpage
785
- doc = Rexle.new(html)
786
811
  html2 = Kramdown::Document.new(Martile.new(s, toc: false).to_html)\
787
812
  .to_html
788
813
  div = Rexle.new("<div class='main'>%s</div>" % html2)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: martile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  g0+rPDPUCWKVNHo7BG5zGRDcLsJO0QeIILy/AQaSAE3lQiHmC47nhsiBK0qNehWa
36
36
  47XiKvz0ZVCGgrz4GEb723WC
37
37
  -----END CERTIFICATE-----
38
- date: 2020-01-22 00:00:00.000000000 Z
38
+ date: 2020-02-29 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: yatoc
metadata.gz.sig CHANGED
Binary file