From 9559031ba9e09ea2e71a305cf8de190bc2c70d31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Fri, 11 Dec 2020 23:17:37 +0100 Subject: [PATCH] Pass load+dump check on organice test files. --- org_dom/org_dom.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/org_dom/org_dom.py b/org_dom/org_dom.py index 8745601..f644dc4 100644 --- a/org_dom/org_dom.py +++ b/org_dom/org_dom.py @@ -46,15 +46,10 @@ HEADLINE_RE = re.compile(r"^(?P\*+) (?P\s*)(?P.*)$") KEYWORDS_RE = re.compile( r"^(?P\s*)#\+(?P[^:\[]+)(\[(?P[^\]]*)\])?:(?P\s*)(?P.*)$" ) -PROPERTY_DRAWER_RE = re.compile( - r"^(?P\s*):PROPERTIES:(?P\s*)$" -) -LOGBOOK_DRAWER_RE = re.compile( - r"^(?P\s*):LOGBOOK:(?P\s*)$" -) +DRAWER_START_RE = re.compile(r"^(?P\s*):([^:]+):(?P\s*)$") DRAWER_END_RE = re.compile(r"^(?P\s*):END:(?P\s*)$", re.I) NODE_PROPERTIES_RE = re.compile( - r"^(?P\s*):(?P[^+:]+)(?P\+)?:(?P\s*)(?P.*)$" + r"^(?P\s*):(?P[^+:]+)(?P\+)?:(?P\s*)(?P.+)$" ) RAW_LINE_RE = re.compile(r"^\s*([^\s#:*]|$)") BASE_TIME_STAMP_RE = r"(?P\d{4})-(?P\d{2})-(?P\d{2}) (?P[^ ]+)( (?P\d{1,2}):(?P\d{1,2})(--(?P\d{1,2}):(?P\d{1,2}))?)?" @@ -738,7 +733,7 @@ def parse_headline(hl) -> Headline: # TODO: Parse line for priority, cookies and tags line = hl["orig"].group("line") - title = line.strip() + title = line contents = parse_contents(hl["contents"]) return Headline( @@ -1059,10 +1054,8 @@ class OrgDomReader: # Generic properties elif m := KEYWORDS_RE.match(line): self.add_keyword_line(linenum, m) - elif m := PROPERTY_DRAWER_RE.match(line): + elif m := DRAWER_START_RE.match(line): self.add_property_drawer_line(linenum, line, m) - elif m := LOGBOOK_DRAWER_RE.match(line): - self.add_logbook_drawer_line(linenum, line, m) elif m := DRAWER_END_RE.match(line): self.add_drawer_end_line(linenum, line, m) elif m := RESULTS_DRAWER_RE.match(line):