From ef3b238b79e264c482eb2951bd98c6af126502cf Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Fri, 27 Mar 2015 01:47:50 +0100 Subject: [PATCH] VimwikiTask: Allow short UUIDs and generate them by default --- taskwiki/regexp.py | 4 +++- taskwiki/vwtask.py | 2 +- tests/test_integration.py | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/taskwiki/regexp.py b/taskwiki/regexp.py index 073aa35..13eb097 100644 --- a/taskwiki/regexp.py +++ b/taskwiki/regexp.py @@ -2,6 +2,7 @@ import re # Unnamed building blocks UUID_UNNAMED = r'[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}' +UUID_UNNAMED_SHORT = r'[0-9a-fA-F]{8}' DUE_UNNAMED = r'\(\d{4}-\d\d-\d\d( \d\d:\d\d)?\)' SPACE_UNNAMED = r'\s*' NONEMPTY_SPACE_UNNAMED = r'\s+' @@ -13,13 +14,14 @@ TEXT_FORBIDDEN_SUFFIXES = ( r'\(\d{4}-\d\d-\d\d\)', r'\(\d{4}-\d\d-\d\d \d\d:\d\d\)', # Any datetime value r'\(\d{4}-\d\d-\d\d', # Any datetime value UUID_UNNAMED, # Text cannot end with UUID + UUID_UNNAMED_SHORT, ) # Building blocks BRACKET_OPENING = re.escape('* [') BRACKET_CLOSING = re.escape('] ') EMPTY_SPACE = r'(?P\s*)' -UUID = r'(?P{0})'.format(UUID_UNNAMED) +UUID = r'(?P{0}|{1})'.format(UUID_UNNAMED, UUID_UNNAMED_SHORT) DUE = r'(?P{0})'.format(DUE_UNNAMED) UUID_COMMENT = '#{0}'.format(UUID) TEXT = r'(?P.+' + ''.join(['(?