myoutline 0.1.1 → 0.1.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/myoutline.rb +35 -6
- data.tar.gz.sig +0 -0
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bba6a21b45a42f6e257c31fef82d4ab2a20803fb
|
4
|
+
data.tar.gz: 2d7add1ea6c98c095fcd353ed45dabdcfddcdbe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d09c61a8fa9570988404c147695a6949fb0d5364d33d3773bf0714a87cf5a1330293061e1c8bd79074a8d793262e52a91e2b26ea810013b59bc0890aba5a187
|
7
|
+
data.tar.gz: 3a3284c309886933e13b64dffa28c3c823fdc3c27b0debd08b35e203e447bb927b24112def5c3a60b6a2c5b7ddce605098d6015902d255d71ea7dcf7838c3b52
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/myoutline.rb
CHANGED
@@ -7,14 +7,21 @@ require 'pxindex'
|
|
7
7
|
|
8
8
|
class MyOutline
|
9
9
|
|
10
|
-
def initialize(
|
10
|
+
def initialize(source, debug: false, allsorted: true, autoupdate: true)
|
11
|
+
|
12
|
+
@debug, @source = debug, source
|
11
13
|
|
14
|
+
raw_s, _ = RXFHelper.read(source)
|
15
|
+
|
12
16
|
# find the entries which aren't on the main index
|
13
17
|
s = raw_s.sub(/<[^>]+>\n/,'')
|
14
18
|
doc = LineTree.new(s, debug: true).to_doc(encapsulate: true)
|
15
19
|
a = doc.root.xpath('entry/text()')
|
20
|
+
puts 'doc: ' + doc.xml if debug
|
16
21
|
a2 = doc.root.xpath('entry//entry/text()')
|
22
|
+
puts 'a2: ' + a2.inspect if debug
|
17
23
|
a3 = a2 - a
|
24
|
+
puts 'a3:' + a3.inspect if debug
|
18
25
|
|
19
26
|
# add the new entries to the main index
|
20
27
|
s << a3.join("\n")
|
@@ -25,16 +32,38 @@ class MyOutline
|
|
25
32
|
|
26
33
|
@pxi = PxIndex.new(s, debug: debug, indexsorted: true,
|
27
34
|
allsorted: allsorted)
|
28
|
-
|
35
|
+
save() if autoupdate and self.to_s != raw_s
|
29
36
|
|
30
37
|
end
|
31
38
|
|
32
|
-
def save(filename=
|
33
|
-
|
39
|
+
def save(filename=nil)
|
40
|
+
|
41
|
+
if filename.nil? then
|
42
|
+
filename = RXFHelper.writeable?(@source) ? @source : 'myoutline.txt'
|
43
|
+
end
|
44
|
+
|
45
|
+
RXFHelper.write filename, self.to_s
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def to_s(declaration: true)
|
50
|
+
|
51
|
+
if declaration == true then
|
52
|
+
@pxi.to_s.sub(/(?<=^\<\?)([^\?]+)/,'myoutline')
|
53
|
+
else
|
54
|
+
@pxi.to_s.lines[1..-1].join.lstrip
|
55
|
+
end
|
56
|
+
|
34
57
|
end
|
35
58
|
|
36
|
-
def
|
37
|
-
|
59
|
+
def to_tree
|
60
|
+
|
61
|
+
a = @pxi.to_s.lines
|
62
|
+
a.shift # remove the ph declaration
|
63
|
+
a.reject! {|x| x =~ /^(?:#[^\n]+|\n+)$/}
|
64
|
+
|
65
|
+
a.join
|
66
|
+
|
38
67
|
end
|
39
68
|
|
40
69
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myoutline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
DFhc5TDtqEkJYiaiznQFl34HUKeCAdeAHkmD8jP3fUC8O7zcLXq69EAXGMXw4efB
|
31
31
|
3Co=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2018-03-
|
33
|
+
date: 2018-03-18 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: pxindex
|
@@ -41,7 +41,7 @@ dependencies:
|
|
41
41
|
version: '0.1'
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.1.
|
44
|
+
version: 0.1.6
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
47
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,7 +51,7 @@ dependencies:
|
|
51
51
|
version: '0.1'
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.1.
|
54
|
+
version: 0.1.6
|
55
55
|
description:
|
56
56
|
email: james@jamesrobertson.eu
|
57
57
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|