markdo 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +7 -3
- data/Rakefile +8 -0
- data/lib/markdo/add_command.rb +6 -2
- data/lib/markdo/cli.rb +3 -0
- data/lib/markdo/help_command.rb +2 -1
- data/lib/markdo/rss_command.rb +69 -0
- data/lib/markdo/version.rb +1 -1
- data/test/fixtures/rss_command.md +4 -0
- data/test/rss_command_test.rb +35 -0
- data/test/test_helper.rb +2 -0
- metadata +30 -20
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0d0923b1a531a4f5bfb3ef56d910acd10d040775
|
4
|
+
data.tar.gz: 7574cc21bd5bb6c1336937208554e12829ac03a4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1db599021903ea12d49af92b0d48dd55746e1cdc269b35b8ecd8a27a6d2262761d7776eaaa3af39fabf60cb9bb9ed36f6da806a31164c9fdf621bd9d5e0f826a
|
7
|
+
data.tar.gz: 5d4c29e9822778ed2d6a4662b4b76a2c9f2c3e2375e705da4a683c97a4eac032de9b1ac4ff99632ff9117bee7d81c1d52963d39a46e3aeed6b080db9be37dac5
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Markdo
|
2
2
|
|
3
|
-
Markdown-based task manager. Inspired by OmniFocus and GitHub Flavored Markdown's task lists.
|
3
|
+
Markdown-based task manager. Inspired by [OmniFocus][omnifocus], [TaskPaper][taskpaper], and [GitHub Flavored Markdown's task lists][gfm-task-lists].
|
4
|
+
|
5
|
+
[gfm-task-lists]: https://github.com/blog/1375-task-lists-in-gfm-issues-pulls-comments
|
6
|
+
[omnifocus]: https://www.omnigroup.com/omnifocus/
|
7
|
+
[taskpaper]: http://www.hogbaysoftware.com/products/taskpaper
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -41,9 +45,9 @@ See `markdo help` for more information.
|
|
41
45
|
add "string" Add a task to the inbox. (Set $MARKDO_ROOT and $MARKDO_INBOX.)
|
42
46
|
edit Edit $MARKDO_ROOT in $EDITOR.
|
43
47
|
help, --help Display this help text.
|
44
|
-
overview Get overview of starred, today's, and tomorrow's tasks.
|
48
|
+
overview Get overview of overdue, starred, today's, and tomorrow's tasks.
|
45
49
|
overdue Search *.md files for previous dates. (YYYY-MM-DD format.)
|
46
|
-
tag "string
|
50
|
+
tag "string" Search *.md files for @string.
|
47
51
|
today Search *.md files for today's date. (YYYY-MM-DD format.)
|
48
52
|
tomorrow Search *.md files for tomorrow's date. (YYYY-MM-DD format.)
|
49
53
|
star, starred Search *.md files for @star.
|
data/Rakefile
CHANGED
data/lib/markdo/add_command.rb
CHANGED
@@ -3,8 +3,12 @@ require 'markdo/command'
|
|
3
3
|
module Markdo
|
4
4
|
class AddCommand < Command
|
5
5
|
def run(task)
|
6
|
-
|
7
|
-
|
6
|
+
task = String(task)
|
7
|
+
|
8
|
+
unless task.strip.empty?
|
9
|
+
File.open(inbox_path, 'a') do |file|
|
10
|
+
file.puts(template(task))
|
11
|
+
end
|
8
12
|
end
|
9
13
|
end
|
10
14
|
|
data/lib/markdo/cli.rb
CHANGED
@@ -3,6 +3,7 @@ require 'markdo/edit_command'
|
|
3
3
|
require 'markdo/help_command'
|
4
4
|
require 'markdo/overview_command'
|
5
5
|
require 'markdo/query_command'
|
6
|
+
require 'markdo/rss_command'
|
6
7
|
require 'markdo/star_command'
|
7
8
|
require 'markdo/tag_command'
|
8
9
|
require 'markdo/today_command'
|
@@ -29,6 +30,8 @@ module Markdo
|
|
29
30
|
OverviewCommand
|
30
31
|
when 'query', 'q'
|
31
32
|
QueryCommand
|
33
|
+
when 'rss'
|
34
|
+
RssCommand
|
32
35
|
when 'star', 'starred'
|
33
36
|
StarCommand
|
34
37
|
when 'tag'
|
data/lib/markdo/help_command.rb
CHANGED
@@ -11,9 +11,10 @@ Markdown-based task manager.
|
|
11
11
|
help, --help Display this help text.
|
12
12
|
overview Get overview of overdue, starred, today's, and tomorrow's tasks.
|
13
13
|
overdue Search *.md files for previous dates. (YYYY-MM-DD format.)
|
14
|
-
tag "string
|
14
|
+
tag "string" Search *.md files for @string.
|
15
15
|
today Search *.md files for today's date. (YYYY-MM-DD format.)
|
16
16
|
tomorrow Search *.md files for tomorrow's date. (YYYY-MM-DD format.)
|
17
|
+
rss Make an RSS feed of all links in Markdo. Useful as a live bookmark.
|
17
18
|
star, starred Search *.md files for @star.
|
18
19
|
query, q "string" Search *.md files for string.
|
19
20
|
version, --version Display the version.
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'markdo/command'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module Markdo
|
5
|
+
class RssCommand < Command
|
6
|
+
def run
|
7
|
+
items = Dir.
|
8
|
+
glob(markdown_glob).
|
9
|
+
map { |path| File.readlines(path, encoding: 'UTF-8') }.
|
10
|
+
flatten.
|
11
|
+
grep(%r(https?://)).
|
12
|
+
map { |line| Item.new(title: clean(line), links: URI.extract(line)) }
|
13
|
+
|
14
|
+
xml = template(items)
|
15
|
+
|
16
|
+
@stdout.puts(xml)
|
17
|
+
end
|
18
|
+
|
19
|
+
protected
|
20
|
+
|
21
|
+
class Item
|
22
|
+
attr_reader :title, :links
|
23
|
+
|
24
|
+
def initialize(kwargs)
|
25
|
+
@title = kwargs[:title]
|
26
|
+
@links = kwargs[:links]
|
27
|
+
end
|
28
|
+
|
29
|
+
def link
|
30
|
+
links && !links.empty? && links[0]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def markdown_glob
|
35
|
+
"#{@env['MARKDO_ROOT']}/*.md"
|
36
|
+
end
|
37
|
+
|
38
|
+
def clean(line)
|
39
|
+
line.sub(/\s*[-*] \[.\]\s+/, '').chomp
|
40
|
+
end
|
41
|
+
|
42
|
+
def template(items)
|
43
|
+
# No beginning of line whitespace allowed
|
44
|
+
buf = '<?xml version="1.0" encoding="UTF-8"?>'
|
45
|
+
|
46
|
+
buf = <<-XML
|
47
|
+
<rss version="2.0">
|
48
|
+
<channel>
|
49
|
+
<title>Links in Markdo</title>
|
50
|
+
XML
|
51
|
+
|
52
|
+
items.each do |item|
|
53
|
+
buf << <<-XML
|
54
|
+
<item>
|
55
|
+
<title>#{item.title}</title>
|
56
|
+
<link>#{item.link}</link>
|
57
|
+
</item>
|
58
|
+
XML
|
59
|
+
end
|
60
|
+
|
61
|
+
buf << <<-XML
|
62
|
+
</channel>
|
63
|
+
</rss>
|
64
|
+
XML
|
65
|
+
|
66
|
+
buf
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/markdo/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'markdo/rss_command'
|
3
|
+
|
4
|
+
module Markdo
|
5
|
+
describe RssCommand do
|
6
|
+
it 'outputs RSS from the input Markdown' do
|
7
|
+
out = StringIO.new
|
8
|
+
err = StringIO.new
|
9
|
+
env = { 'MARKDO_ROOT' => 'test/fixtures' }
|
10
|
+
|
11
|
+
RssCommand.new(out, err, env).run
|
12
|
+
|
13
|
+
out.string.must_equal <<-XML
|
14
|
+
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
15
|
+
<rss>
|
16
|
+
<channel>
|
17
|
+
<title>Links in Markdo</title>
|
18
|
+
<item>
|
19
|
+
<title>Task with HTTP URL http://www.example.com/</title>
|
20
|
+
<link>http://www.example.com/</link>
|
21
|
+
</item>
|
22
|
+
<item>
|
23
|
+
<title>Task with HTTPS URL https://www.example.com/</title>
|
24
|
+
<link>https://www.example.com/</link>
|
25
|
+
</item>
|
26
|
+
<item>
|
27
|
+
<title>Task with HTTP URL http://www.example.com/ and trailing text</title>
|
28
|
+
<link>http://www.example.com/</link>
|
29
|
+
</item>
|
30
|
+
</channel>
|
31
|
+
</rss>
|
32
|
+
XML
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Benjamin Oakes
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2016-
|
11
|
+
date: 2016-03-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rake
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - ">="
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
36
41
|
description: Markdown-based task manager
|
37
42
|
email:
|
38
43
|
- hello@benjaminoakes.com
|
@@ -41,7 +46,7 @@ executables:
|
|
41
46
|
extensions: []
|
42
47
|
extra_rdoc_files: []
|
43
48
|
files:
|
44
|
-
- .gitignore
|
49
|
+
- ".gitignore"
|
45
50
|
- Gemfile
|
46
51
|
- LICENSE.txt
|
47
52
|
- README.md
|
@@ -57,6 +62,7 @@ files:
|
|
57
62
|
- lib/markdo/overdue_command.rb
|
58
63
|
- lib/markdo/overview_command.rb
|
59
64
|
- lib/markdo/query_command.rb
|
65
|
+
- lib/markdo/rss_command.rb
|
60
66
|
- lib/markdo/star_command.rb
|
61
67
|
- lib/markdo/tag_command.rb
|
62
68
|
- lib/markdo/today_command.rb
|
@@ -64,30 +70,34 @@ files:
|
|
64
70
|
- lib/markdo/version.rb
|
65
71
|
- lib/markdo/version_command.rb
|
66
72
|
- markdo.gemspec
|
73
|
+
- test/fixtures/rss_command.md
|
74
|
+
- test/rss_command_test.rb
|
75
|
+
- test/test_helper.rb
|
67
76
|
homepage: http://github.com/benjaminoakes/markdo
|
68
77
|
licenses:
|
69
78
|
- MIT
|
79
|
+
metadata: {}
|
70
80
|
post_install_message:
|
71
81
|
rdoc_options: []
|
72
82
|
require_paths:
|
73
83
|
- lib
|
74
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
85
|
requirements:
|
77
|
-
- -
|
86
|
+
- - ">="
|
78
87
|
- !ruby/object:Gem::Version
|
79
88
|
version: '0'
|
80
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
90
|
requirements:
|
83
|
-
- -
|
91
|
+
- - ">="
|
84
92
|
- !ruby/object:Gem::Version
|
85
93
|
version: '0'
|
86
94
|
requirements: []
|
87
95
|
rubyforge_project:
|
88
|
-
rubygems_version:
|
96
|
+
rubygems_version: 2.4.6
|
89
97
|
signing_key:
|
90
|
-
specification_version:
|
98
|
+
specification_version: 4
|
91
99
|
summary: Markdown-based task manager
|
92
|
-
test_files:
|
93
|
-
|
100
|
+
test_files:
|
101
|
+
- test/fixtures/rss_command.md
|
102
|
+
- test/rss_command_test.rb
|
103
|
+
- test/test_helper.rb
|