From abdc3e4a18b664e9d6e20e06913a0aa342f8ca73 Mon Sep 17 00:00:00 2001 From: Kornelius Kalnbach Date: Wed, 12 Jun 2013 15:49:44 +0200 Subject: tweak Taskpaper scanner, cleanup doc_string kind --- lib/coderay/scanners/taskpaper.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/coderay/scanners') 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 -- cgit v1.2.1