Code fixes as per review

This commit is contained in:
MinchinWeb 2020-01-04 21:02:27 -07:00
parent a86e15b1aa
commit 31a040878c

View file

@ -40,7 +40,7 @@ class YAMLExporter(TextExporter):
previous_line = "" previous_line = ""
warn_on_heading_level = False warn_on_heading_level = False
for line in body.splitlines(True): for line in body.splitlines(True):
if re.match(r"#+ ", line): if re.match(r"^#+ ", line):
"""ATX style headings""" """ATX style headings"""
newbody = newbody + previous_line + heading + line newbody = newbody + previous_line + heading + line
if re.match(r"^#######+ ", heading + line): if re.match(r"^#######+ ", heading + line):
@ -85,18 +85,20 @@ class YAMLExporter(TextExporter):
or hasattr(entry, "creator_software_agent") or hasattr(entry, "creator_software_agent")
): ):
dayone_attributes += "creator:\n" dayone_attributes += "creator:\n"
if hasattr(entry, "creator_device_agent"): if hasattr(entry, "creator_device_agent"):
dayone_attributes += f" device agent: {entry.creator_device_agent}\n" dayone_attributes += f" device agent: {entry.creator_device_agent}\n"
if hasattr(entry, "creator_generation_date"): if hasattr(entry, "creator_generation_date"):
dayone_attributes += " generation date: {}\n".format( dayone_attributes += " generation date: {}\n".format(
str(entry.creator_generation_date) str(entry.creator_generation_date)
) )
if hasattr(entry, "creator_host_name"): if hasattr(entry, "creator_host_name"):
dayone_attributes += f" host name: {entry.creator_host_name}\n" dayone_attributes += f" host name: {entry.creator_host_name}\n"
if hasattr(entry, "creator_os_agent"): if hasattr(entry, "creator_os_agent"):
dayone_attributes += f" os agent: {entry.creator_os_agent}\n" dayone_attributes += f" os agent: {entry.creator_os_agent}\n"
if hasattr(entry, "creator_software_agent"): if hasattr(entry, "creator_software_agent"):
dayone_attributes += f" software agent: {entry.creator_software_agent}\n" dayone_attributes += (
f" software agent: {entry.creator_software_agent}\n"
)
# TODO: copy over pictures, if present # TODO: copy over pictures, if present
# source directory is entry.journal.config['journal'] # source directory is entry.journal.config['journal']