all_todo 0.2.7 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be4a51e17ba0e8cf577d2a4a6284d2460b0bea29
4
- data.tar.gz: f1dd42b11c02e74ecd70008cbc929c998c90a23d
3
+ metadata.gz: 6ae9fa558817270e13da79097c64869fdf0e8ce9
4
+ data.tar.gz: 1047951a506bc904e0c47b9c3f2404cf13e54895
5
5
  SHA512:
6
- metadata.gz: a2918f0da7f1f273bcade231fef4a204e870384190c289d83f0a127a5de6f7678b41c29cfde014e5511ba547795e14d23ec988e1e7d2c26f8780db5a4f400e8d
7
- data.tar.gz: 29575f7ebf7b2eb8be7871a9679e4e2e7301e86f8ba7eefb95c41a5c58da9fc82f7adc116f82a330ef85db81e3c0cd92eb25c2d95e315ffe6f8c5a2162ab5c87
6
+ metadata.gz: 54f9f728559e75e1067426e53917e0f0fa38baa6e6c949034cfffa060b573897275da6f240a3af9b560c02460f3d200451d36139ef8cba52c6b3ae324eca8c2b
7
+ data.tar.gz: e0f65ef5b8cfe3f32388f073d7cbaf7638b910f010a3e3ef90276edd88a20ff895bb2fdcbf0572fa873cd669ad3320eb3cb83f07239639af3688488b6d66cb27
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/all_todo.rb CHANGED
@@ -3,71 +3,22 @@
3
3
  # file: all_todo.rb
4
4
 
5
5
 
6
- require 'pxrowx'
7
- require 'polyrex-headings'
6
+ require 'px_todo'
8
7
 
9
8
 
10
- class AllTodo
9
+ class AllTodo < PxTodo
11
10
 
12
11
  def initialize(raw_s)
13
12
 
14
- s, _ = RXFHelper.read(raw_s)
15
-
16
- # remove the file heading
17
- lines = s.lines
18
- lines.shift 3
19
-
20
- @fields = %w( title heading when duration priority status note tags)
21
- declar = "<?ph schema='items[title]/todo[#{@fields.join(',')}]'" +
22
- " format_masks[0]='[!title]'?>"
23
-
24
- # add a marker to identify the headings after parsing the records
25
-
26
- s2 = lines.join.gsub(/^#+\s+/,'\0:')
27
-
28
- @px = PolyrexHeadings.new(declar + "\n" + s2).to_polyrex
29
-
30
- @px.each_recursive do |x, parent, level|
31
-
13
+ super(raw_s) do |x|
14
+
32
15
  todo = x.title
33
16
 
34
17
  # is the to-do item selected for action today?
35
- today_item = todo.slice!(/^\*\s+/)
36
-
18
+ today_item = todo.slice!(/^\*\s+/)
37
19
  x.when = 'today' if today_item
38
-
39
- raw_status = todo.slice!(/\[.*\]\s+/)
40
- x.title = todo
41
-
42
- status = raw_status =~ /\[\s*x\s*\]/ ? 'done' : ''
43
-
44
- x.status = status
45
-
46
- # is there a note?
47
20
 
48
- note = todo[/^note:\s+(.*)/i,1]
49
-
50
- if note and parent.is_a? PolyrexObjects::Todo then
51
-
52
- parent.note = note
53
- x.delete
54
-
55
- end
56
-
57
- # is it a heading?
58
-
59
- heading = todo[/^:(.*)/,1]
60
-
61
- if heading then
62
-
63
- # does the heading contain tags?
64
-
65
- raw_tags = heading.slice!(/\s+#.*$/)
66
- x.tags = raw_tags[/#\s+(.*)/,1] if raw_tags
67
- x.heading = heading
68
- x.title = ''
69
-
70
- end
21
+ x.title = todo
71
22
 
72
23
  end
73
24
 
@@ -99,9 +50,6 @@ class AllTodo
99
50
 
100
51
  end
101
52
 
102
- def to_px
103
- @px
104
- end
105
53
 
106
54
  def to_s()
107
55
 
@@ -180,11 +128,9 @@ class AllTodo
180
128
  [a, todo_lines.join("\n")]
181
129
  end
182
130
 
183
- lines = []
184
-
185
- raw_rows.group_by(&:first).each do |heading, items|
186
- lines << heading.join("\n") << ''
187
- lines << items.map{|x| x[1..-1]}.join("\n") << ''
131
+ lines = raw_rows.group_by(&:first).inject([]) do |r, pair|
132
+ heading, items = pair
133
+ r << heading.join("\n") << '' << items.map{|x| x[1..-1]}.join("\n") << ''
188
134
  end
189
135
 
190
136
  filename = 'todo_daily.txt'
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: all_todo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -34,7 +34,7 @@ cert_chain:
34
34
  date: 2016-11-25 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: pxrowx
37
+ name: all_todo
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '0.1'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.1.1
45
+ version: 0.1.0
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,27 +52,7 @@ dependencies:
52
52
  version: '0.1'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.1.1
56
- - !ruby/object:Gem::Dependency
57
- name: polyrex-headings
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.1'
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: 0.1.5
66
- type: :runtime
67
- prerelease: false
68
- version_requirements: !ruby/object:Gem::Requirement
69
- requirements:
70
- - - "~>"
71
- - !ruby/object:Gem::Version
72
- version: '0.1'
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: 0.1.5
55
+ version: 0.1.0
76
56
  description:
77
57
  email: james@r0bertson.co.uk
78
58
  executables: []
metadata.gz.sig CHANGED
Binary file