myoutline 0.3.0 → 0.4.0
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.tar.gz.sig +2 -3
- data/lib/myoutline.rb +38 -9
- metadata +22 -2
- 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: 673d85955a44ce5b87bc00ace320cffe34309ac2
|
4
|
+
data.tar.gz: 89674e1803c93ee86d38b3ef44c050d1f84962b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9e8dd4d50e69575cee9717793b7e43172f4e27487902edd43a3462e102b5b317cb88f5ea8bc4288f3f877cd2be94e31aed6e4aba5d4e86a5f60d679442f6570
|
7
|
+
data.tar.gz: 285c8343fb4a2ddae26a3fbf100c12f5121c43da0f3acfd223a15ab233f8658c0e8dc14204114b6aa79157de0ba48934ed5cad7dd436f4bb440d57e383ca4dd4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
��gu#
|
1
|
+
�0�1�3�K��8�C��Ȍ`�\^ W>C>3�/̍��/q �y~������+�G�.0�գQ3~��>rΰ> `�Wfm�(C2�kւ���mY��]��%v� T�i����]\�T҂ĝ~s���~��A��Et� POC?�F�T`�b.@�k��\�2T(yP�R�ѻt�������w
|
2
|
+
52 Xב�����
|
data/lib/myoutline.rb
CHANGED
@@ -6,23 +6,24 @@ require 'pxindex'
|
|
6
6
|
require 'nokogiri'
|
7
7
|
require 'filetree_xml'
|
8
8
|
require 'polyrex-links'
|
9
|
+
require 'md_edit'
|
9
10
|
|
10
11
|
|
11
12
|
|
12
13
|
class MyOutline
|
13
14
|
|
14
15
|
attr_reader :pxi, :links
|
16
|
+
attr_accessor :md
|
15
17
|
|
16
18
|
def initialize(source, debug: false, allsorted: true,
|
17
|
-
autoupdate: true, topic_url: '$topic')
|
19
|
+
autoupdate: true, topic_url: '$topic', md_path: '.')
|
18
20
|
|
19
|
-
@debug, @source, @topic_url
|
20
|
-
|
21
|
+
@debug, @source, @topic_url = debug, source, topic_url
|
22
|
+
@allsorted, @autoupdate, @md_path = allsorted, autoupdate, md_path
|
21
23
|
|
22
24
|
raw_s, _ = RXFHelper.read(source)
|
23
25
|
build_index(raw_s)
|
24
26
|
|
25
|
-
|
26
27
|
end
|
27
28
|
|
28
29
|
def fetch(uri)
|
@@ -32,16 +33,25 @@ class MyOutline
|
|
32
33
|
redirect = s =~ /^\[r\] +/i
|
33
34
|
return s if redirect
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
f = File.join(@md_path, s)
|
37
|
+
puts 'f: ' + f.inspect if @debug
|
38
|
+
@md = MdEdit.new f, debug: @debug
|
39
|
+
r = edit(remaining.sub(/^\//,'').gsub(/\//,' > '))
|
40
|
+
puts 'r: ' + r.inspect if @debug
|
41
|
+
@md.update r
|
37
42
|
|
38
|
-
|
39
|
-
end
|
43
|
+
r
|
44
|
+
end
|
45
|
+
|
40
46
|
|
41
47
|
def ls(path='.')
|
42
48
|
@ftx.ls(path).map(&:to_s)
|
43
49
|
end
|
44
50
|
|
51
|
+
def update(section)
|
52
|
+
@md.update section
|
53
|
+
end
|
54
|
+
|
45
55
|
def save(filename=nil)
|
46
56
|
|
47
57
|
if filename.nil? then
|
@@ -131,9 +141,28 @@ class MyOutline
|
|
131
141
|
@pxi = PxIndex.new(s, debug: @debug, indexsorted: true,
|
132
142
|
allsorted: @allsorted)
|
133
143
|
save() if @autoupdate and self.to_s != raw_s
|
134
|
-
read(self.
|
144
|
+
read(self.to_treelinks)
|
135
145
|
end
|
136
146
|
|
147
|
+
def edit(s)
|
148
|
+
|
149
|
+
r = @md.find s
|
150
|
+
return r if r
|
151
|
+
|
152
|
+
a = s.split(/ *> */)
|
153
|
+
|
154
|
+
if a.length > 1 then
|
155
|
+
|
156
|
+
heading = a.pop.capitalize
|
157
|
+
r2 = edit(a.join(' > '))
|
158
|
+
n = r2.scan(/^#+/).last.length
|
159
|
+
|
160
|
+
r2 + ("\n%s %s\n" % [('#' * (n+1)), heading])
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
137
166
|
def format_tree(alphabet: false, nourl: false)
|
138
167
|
|
139
168
|
a = @pxi.to_s.lines
|
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.
|
4
|
+
version: 0.4.0
|
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-04-
|
33
|
+
date: 2018-04-04 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: pxindex
|
@@ -112,6 +112,26 @@ dependencies:
|
|
112
112
|
- - ">="
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: 0.2.0
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: md_edit
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0.2'
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.2.5
|
125
|
+
type: :runtime
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.2'
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: 0.2.5
|
115
135
|
description:
|
116
136
|
email: james@jamesrobertson.eu
|
117
137
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|