[Docs] better linewrapping

This commit is contained in:
MinchinWeb 2021-03-16 20:15:40 -06:00
parent 46c28d7d54
commit 4eb0ab086c

View file

@ -68,7 +68,10 @@ class Importer:
@staticmethod @staticmethod
def import_(journal, input=None) def import_(journal, input=None)
"""Given a nicely formatted JSON file, will add the contained Entries to the journal.""" """
Given a nicely formatted JSON file, will add the
contained Entries to the journal.
"""
old_count = len(journal.entries) old_count = len(journal.entries)
if input: if input:
@ -78,7 +81,10 @@ class Importer:
try: try:
data = sys.stdin.read() data = sys.stdin.read()
except KeyboardInterrupt: except KeyboardInterrupt:
print("[Entries NOT imported into journal.]", file=sys.stderr) print(
"[Entries NOT imported into journal.]",
file=sys.stderr,
)
sys.exit(0) sys.exit(0)
for json_entry in data: for json_entry in data:
@ -89,7 +95,9 @@ class Importer:
new_cnt = len(journal.entries) new_cnt = len(journal.entries)
print( print(
"[{} imported to {} journal]".format(new_cnt - old_cnt, journal.name), "[{} imported to {} journal]".format(
new_cnt - old_cnt, journal.name
),
file=sys.stderr, file=sys.stderr,
) )
~~~ ~~~
@ -133,7 +141,9 @@ import json
from jrnl.plugins.exporter.text_exporter import Exporter as TextExporter from jrnl.plugins.exporter.text_exporter import Exporter as TextExporter
class Exporter(TextExporter): class Exporter(TextExporter):
"""This basic Exporter can convert entries and journals into JSON.""" """
This basic Exporter can convert entries and journals into JSON.
"""
names = ["json"] names = ["json"]
extension = "json" extension = "json"
@ -156,7 +166,9 @@ class Exporter(TextExporter):
"""Returns a json representation of an entire journal.""" """Returns a json representation of an entire journal."""
tags = get_tags_count(journal) tags = get_tags_count(journal)
result = { result = {
"entries": [cls.entry_to_dict(e) for e in journal.entries], "entries": [
cls.entry_to_dict(e) for e in journal.entries
],
} }
return json.dumps(result, indent=2) return json.dumps(result, indent=2)
~~~ ~~~