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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/jstreebuilder.rb +6 -5
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d98bd80e6234230e2f745c0ad78c69f1b14eb6fcdff3ec46dd7624820857007
|
4
|
+
data.tar.gz: b413cc0342fac32216fa59ae114c60a6ff47bcb2d9d9b51e0ca9576c4e5cdf54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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.
|
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-
|
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
|