summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-12 15:49:44 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-12 15:49:44 +0200
commitabdc3e4a18b664e9d6e20e06913a0aa342f8ca73 (patch)
tree57cbbf918c76b8f3eb38d5ad92f3eb24bf1b0d59
parentce3f8389dda50a93a4aec151f6051841d7c65099 (diff)
downloadcoderay-abdc3e4a18b664e9d6e20e06913a0aa342f8ca73.tar.gz
tweak Taskpaper scanner, cleanup doc_string kind
-rw-r--r--lib/coderay/encoders/terminal.rb2
-rw-r--r--lib/coderay/scanners/taskpaper.rb18
-rw-r--r--lib/coderay/styles/alpha.rb3
-rwxr-xr-xlib/coderay/token_kinds.rb8
4 files changed, 14 insertions, 17 deletions
diff --git a/lib/coderay/encoders/terminal.rb b/lib/coderay/encoders/terminal.rb
index 500e5d8..9894b91 100644
--- a/lib/coderay/encoders/terminal.rb
+++ b/lib/coderay/encoders/terminal.rb
@@ -37,7 +37,7 @@ module CodeRay
:directive => "\e[32m\e[4m",
:doc => "\e[46m",
:doctype => "\e[1;30m",
- :doc_string => "\e[31m\e[4m",
+ :docstring => "\e[31m\e[4m",
:entity => "\e[33m",
:error => "\e[1;33m\e[41m",
:exception => "\e[1;31m",
diff --git a/lib/coderay/scanners/taskpaper.rb b/lib/coderay/scanners/taskpaper.rb
index c6eb3b3..42670bc 100644
--- a/lib/coderay/scanners/taskpaper.rb
+++ b/lib/coderay/scanners/taskpaper.rb
@@ -10,17 +10,19 @@ module Scanners
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
+ if match = scan(/\S.*:.*$/) # project
+ encoder.text_token(match, :namespace)
+ elsif match = scan(/-.+@done.*/) # completed task
+ encoder.text_token(match, :done)
+ elsif match = scan(/-(?:[^@\n]+|@(?!due))*/) # task
encoder.text_token(match, :plain)
- elsif match = scan(/^.+$/) # comment
+ elsif match = scan(/@due.*/) # comment
+ encoder.text_token(match, :important)
+ elsif match = scan(/.+/) # comment
encoder.text_token(match, :comment)
- elsif match = scan(/\s+/) # space
+ elsif match = scan(/\s+/) # space
encoder.text_token(match, :space)
- else # other
+ else # other
encoder.text_token getch, :error
end
end
diff --git a/lib/coderay/styles/alpha.rb b/lib/coderay/styles/alpha.rb
index 6829686..f57e4a1 100644
--- a/lib/coderay/styles/alpha.rb
+++ b/lib/coderay/styles/alpha.rb
@@ -141,8 +141,7 @@ table.CodeRay td { padding: 2px 4px; vertical-align: top; }
.change .change { color: #88f }
.head .head { color: #f4f }
-.project { color: #707; font-weight: bold }
-.complete { text-decoration: line-through; color: gray }
+.done { text-decoration: line-through; color: gray }
TOKENS
end
diff --git a/lib/coderay/token_kinds.rb b/lib/coderay/token_kinds.rb
index f7f19bb..de3a0d0 100755
--- a/lib/coderay/token_kinds.rb
+++ b/lib/coderay/token_kinds.rb
@@ -29,7 +29,8 @@ module CodeRay
:directive => 'directive',
:doc => 'doc',
:doctype => 'doctype',
- :doc_string => 'doc-string',
+ :docstring => 'doc-string',
+ :done => 'done',
:entity => 'entity',
:error => 'error',
:escape => 'escape',
@@ -75,9 +76,6 @@ module CodeRay
:insert => 'insert',
:eyecatcher => 'eyecatcher',
-
- :project => 'project',
- :complete => 'complete',
:ident => false,
:operator => false,
@@ -87,6 +85,4 @@ module CodeRay
)
TokenKinds[:method] = TokenKinds[:function]
- TokenKinds[:escape] = TokenKinds[:delimiter]
- TokenKinds[:docstring] = TokenKinds[:comment]
end