myoutline 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: 5c4004c2ecb1afce40d2b3aa042578578bebba47
4
- data.tar.gz: 0b56c3f9048ca5d40819ed1d96e795f854da0cb9
3
+ metadata.gz: fdaac78cb5087754de66fe05c22dd070d6cdb9f7
4
+ data.tar.gz: a62c01bd4784c867d40538c68683c41129c545a3
5
5
  SHA512:
6
- metadata.gz: f6c0f793663fe9d98428f9e460347903031edbddde7731aa7f077aae511a1b8ff58f4407bce6930af2404d69ec06ba4de73d09a8b10a62317317d67e81e48d05
7
- data.tar.gz: 5aac295a3314a04544c26dae80f9e5d5dc3acec2952234f69278da81b80d43ddd53ad92f67415c810238abbc6afe99a38bb246cd6bc5b3c0b5180b380569bee4
6
+ metadata.gz: 21906e0f2104bb483a7bac41235b2a91597cefd49a553ccd09a25a863db05bbaf40b3f89e2e5842aa271d0bc3078dc696281b198393c0870da27eba9911e395b
7
+ data.tar.gz: cf931109ea97b3c9fb92793693e6292b3164fa9b725592edbfb965d3b25a7624de46a9958cf9e6acbbd4d4dd1827b213ef6f32e2d97bcba76a1736537868f953
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/myoutline.rb CHANGED
@@ -14,11 +14,12 @@ class MyOutline
14
14
  attr_reader :pxi, :links
15
15
  attr_accessor :md
16
16
 
17
- def initialize(source, debug: false, allsorted: true,
18
- autoupdate: true, topic_url: '$topic', md_path: '.')
17
+ def initialize(source, debug: false, allsorted: true, autoupdate: true,
18
+ topic_url: '$topic', md_path: '.', default_md: 'main.md')
19
19
 
20
20
  @debug, @source, @topic_url = debug, source, topic_url
21
21
  @allsorted, @autoupdate, @md_path = allsorted, autoupdate, md_path
22
+ @default_md = default_md
22
23
 
23
24
  raw_s, _ = RXFHelper.read(source)
24
25
  build_index(raw_s)
@@ -27,11 +28,13 @@ class MyOutline
27
28
 
28
29
  def fetch(uri)
29
30
 
30
- s, remaining = @links.locate uri
31
+ s, remaining = @links.locate(uri)
31
32
  puts 'fetch() s: ' + s.inspect if @debug
32
33
  redirect = s =~ /^\[r\] +/i
33
34
  return s if redirect
34
35
 
36
+ s ||= @default_md; remaining ||= ''
37
+
35
38
  f = File.join(@md_path, s)
36
39
  puts 'f: ' + f.inspect if @debug
37
40
  @md = MdEdit.new f, debug: @debug
@@ -122,28 +125,11 @@ class MyOutline
122
125
 
123
126
  private
124
127
 
125
- def build_index(raw_s)
126
-
127
- # find the entries which aren't on the main index
128
- s = raw_s.sub(/<[^>]+>\n/,'')
129
- doc = LineTree.new(s, debug: @debug).to_doc(encapsulate: true)
130
- a = doc.root.xpath('entry/text()')
131
- puts 'doc: ' + doc.xml if @debug
132
- a2 = doc.root.xpath('entry//entry/text()')
133
- puts 'a2: ' + a2.inspect if @debug
134
- a3 = a2 - a
135
- puts 'a3:' + a3.inspect if @debug
128
+ def build_index(s)
136
129
 
137
- # add the new entries to the main index
138
- s << "\n" + a3.join("\n")
139
-
140
- s.prepend '<?ph schema="entries/section[heading]/entry[title, url]"?>
141
-
142
- '
143
-
144
- @pxi = PxIndex.new(s, debug: @debug, indexsorted: true,
145
- allsorted: @allsorted)
146
- save() if @autoupdate and self.to_s != raw_s
130
+ @pxi = PxIndex.new(debug: @debug, indexsorted: true, allsorted: @allsorted)
131
+ @pxi.import s
132
+ save() if @autoupdate and self.to_s != s
147
133
  read(self.to_treelinks)
148
134
  end
149
135
 
@@ -182,10 +168,12 @@ class MyOutline
182
168
  end
183
169
 
184
170
  def read(s)
171
+
185
172
  @links = PolyrexLinks.new.import(s, debug: @debug)
186
173
 
187
174
  s3 = s.lines.map {|x| x.split(/ | # /,2)[0]}.join("\n")
188
175
  @ftx = FileTreeXML.new(s3, debug: @debug)
176
+
189
177
  end
190
178
 
191
179
  def xslt()
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.4.2
4
+ version: 0.4.3
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-10 00:00:00.000000000 Z
33
+ date: 2018-04-14 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: pxindex
@@ -38,20 +38,20 @@ dependencies:
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.1'
41
+ version: '0.2'
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 0.1.6
44
+ version: 0.2.0
45
45
  type: :runtime
46
46
  prerelease: false
47
47
  version_requirements: !ruby/object:Gem::Requirement
48
48
  requirements:
49
49
  - - "~>"
50
50
  - !ruby/object:Gem::Version
51
- version: '0.1'
51
+ version: '0.2'
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.1.6
54
+ version: 0.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,20 +98,20 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.2'
101
+ version: '0.3'
102
102
  - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 0.2.0
104
+ version: 0.3.0
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - "~>"
110
110
  - !ruby/object:Gem::Version
111
- version: '0.2'
111
+ version: '0.3'
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: 0.2.0
114
+ version: 0.3.0
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: md_edit
117
117
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file