summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHIMOMURA Sho <graueule@gmail.com>2012-10-21 01:23:56 +0900
committerSHIMOMURA Sho <graueule@gmail.com>2012-10-22 00:02:34 +0900
commitaeac6672fbe70702288b259605cb863493ad8ac2 (patch)
tree3a8dd17f20b2502aeb8dd21e382350d42aa402da
parent3effca8291ed4941f7b3a1c2088b50274f28aa6f (diff)
downloadcoderay-aeac6672fbe70702288b259605cb863493ad8ac2.tar.gz
TaskPaper scanner for CodeRay
-rw-r--r--lib/coderay/scanners/taskpaper.rb34
-rw-r--r--lib/coderay/styles/alpha.rb3
-rwxr-xr-xlib/coderay/token_kinds.rb3
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 8506d10..259e458 100644
--- a/lib/coderay/styles/alpha.rb
+++ b/lib/coderay/styles/alpha.rb
@@ -134,6 +134,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 3b8d07e..a36d877 100755
--- a/lib/coderay/token_kinds.rb
+++ b/lib/coderay/token_kinds.rb
@@ -74,6 +74,9 @@ module CodeRay
:insert => 'insert',
:eyecatcher => 'eyecatcher',
+
+ :project => 'project',
+ :complete => 'complete',
:ident => false,
:operator => false,