px_todo 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 99193dccfa5cb67c58c5971efd7b8b86e2eb78db
4
+ data.tar.gz: 0a0a61533151f5e1939dbe2bb1f26043eaf76538
5
+ SHA512:
6
+ metadata.gz: 9bbb9dbaa64f3a746a7a94b31f492df2026910e39bc4c1bf7058d7ddeb2265727bbe3991e410b1b740bb1ca76dc063967397378c28b9e3ac83c3e64627c06e20
7
+ data.tar.gz: 9495760cb75dce8376fa6fbc81447fd9d401b6c3671df5b11c2a3c374edaa79fbb9e1bdadd75794864a2f5db5236e1d8a12ad3c33e02e8ba299c52f1c72ec047
Binary file
Binary file
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: px_todo.rb
4
+
5
+
6
+ require 'polyrex-headings'
7
+ require 'pxrowx'
8
+
9
+
10
+ class PxTodo
11
+
12
+ def initialize(raw_s)
13
+
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
+
32
+ yield x if block_given?
33
+
34
+ todo = x.title
35
+ raw_status = todo.slice!(/\[.*\]\s+/)
36
+ x.title = todo
37
+
38
+ status = raw_status =~ /\[\s*x\s*\]/ ? 'done' : ''
39
+
40
+ x.status = status
41
+
42
+ # is there a note?
43
+
44
+ note = todo[/^note:\s+(.*)/i,1]
45
+
46
+ if note and parent.is_a? PolyrexObjects::Todo then
47
+
48
+ parent.note = note
49
+ x.delete
50
+
51
+ end
52
+
53
+ # is it a heading?
54
+
55
+ heading = todo[/^:(.*)/,1]
56
+
57
+ if heading then
58
+
59
+ # does the heading contain tags?
60
+
61
+ raw_tags = heading.slice!(/\s+#.*$/)
62
+ x.tags = raw_tags[/#\s+(.*)/,1] if raw_tags
63
+ x.heading = heading
64
+ x.title = ''
65
+
66
+ end
67
+
68
+ end
69
+
70
+ end
71
+
72
+
73
+ def to_px
74
+ @px
75
+ end
76
+
77
+
78
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: px_todo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE2MTEyNTIzMjQwN1oXDTE3MTEyNTIzMjQwN1owSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAN+gEqunXkUb92PaXXzIaCyzf82KhjP6OOTkh88q1IalYU8WNyxMrsPvbh/s
19
+ RlBcFwY4y4OGWgwNNNEzbh2xBwO+gDqjBj6BAVJC0rFatl4Ec7gHgwDxbGA0sSSJ
20
+ fuSt2L2on1e8SyhB5MY0PpH0/MppQbhViJKWJm0BA4K2fNSA89nYgcLOQw6irOnC
21
+ tdIdl5FCDcufAw3M+yM0Gh1LLdYDXiza14ig5V1fPXAQWwKsCDZDHjWUwO6qv2pW
22
+ hTo1lwDqQylyBk9wmoZIfGkNBxdItBmxwCzBVl2/h84rQsyLEiLXMVEPP+TyTdBE
23
+ 0r36uB2vyJo1jFEMC0Sillmy69MCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUinndXZxe0C9pAY8QOhcSpDrJorAwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEABzDzJ0mm
27
+ wGxU952mbMh543wsnbcuUsVqmuPhm7UB5WI3A3AB+4s+n/uFMEbzT8Mg7O3PWAGE
28
+ 6LI+RugZ3ricqbM5OUi0KnlBPMJ40C5USpgmyL80fqTHNwD4G455NkdJBHa225/h
29
+ VB8zru0el+tY16InIYfix+xrlmPFKlKcdE0eO6MLB8yT5ZQpAyUWnVlX6oHViY//
30
+ gD487hWKoRBan/KcKkp0z1ZgzlX8MjDVAc10x0TIYVsOtcTrlsyoBQJmzAm6NoqQ
31
+ P1gYYReHqUGXkUljinviQFod3s18BdV5MVytr/SoRtY/HxD6KiVOGI0ONjjXMJko
32
+ K1OGU0RnBiQMew==
33
+ -----END CERTIFICATE-----
34
+ date: 2016-11-25 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: pxrowx
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.1
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.1'
53
+ - - ">="
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
76
+ description:
77
+ email: james@r0bertson.co.uk
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/px_todo.rb
83
+ homepage: https://github.com/jrobertson/px_todo
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.5.1
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: px_todo
107
+ test_files: []
@@ -0,0 +1 @@
1
+ C3���r