diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-09-15 15:30:15 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2019-09-15 15:30:15 +0200 |
commit | 47904917efccafeb29013d040305b78c1b36e821 (patch) | |
tree | 350a668826f02ccd5592c202503ba69928722281 | |
parent | 4c291a3710486eab6edd97b5e0619241f5909173 (diff) |
Improvements in the export command
-rw-r--r-- | lesana/command.py | 8 |
1 files 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) |