px_todo 0.1.2 → 0.1.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: b1110b48d6feb030373b1b1554d225c61adca043
4
- data.tar.gz: 68afd27b8dc9eb969fa5969ed66cbd54da380b9e
3
+ metadata.gz: d012bd660564ba9efa0b08f966445099555d032a
4
+ data.tar.gz: 26706f3949abaf6656a05a0698c1ef5ec005de85
5
5
  SHA512:
6
- metadata.gz: 35e4a5ef8a080133c767f60fb42131912c19bbdd71b6c376af6e4ac53eaf9da5aea0d0f07b30bb1dfd81ad8d2fa767a14bd03df78c840bee3211d790a3e49593
7
- data.tar.gz: 58f714246d556c663d82da6eaf14f91c79efc3b68ffe8b9db44d6bd40b40686b9ff42d23496c2b889ea00f12343161877665c98f0b73e0dcedeaba4017721b19
6
+ metadata.gz: 345eed5248759856aa00f2b41ac800f0bc519a8a63dc55ca9b4a93d5e138ba0092f95133ed7e619db3984f7b7f6ab520fe0fb10f4b33f73bdb30fd4aa9a7c18d
7
+ data.tar.gz: d28824ce8870a78ef84a87412452cb341b8603a5a289be6766f532ea421bb13a8349727c49dd1d88aca094167d9ec20ab430a25a009cdd29123c988bd8e3e6b9
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -9,7 +9,7 @@ require 'pxrowx'
9
9
 
10
10
  class PxTodo
11
11
 
12
- def initialize(raw_s, filepath: '.')
12
+ def initialize(raw_s, filepath: '.', ignore_headings: false, &blk)
13
13
 
14
14
  Dir.chdir filepath
15
15
  s, type = RXFHelper.read(raw_s)
@@ -17,7 +17,11 @@ class PxTodo
17
17
  @filepath = filepath
18
18
  @filepath = File.dirname(raw_s) if type == :file and filepath == '.'
19
19
 
20
- s =~ /<?xml/ ? load_px(s) : import_txt(s)
20
+ @fields = %w( title heading when duration priority status note tags)
21
+
22
+ s.gsub!(/^#.*/,'') if ignore_headings
23
+
24
+ s =~ /<?xml/ ? load_px(s) : import_txt(s, &blk)
21
25
 
22
26
  end
23
27
 
@@ -28,13 +32,12 @@ class PxTodo
28
32
 
29
33
  private
30
34
 
31
- def import_txt()
35
+ def import_txt(s, &blk)
32
36
 
33
37
  # remove the file heading
34
38
  lines = s.lines
35
39
  lines.shift 3
36
40
 
37
- @fields = %w( title heading when duration priority status note tags)
38
41
  declar = "<?ph schema='items[title]/todo[#{@fields.join(',')}]'" +
39
42
  " format_masks[0]='[!title]'?>"
40
43
 
@@ -46,7 +49,7 @@ class PxTodo
46
49
 
47
50
  @px.each_recursive do |x, parent, level|
48
51
 
49
- yield x if block_given?
52
+ blk.call x if block_given?
50
53
 
51
54
  todo = x.title
52
55
  raw_status = todo.slice!(/\[.*\]\s+/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: px_todo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  P1gYYReHqUGXkUljinviQFod3s18BdV5MVytr/SoRtY/HxD6KiVOGI0ONjjXMJko
32
32
  K1OGU0RnBiQMew==
33
33
  -----END CERTIFICATE-----
34
- date: 2016-11-26 00:00:00.000000000 Z
34
+ date: 2016-11-29 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: pxrowx
metadata.gz.sig CHANGED
Binary file