From f43b6434063be3c01ecd7a006a6c4f3478a2e257 Mon Sep 17 00:00:00 2001 From: MinchinWeb Date: Sat, 11 Sep 2021 10:24:03 -0600 Subject: [PATCH] Refactor YAML exporter to be Pelican Markdown exporter --- jrnl/plugins/__init__.py | 4 ++-- ...ml_exporter.py => pelican_markdown_exporter.py} | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) rename jrnl/plugins/{yaml_exporter.py => pelican_markdown_exporter.py} (91%) diff --git a/jrnl/plugins/__init__.py b/jrnl/plugins/__init__.py index 0d2b39b4..0b33aa1b 100644 --- a/jrnl/plugins/__init__.py +++ b/jrnl/plugins/__init__.py @@ -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] diff --git a/jrnl/plugins/yaml_exporter.py b/jrnl/plugins/pelican_markdown_exporter.py similarity index 91% rename from jrnl/plugins/yaml_exporter.py rename to jrnl/plugins/pelican_markdown_exporter.py index df3b0548..279b1da7 100644 --- a/jrnl/plugins/yaml_exporter.py +++ b/jrnl/plugins/pelican_markdown_exporter.py @@ -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