all_todo 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/all_todo.rb +62 -10
- data.tar.gz.sig +0 -0
- metadata +2 -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: d80cbe5c128f3320c9bb8f0626627cf5cff1d501
|
4
|
+
data.tar.gz: 37ec15daf411af4ee593fc1407b6489a70dd34d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f74d0642869b6fc178369cf45bd2820755c51aa49c54dba964cc68cb8668a162aa4ba1d9103016f581b5e5d48021a4b0cdc4f3730545537e7211468796412dc2
|
7
|
+
data.tar.gz: 571c487ea51d45c9c42ab65da719acf29bc70b75fed915d6679e22f3ce2c9f990109b7718109ed58e92a38ea93f5d088c70242a119b1fc4f6104be50b17e181f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/all_todo.rb
CHANGED
@@ -17,9 +17,9 @@ class AllTodo
|
|
17
17
|
lines = s.lines
|
18
18
|
lines.shift 3
|
19
19
|
|
20
|
-
@fields = %w(
|
21
|
-
declar = "<?ph schema='
|
22
|
-
" format_masks[0]='[!
|
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
23
|
|
24
24
|
# add a marker to identify the headings after parsing the records
|
25
25
|
|
@@ -29,19 +29,25 @@ class AllTodo
|
|
29
29
|
|
30
30
|
@px.each_recursive do |x, parent, level|
|
31
31
|
|
32
|
-
todo = x.
|
32
|
+
todo = x.title
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
# is the to-do item selected for action today?
|
35
|
+
today_item = todo.slice!(/^\*\s+/)
|
36
36
|
|
37
|
+
x.when = 'today' if today_item
|
38
|
+
|
39
|
+
raw_status = todo.slice!(/\[.*\]\s+/)
|
40
|
+
x.title = todo
|
41
|
+
|
37
42
|
status = raw_status =~ /\[\s*x\s*\]/ ? 'done' : ''
|
43
|
+
|
38
44
|
x.status = status
|
39
45
|
|
40
46
|
# is there a note?
|
41
47
|
|
42
48
|
note = todo[/^note:\s+(.*)/i,1]
|
43
49
|
|
44
|
-
if note and parent.is_a? PolyrexObjects::
|
50
|
+
if note and parent.is_a? PolyrexObjects::Todo then
|
45
51
|
|
46
52
|
parent.note = note
|
47
53
|
x.delete
|
@@ -59,7 +65,7 @@ class AllTodo
|
|
59
65
|
raw_tags = heading.slice!(/\s+#.*$/)
|
60
66
|
x.tags = raw_tags[/#\s+(.*)/,1] if raw_tags
|
61
67
|
x.heading = heading
|
62
|
-
x.
|
68
|
+
x.title = ''
|
63
69
|
|
64
70
|
end
|
65
71
|
|
@@ -121,9 +127,13 @@ class AllTodo
|
|
121
127
|
indent = ' ' * relative_level
|
122
128
|
|
123
129
|
status = x.status == 'done' ? 'x' : ' '
|
124
|
-
|
130
|
+
|
131
|
+
todo = []
|
132
|
+
todo << '* ' if x.when == 'today'
|
133
|
+
todo << "%s[%s] %s" % [indent, status, x.title]
|
134
|
+
|
125
135
|
lines << '' if i == 0 and parent.heading.length > 0
|
126
|
-
lines << todo
|
136
|
+
lines << todo.join
|
127
137
|
|
128
138
|
lines << "%s Note: %s\n" % [indent, x.note] if x.note.length > 0
|
129
139
|
|
@@ -138,5 +148,47 @@ class AllTodo
|
|
138
148
|
([title, '=' * title.length] + lines[1..-1]).join("\n")
|
139
149
|
|
140
150
|
end
|
151
|
+
|
152
|
+
# prints out the to-do list for today
|
153
|
+
|
154
|
+
def today(day='today')
|
155
|
+
|
156
|
+
px = @px
|
157
|
+
|
158
|
+
raw_rows = px.find_all_by_todo_when(day).map do |x|
|
159
|
+
|
160
|
+
headings = fetch_heading(x.parent)
|
161
|
+
|
162
|
+
# print the headings
|
163
|
+
|
164
|
+
a = headings.reverse.map.with_index do |s, i|
|
165
|
+
"%s %s" % ['#'* (i+1), s]
|
166
|
+
end
|
167
|
+
|
168
|
+
status = x.status == 'done' ? 'x' : ' '
|
169
|
+
[a, "[%s] %s" % [status, x.title]]
|
170
|
+
end
|
171
|
+
|
172
|
+
h = raw_rows.group_by(&:first)
|
173
|
+
|
174
|
+
lines = []
|
175
|
+
|
176
|
+
h.each do |heading, items|
|
177
|
+
lines << heading.join("\n") << ''
|
178
|
+
lines << items.map{|x| x[1..-1]}.join("\n") << ''
|
179
|
+
end
|
180
|
+
|
181
|
+
filename = 'todo_daily.txt'
|
182
|
+
([filename, '=' * filename.length, ''] + lines).join("\n")
|
183
|
+
|
184
|
+
end
|
185
|
+
|
186
|
+
private
|
187
|
+
|
188
|
+
def fetch_heading(item, a=[])
|
189
|
+
a << item.heading
|
190
|
+
a.concat fetch_heading(item.parent) if item.parent?
|
191
|
+
a
|
192
|
+
end
|
141
193
|
|
142
194
|
end
|
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.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
4IWTpx4UfuUB+a/n3zRd7tPzfsCnbjv0WeNaOLxPEdrqrbPxdMp0ULnHMi6/cuMX
|
32
32
|
+/4csIEIHj2yLg==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2016-11-
|
34
|
+
date: 2016-11-25 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: pxrowx
|
metadata.gz.sig
CHANGED
Binary file
|