Refactor YAML exporter to be Pelican Markdown exporter

This commit is contained in:
MinchinWeb 2021-09-11 10:24:03 -06:00
parent 61f8406412
commit f43b643406
2 changed files with 11 additions and 7 deletions

View file

@ -7,19 +7,19 @@ from .fancy_exporter import FancyExporter
from .jrnl_importer import JRNLImporter
from .json_exporter import JSONExporter
from .markdown_exporter import MarkdownExporter
from .pelican_markdown_exporter import PelicanMarkdownExporter
from .tag_exporter import TagExporter
from .template_exporter import __all__ as template_exporters
from .text_exporter import TextExporter
from .xml_exporter import XMLExporter
from .yaml_exporter import YAMLExporter
__exporters = [
JSONExporter,
MarkdownExporter,
PelicanMarkdownExporter,
TagExporter,
TextExporter,
XMLExporter,
YAMLExporter,
FancyExporter,
] + template_exporters
__importers = [JRNLImporter]

View file

@ -14,10 +14,14 @@ from jrnl.color import WARNING_COLOR
from .text_exporter import TextExporter
class YAMLExporter(TextExporter):
"""This Exporter can convert entries and journals into Markdown formatted text with YAML front matter."""
class PelicanMarkdownExporter(TextExporter):
"""
This Exporter can convert entries and journals into Markdown formatted
text with YAML front matter, as may be used by Pelican (a static site
generator).
"""
names = ["yaml"]
names = ["pelican-markdown"]
extension = "md"
@classmethod
@ -25,8 +29,8 @@ class YAMLExporter(TextExporter):
"""Returns a markdown representation of a single entry, with YAML front matter."""
if to_multifile is False:
print(
f"{ERROR_COLOR}ERROR{RESET_COLOR}: YAML export must be to individual files. Please \
specify a directory to export to.",
f"{ERROR_COLOR}ERROR{RESET_COLOR}: Pelican Markdown export must \
be to individual files. Please specify a directory to export to.",
file=sys.stderr,
)
return