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 No entries to delete, because the search returned no results
""" """
# --- Formats --- #
HeadingsPastH6 = """
Headings increased past H6 on export - {date} {title}
"""
class Message(NamedTuple): class Message(NamedTuple):
text: MsgText text: MsgText

View file

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