Skip to content

Commit ce3f838

Browse files
committed
Merge remote-tracking branch 'shimomura1004/taskpaper' into taskpaper-scanner
2 parents 2e4e83b + aeac667 commit ce3f838

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

lib/coderay/scanners/taskpaper.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
module CodeRay
2+
module Scanners
3+
4+
class Taskpaper < Scanner
5+
6+
register_for :taskpaper
7+
file_extension 'taskpaper'
8+
9+
protected
10+
11+
def scan_tokens encoder, options
12+
until eos?
13+
if match = scan(/^\S.*:.*$/) # project
14+
encoder.text_token(match, :project)
15+
elsif match = scan(/^-.+@done(?:\(.*)?.*$/) # completed task
16+
encoder.text_token(match, :complete)
17+
elsif match = scan(/^-.+$/) # task
18+
encoder.text_token(match, :plain)
19+
elsif match = scan(/^.+$/) # comment
20+
encoder.text_token(match, :comment)
21+
elsif match = scan(/\s+/) # space
22+
encoder.text_token(match, :space)
23+
else # other
24+
encoder.text_token getch, :error
25+
end
26+
end
27+
28+
encoder
29+
end
30+
31+
end
32+
33+
end
34+
end

lib/coderay/styles/alpha.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ class Alpha < Style
140140
.delete .delete { color: #c00; background:transparent; font-weight:bold }
141141
.change .change { color: #88f }
142142
.head .head { color: #f4f }
143+
144+
.project { color: #707; font-weight: bold }
145+
.complete { text-decoration: line-through; color: gray }
143146
TOKENS
144147

145148
end

lib/coderay/token_kinds.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ module CodeRay
7575
:insert => 'insert',
7676

7777
:eyecatcher => 'eyecatcher',
78+
79+
:project => 'project',
80+
:complete => 'complete',
7881

7982
:ident => false,
8083
:operator => false,

0 commit comments

Comments
 (0)