change print statement over to new print_msg function

This commit is contained in:
Jonathan Wren 2022-04-16 15:52:58 -07:00
parent 253b80740a
commit f142c912e2
2 changed files with 16 additions and 8 deletions

View file

@ -140,6 +140,11 @@ class MsgText(Enum):
No entries to delete, because the search returned no results
"""
# --- Formats --- #
HeadingsPastH6 = """
Headings increased past H6 on export - {date} {title}
"""
class Message(NamedTuple):
text: MsgText

View file

@ -4,13 +4,14 @@
import os
import re
import sys
from jrnl.color import RESET_COLOR
from jrnl.color import WARNING_COLOR
from .text_exporter import TextExporter
from jrnl.output import print_msg
from jrnl.messages import Message
from jrnl.messages import MsgText
from jrnl.messages import MsgType
class MarkdownExporter(TextExporter):
"""This Exporter can convert entries and journals into Markdown."""
@ -63,10 +64,12 @@ class MarkdownExporter(TextExporter):
newbody = newbody + os.linesep
if warn_on_heading_level is True:
print(
f"{WARNING_COLOR}WARNING{RESET_COLOR}: "
f"Headings increased past H6 on export - {date_str} {entry.title}",
file=sys.stderr,
print_msg(
Message(
MsgText.HeadingsPastH6,
MsgType.WARNING,
{"date": date_str, "title": entry.title},
)
)
return f"{heading} {date_str} {entry.title}\n{newbody} "