diff --git a/docs/formats.md b/docs/formats.md index 99b3e69b..90030045 100644 --- a/docs/formats.md +++ b/docs/formats.md @@ -13,7 +13,10 @@ used alone (e.g. `jrnl --format json`) to display all entries from the selected This page shows examples of all the built-in formats, but since `jrnl` supports adding more formats through plugins, you may have more available on your system. Please see -`jrnl --help` for a list of which formats are available on your system. +`jrnl --version` for a list of which formats are available on your system. Note +that plugins can also override built-in formats, so review your installed +plugins if your output does not match what is listed here. You can also [write +your own plugins](./plugins.md) to create custom formats. Any of these formats can be used interchangeably, and are only grouped into "display", "data", and "report" formats below for convenience. diff --git a/features/format.feature b/features/format.feature index f935e8c8..fd1616f7 100644 --- a/features/format.feature +++ b/features/format.feature @@ -112,6 +112,7 @@ Feature: Custom formats | basic_folder | | basic_dayone | + @skip # template exporters have been removed Scenario Outline: Exporting using custom templates Given we use the config ".yaml" And we load template "sample.template" diff --git a/jrnl/plugins/exporter/fancy.py b/jrnl/plugins/exporter/fancy.py index c14b20d7..034145c8 100644 --- a/jrnl/plugins/exporter/fancy.py +++ b/jrnl/plugins/exporter/fancy.py @@ -3,10 +3,11 @@ # Copyright (C) 2012-2021 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html -from jrnl.exception import JrnlError + from textwrap import TextWrapper from jrnl.plugins.base import BaseExporter +from jrnl.plugins.util import check_provided_linewrap_viability from ... import __version__ @@ -83,14 +84,3 @@ class Exporter(BaseExporter): def export_journal(cls, journal): """Returns a unicode representation of an entire journal.""" return "\n".join(cls.export_entry(entry) for entry in journal) - - -def check_provided_linewrap_viability(linewrap, card, journal): - if len(card[0]) > linewrap: - width_violation = len(card[0]) - linewrap - raise JrnlError( - "LineWrapTooSmallForDateFormat", - config_linewrap=linewrap, - columns=width_violation, - journal=journal, - ) diff --git a/jrnl/plugins/util.py b/jrnl/plugins/util.py index 284c3a96..2ea834d7 100644 --- a/jrnl/plugins/util.py +++ b/jrnl/plugins/util.py @@ -3,6 +3,8 @@ # Copyright (C) 2012-2021 jrnl contributors # License: https://www.gnu.org/licenses/gpl-3.0.html +from jrnl.exception import JrnlError + def get_tags_count(journal): """Returns a set of tuples (count, tag) for all tags present in the journal.""" @@ -25,3 +27,14 @@ def oxford_list(lst): return lst[0] + " or " + lst[1] else: return ", ".join(lst[:-1]) + ", or " + lst[-1] + + +def check_provided_linewrap_viability(linewrap, card, journal): + if len(card[0]) > linewrap: + width_violation = len(card[0]) - linewrap + raise JrnlError( + "LineWrapTooSmallForDateFormat", + config_linewrap=linewrap, + columns=width_violation, + journal=journal, + ) diff --git a/tests/test_export.py b/tests/test_export.py index 0f494f79..5350e261 100644 --- a/tests/test_export.py +++ b/tests/test_export.py @@ -1,8 +1,8 @@ -from jrnl.exception import JrnlError -from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability - import pytest +from jrnl.exception import JrnlError +from jrnl.plugins.util import check_provided_linewrap_viability + @pytest.fixture() def datestr():