Handle escaping of manufacturer/product strings (#18194)
This commit is contained in:
		
							parent
							
								
									ac33b7b0b3
								
							
						
					
					
						commit
						3adaf6a46a
					
				
					 5 changed files with 6 additions and 2 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| { | ||||
|     "keyboard_name": "shisaku", | ||||
|     "manufacturer": "ADPenrose", | ||||
|     "url": "https://github.com/ADPenrose/shisaku_keeb", | ||||
|     "maintainer": "ADPenrose", | ||||
|     "usb": { | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| { | ||||
|     "keyboard_name": "KBIC65", | ||||
|     "manufacturer": "b-karl", | ||||
|     "url": "https://karlb.eu/kbic65/", | ||||
|     "maintainer": "b-karl", | ||||
|     "diode_direction": "ROW2COL", | ||||
|  |  | |||
|  | @ -1,5 +1,6 @@ | |||
| { | ||||
|     "keyboard_name": "BAMFK-4", | ||||
|     "manufacturer": "Keebio", | ||||
|     "url": "https://keeb.io", | ||||
|     "maintainer": "nooges", | ||||
|     "usb": { | ||||
|  |  | |||
|  | @ -117,9 +117,10 @@ def generate_config_items(kb_info_json, config_h_lines): | |||
|                 config_h_lines.append(f'#   define {key} {value}') | ||||
|                 config_h_lines.append(f'#endif // {key}') | ||||
|         elif key_type == 'str': | ||||
|             escaped_str = config_value.replace('\\', '\\\\').replace('"', '\\"') | ||||
|             config_h_lines.append('') | ||||
|             config_h_lines.append(f'#ifndef {config_key}') | ||||
|             config_h_lines.append(f'#   define {config_key} "{config_value}"') | ||||
|             config_h_lines.append(f'#   define {config_key} "{escaped_str}"') | ||||
|             config_h_lines.append(f'#endif // {config_key}') | ||||
|         elif key_type == 'bcd_version': | ||||
|             (major, minor, revision) = config_value.split('.') | ||||
|  |  | |||
|  | @ -479,7 +479,7 @@ def _config_to_json(key_type, config_value): | |||
|         return int(config_value) | ||||
| 
 | ||||
|     elif key_type == 'str': | ||||
|         return config_value.strip('"') | ||||
|         return config_value.strip('"').replace('\\"', '"').replace('\\\\', '\\') | ||||
| 
 | ||||
|     elif key_type == 'bcd_version': | ||||
|         major = int(config_value[2:4]) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ryan
						Ryan