jstreebuilder 0.2.1 → 0.2.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: d776f9c33266197c777807bd162beb3c2415b82686fe2fa8c1a8a2ba4d33dfab
4
- data.tar.gz: b2df7d91ba2d3365089f952ec7817183e194c2c62ed9b706acbc1ca2fa1fcea2
3
+ metadata.gz: 6d98bd80e6234230e2f745c0ad78c69f1b14eb6fcdff3ec46dd7624820857007
4
+ data.tar.gz: b413cc0342fac32216fa59ae114c60a6ff47bcb2d9d9b51e0ca9576c4e5cdf54
5
5
  SHA512:
6
- metadata.gz: 45ee0172a25404b048847b43a6c61ecb2ed8f568c7c79ca2949864c68a80a34a1b3b45b487467b2537f4c4b3ee5cb2dd6dcba6aa6bafddcb86bd74e891e1ac32
7
- data.tar.gz: 7e64e35b0fbfdbc91769b45698f305adbea9acd115f0e09ecc53543f728d740b81a51618c6bc4ce172d2f953ff9e2f5a03ac159658a329c2c8a18abb121118e2
6
+ metadata.gz: adf2c9e30dd6374771d174ff20be78b929eb4f85dfab11471ff59dd6eccb41f3f0160078408143727c70041d73b9ef8488c741ab983992f57a94aaf312938280
7
+ data.tar.gz: dc30a735714154486fd7a9bdf99db6350c1c634f32e709a96b52cf373cb4f494bc4e74e7269595656705f5c262a8168c6393327b048be3800dbd03a039f3caad
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/jstreebuilder.rb CHANGED
@@ -8,6 +8,7 @@ require 'polyrex'
8
8
  require 'kramdown'
9
9
 
10
10
 
11
+
11
12
  XSLT = %q[
12
13
  <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
13
14
  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
@@ -176,9 +177,9 @@ SIDEBAR_JS = TREE_JS
176
177
 
177
178
  attr_reader :to_tree
178
179
 
179
- def initialize(s, debug: false)
180
+ def initialize(s, hn: 1, debug: false)
180
181
 
181
- @debug = debug
182
+ @debug, @hn = debug, hn
182
183
  html = Kramdown::Document.new(s).to_html
183
184
  puts ('html: ' + html.inspect) if @debug
184
185
  a = scan_headings(html)
@@ -204,7 +205,7 @@ SIDEBAR_JS = TREE_JS
204
205
 
205
206
  end
206
207
 
207
- def make_tree(a, indent=0, hn=1)
208
+ def make_tree(a, indent=0, hn=@hn)
208
209
 
209
210
  if @debug then
210
211
  puts 'inside make_tree'.debug
@@ -235,7 +236,7 @@ SIDEBAR_JS = TREE_JS
235
236
 
236
237
  end
237
238
 
238
- def scan_headings(s, n=1)
239
+ def scan_headings(s, n=@hn)
239
240
 
240
241
  s.split(/(?=<h#{n})/).map do |x|
241
242
  x.include?('<h' + (n+1).to_s) ? scan_headings(x, n+1) : x
@@ -353,7 +354,7 @@ SIDEBAR_JS = TREE_JS
353
354
  elsif src =~ /<?polyrex /
354
355
  src
355
356
  else
356
- build_px(TreeBuilder.new(src, debug: @debug).to_tree)
357
+ build_px(TreeBuilder.new(src, hn: opt[:hn],debug: @debug).to_tree)
357
358
  end
358
359
 
359
360
  puts ('s: ' + s.inspect).debug if @debug
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstreebuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  /YHvF368/KpwUw6rBLVUbFvCsNvDTe+bPAG72P5om2g/aope7mb9Qc4kATQgWiys
36
36
  rqRI7UAQ3N9ojGSXl6KSySfi
37
37
  -----END CERTIFICATE-----
38
- date: 2019-09-15 00:00:00.000000000 Z
38
+ date: 2019-09-16 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: nokogiri
metadata.gz.sig CHANGED
Binary file