-
-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
from mappyfile.parser import Parser
from mappyfile.pprint import PrettyPrinter
from mappyfile.transformer import MapfileToDict
from mappyfile.validator import Validator
def output(s, include_position=True, schema_name="map"):
"""
Parse, transform, validate, and pretty print
the result
"""
p = Parser()
m = MapfileToDict(include_position=include_position)
ast = p.parse(s)
d = m.transform(ast)
v = Validator()
errors = v.validate(d, schema_name=schema_name)
pp = PrettyPrinter(indent=0, newlinechar=" ", quote="'")
s = pp.pprint(d)
print s
assert(len(errors) == 0)
return s
s = """
STYLE
SIZE 0
GEOMTRANSFORM "end"
END
"""
output(s, schema_name="style") Result:
STYLE SIZE 0 GEOMTRANSFORM END END
Metadata
Metadata
Assignees
Labels
No labels