Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
a9191c95
Commit
a9191c95
authored
Jun 07, 2018
by
Ryan Herbert
Browse files
vidjilparser.py return valid json
parent
4c1ef9f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/vidjilparser.py
View file @
a9191c95
...
...
@@ -34,21 +34,26 @@ class VidjilWriter(object):
if
event
==
'start_map'
:
mstr
=
'{{'
elif
event
==
'end_map'
:
mstr
=
'}}
,
'
mstr
=
'}}'
elif
event
==
'start_array'
:
mstr
=
'['
elif
event
==
'end_array'
:
mstr
=
']
,
'
mstr
=
']'
elif
event
==
'map_key'
:
mstr
=
'
\
'
{}
\
'
:'
mstr
=
'
\
"
{}
\
"
:'
end
=
''
elif
event
==
'string'
:
mstr
=
'
\
'
{}
\
'
,
'
mstr
=
'
\
"
{}
\
"
'
else
:
if
event
==
'boolean'
:
value
=
str
(
value
).
lower
()
mstr
=
'{}'
padding
=
''
if
type
(
value
)
in
[
str
,
unicode
]
:
value
=
value
.
replace
(
"
\n
"
,
"
\\
n"
)
value
=
value
.
replace
(
"
\r
"
,
"
\\
r"
)
if
previous
not
in
[
''
,
'map_key'
,
'start_map'
,
'start_array'
]
and
event
not
in
[
'end_map'
,
'end_array'
]:
mstr
=
","
+
mstr
if
self
.
pretty
and
previous
!=
'map_key'
:
if
len
(
prefix
)
>
0
:
padding
=
''
.
join
([
'
\t
'
for
i
in
range
(
len
(
prefix
.
split
(
'.'
)))])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment