diff options
-rw-r--r-- | lesana/templating.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lesana/templating.py b/lesana/templating.py index 95c6146..ff21d14 100644 --- a/lesana/templating.py +++ b/lesana/templating.py @@ -25,7 +25,14 @@ def to_yaml(data): """ if isinstance(data, str): if len(data) > 75 or "\n" in data: - data = ruamel.yaml.scalarstring.LiteralScalarString(data + "\n") + try: + data = ruamel.yaml.scalarstring.LiteralScalarString( + data + "\n" + ) + except AttributeError: + data = ruamel.yaml.scalarstring.PreservedScalarString( + data + "\n" + ) elif isinstance(data, decimal.Decimal): data = str(data) elif data is None: |