diff --git a/jrnl/plugins/prjct_exporter.py b/jrnl/plugins/prjct_exporter.py index d0098e4e..f09d3370 100644 --- a/jrnl/plugins/prjct_exporter.py +++ b/jrnl/plugins/prjct_exporter.py @@ -2,8 +2,11 @@ # encoding: utf-8 from __future__ import absolute_import, unicode_literals, print_function -from .text_exporter import TextExporter + import sys +import re + +from .text_exporter import TextExporter from ..util import WARNING_COLOR, ERROR_COLOR, RESET_COLOR @@ -25,6 +28,17 @@ class PrjctExporter(TextExporter): body_wrapper = "\n" if entry.body else "" body = body_wrapper + entry.body + tagsymbols = entry.journal.config['tagsymbols'] + # see also Entry.Entry.rag_regex + multi_tag_regex = re.compile(r'(?u)^\s*([{tags}][-+*#/\w]+\s*)+$'.format(tags=tagsymbols), re.UNICODE) + + newbody = '' + for line in body.splitlines(True): + if multi_tag_regex.match(line): + """Tag only lines""" + line = '' + newbody = newbody + line + # pass headings as is if len(entry.tags) > 0: @@ -49,7 +63,7 @@ class PrjctExporter(TextExporter): author="", location=location_str, language="", - body=body, + body=newbody, space="\n" )