From 47904917efccafeb29013d040305b78c1b36e821 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sun, 15 Sep 2019 15:30:15 +0200 Subject: Improvements in the export command --- lesana/command.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lesana/command.py b/lesana/command.py index 15be857..3a3db55 100644 --- a/lesana/command.py +++ b/lesana/command.py @@ -275,17 +275,15 @@ class Export(Command): for entry in results: try: template = collection.get_template(self.args.template) - rendered = template.render(entry=entry) - data = ruamel.yaml.load( - template.render(entry=entry), - ruamel.yaml.RoundTripLoader - ) + rendered = template.render(entry=entry, **entry.data) except TemplatingError as e: + logging.error("Error converting entry: {}".format(entry)) logging.error("{}".format(e)) sys.exit(1) try: data = ruamel.yaml.load(rendered, ruamel.yaml.RoundTripLoader) except ruamel.yaml.YAMLError as e: + logging.error("Error converting entry: {}".format(entry)) logging.error("{}".format(e)) sys.exit(1) e = Entry(destination, data=data) -- cgit v1.2.3