diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-12 15:09:45 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-12 15:09:45 +0200 |
commit | ce3f8389dda50a93a4aec151f6051841d7c65099 (patch) | |
tree | fcc971ea1151dacdb50c0368833848d86a18bff0 /lib/coderay | |
parent | 2e4e83bf84282d6ce7fbc9eeff2cbe1c79788a9b (diff) | |
parent | aeac6672fbe70702288b259605cb863493ad8ac2 (diff) | |
download | coderay-ce3f8389dda50a93a4aec151f6051841d7c65099.tar.gz |
Merge remote-tracking branch 'shimomura1004/taskpaper' into taskpaper-scanner
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/scanners/taskpaper.rb | 34 | ||||
-rw-r--r-- | lib/coderay/styles/alpha.rb | 3 | ||||
-rwxr-xr-x | lib/coderay/token_kinds.rb | 3 |
3 files changed, 40 insertions, 0 deletions
diff --git a/lib/coderay/scanners/taskpaper.rb b/lib/coderay/scanners/taskpaper.rb new file mode 100644 index 0000000..c6eb3b3 --- /dev/null +++ b/lib/coderay/scanners/taskpaper.rb @@ -0,0 +1,34 @@ +module CodeRay +module Scanners + + class Taskpaper < Scanner + + register_for :taskpaper + file_extension 'taskpaper' + + protected + + def scan_tokens encoder, options + until eos? + if match = scan(/^\S.*:.*$/) # project + encoder.text_token(match, :project) + elsif match = scan(/^-.+@done(?:\(.*)?.*$/) # completed task + encoder.text_token(match, :complete) + elsif match = scan(/^-.+$/) # task + encoder.text_token(match, :plain) + elsif match = scan(/^.+$/) # comment + encoder.text_token(match, :comment) + elsif match = scan(/\s+/) # space + encoder.text_token(match, :space) + else # other + encoder.text_token getch, :error + end + end + + encoder + end + + end + +end +end diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb index a21fbf1..6829686 100644 --- a/lib/coderay/styles/alpha.rb +++ b/lib/coderay/styles/alpha.rb @@ -140,6 +140,9 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; } .delete .delete { color: #c00; background:transparent; font-weight:bold } .change .change { color: #88f } .head .head { color: #f4f } + +.project { color: #707; font-weight: bold } +.complete { text-decoration: line-through; color: gray } TOKENS end diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb index bd8fd6c..f7f19bb 100755 --- a/lib/coderay/token_kinds.rb +++ b/lib/coderay/token_kinds.rb @@ -75,6 +75,9 @@ module CodeRay :insert => 'insert', :eyecatcher => 'eyecatcher', + + :project => 'project', + :complete => 'complete', :ident => false, :operator => false, |