forked from MapComplete/MapComplete
		
	Fix non-ascii characters, add check for them
This commit is contained in:
		
							parent
							
								
									2f6b43796b
								
							
						
					
					
						commit
						512a11740e
					
				
					 2 changed files with 47 additions and 76 deletions
				
			
		|  | @ -17,13 +17,18 @@ function genImages(dryrun = false) { | |||
|             throw "Non-svg file detected in the svg files: " + path; | ||||
|         } | ||||
| 
 | ||||
|         let svg = fs.readFileSync("./assets/svg/" + path, "utf-8") | ||||
|         let svg : string = fs.readFileSync("./assets/svg/" + path, "utf-8") | ||||
|             .replace(/<\?xml.*?>/, "") | ||||
|             .replace(/fill: ?none;/g, "fill: none !important;") // This is such a brittle hack...
 | ||||
|             .replace(/\n/g, " ") | ||||
|             .replace(/\r/g, "") | ||||
|             .replace(/\\/g, "\\") | ||||
|             .replace(/"/g, "\\\"") | ||||
| 
 | ||||
|         let hasNonAsciiChars = Array.from(svg).some(char => char.charCodeAt(0) > 127); | ||||
|         if(hasNonAsciiChars){ | ||||
|             throw "The svg '"+path+"' has non-ascii characters"; | ||||
|         } | ||||
|         const name = path.substr(0, path.length - 4) | ||||
|             .replace(/[ -]/g, "_"); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue