blob: 0dbcb0cb760f3646617a7768e611d0e9b90f52a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
from __future__ import print_function
import ruamel.yaml
inp = """\
features:
show: true
items:
- widget: full_width.html # full width 1
title: Some Title
description: >
Foobar.
vimeo_id: 20913
zoom_image: some_url.png
- widget: 3x_container.html
items:
- widget: 3x.html
title: Some Widget Title
image: 'foobar.png'
description: >
Some Description.
- widget: 3x.html
title: Some new title here
image: ajax_uploads/png1_2.png
description: >
Some Description.
"""
code = ruamel.yaml.load(inp, ruamel.yaml.RoundTripLoader)
res = ruamel.yaml.dump(code, Dumper=ruamel.yaml.RoundTripDumper)
print(res, end='')
code2 = ruamel.yaml.load(res, ruamel.yaml.RoundTripLoader)
res2 = ruamel.yaml.dump(code2, Dumper=ruamel.yaml.RoundTripDumper)
assert res == res2
inp = """\
features:
show: true
items:
# full width 1
- widget: full_width.html
title: Some Title
description: >
Foobar.
vimeo_id: 20913
zoom_image: some_url.png
- widget: 3x_container.html
items:
- widget: 3x.html
title: Some Widget Title
image: 'foobar.png'
description: >
Some Description.
- widget: 3x.html
title: Some new title here
image: ajax_uploads/png1_2.png
description: >
Some Description.
"""
|