dump different scalar styles in the same document in PyYAML

Andrey Somov <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
Hi All,
even though there is plenty of options while dumping YAML in PyYAML, I
could not find how I can mix different scalar styles in the same
document.
For instance, instead of:
---
value1: 1
value2: 'line1

    line2

   line3'
...
I would like to dump
---
value1: 1
value2: |-
    line1
    line2
    line3
...

So I would like to use the plain scalar style but if the value
contains '\n' then the literal style shall be used.
Is it possible?

Andrey

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.