mirror of
				https://github.com/qurator-spk/modstool.git
				synced 2025-11-04 03:14:14 +01:00 
			
		
		
		
	✨ Make Layout_Page_WIDTH/HEIGHT integer values
This commit is contained in:
		
							parent
							
								
									a20c979351
								
							
						
					
					
						commit
						64ed7298da
					
				
					 2 changed files with 7 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -47,8 +47,7 @@ EXPECTED_TYPES = {
 | 
			
		|||
        r"Layout_Page_//alto:String/@WC-.*": ("Float64", None),
 | 
			
		||||
        r"alto_xmlns": ("object", ["str", "NoneType"]),
 | 
			
		||||
 | 
			
		||||
        # XXX r"Layout_Page_(WIDTH|HEIGHT)": ("Int64", None),
 | 
			
		||||
        r"Layout_Page_(WIDTH|HEIGHT)": ("object", ["str", "NoneType"]),
 | 
			
		||||
        r"Layout_Page_(WIDTH|HEIGHT)": ("Int64", None),
 | 
			
		||||
}
 | 
			
		||||
def expected_types(c):
 | 
			
		||||
    for r, types in EXPECTED_TYPES.items():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -89,6 +89,12 @@ def alto_to_dict(alto, raise_errors=True):
 | 
			
		|||
        elif localname == 'Page':
 | 
			
		||||
            value[localname] = {}
 | 
			
		||||
            value[localname].update(TagGroup(tag, group).is_singleton().attributes())
 | 
			
		||||
            for attr in ("WIDTH", "HEIGHT"):
 | 
			
		||||
                if attr in value[localname]:
 | 
			
		||||
                    try:
 | 
			
		||||
                        value[localname][attr] = int(value[localname][attr])
 | 
			
		||||
                    except ValueError:
 | 
			
		||||
                        del value[localname][attr]
 | 
			
		||||
            value[localname].update(TagGroup(tag, group).subelement_counts())
 | 
			
		||||
            value[localname].update(TagGroup(tag, group).xpath_statistics("//alto:String/@WC", namespaces))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue