Skip to content

GEOTRANSFORM "start", "end" casted to START END #50

@loicgasser

Description

@loicgasser
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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions