mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-19 06:43:06 +02:00
parsing: Move regexp matching parts into separate classmethod
This commit is contained in:
parent
6be71fae0b
commit
342359f482
2 changed files with 10 additions and 2 deletions
|
@ -169,9 +169,13 @@ class ViewPort(object):
|
|||
# All syntactic processing done, return the resulting filter args
|
||||
return taskfilter_args, meta
|
||||
|
||||
@classmethod
|
||||
def parse_line(cls, number):
|
||||
return re.search(regexp.GENERIC_VIEWPORT, vim.current.buffer[number])
|
||||
|
||||
@classmethod
|
||||
def from_line(cls, number, cache):
|
||||
match = re.search(regexp.GENERIC_VIEWPORT, vim.current.buffer[number])
|
||||
match = cache.line[(cls, number)]
|
||||
|
||||
if not match:
|
||||
return None
|
||||
|
|
|
@ -109,6 +109,10 @@ class VimwikiTask(object):
|
|||
line_number = util.get_current_line_number()
|
||||
return cls.from_line(cache, line_number)
|
||||
|
||||
@classmethod
|
||||
def parse_line(cls, number):
|
||||
return re.search(regexp.GENERIC_TASK, vim.current.buffer[number])
|
||||
|
||||
@classmethod
|
||||
def from_line(cls, cache, number):
|
||||
"""
|
||||
|
@ -118,7 +122,7 @@ class VimwikiTask(object):
|
|||
# Protected access is ok here
|
||||
# pylint: disable=W0212
|
||||
|
||||
match = re.search(regexp.GENERIC_TASK, vim.current.buffer[number])
|
||||
match = cache.line[(cls, number)]
|
||||
|
||||
if not match:
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue