| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  | /** | 
					
						
							|  |  |  |  * Rewrites and multiplies the given renderings of type T. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2022-06-19 13:55:33 +02:00
										 |  |  |  * This can be used for introducing many similar questions automatically, | 
					
						
							|  |  |  |  * which also makes translations easier. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * (Note that the key does _not_ need to be wrapped in {}. | 
					
						
							|  |  |  |  * However, we recommend to use them if the key is used in a translation, as missing keys will be picked up and warned for by the translation scripts) | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  * For example: | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ```
 | 
					
						
							|  |  |  |  * { | 
					
						
							|  |  |  |  *     rewrite: { | 
					
						
							|  |  |  |  *         sourceString: ["key", "a|b|c"], | 
					
						
							|  |  |  |  *         into: [ | 
					
						
							| 
									
										
										
										
											2022-04-03 02:37:31 +02:00
										 |  |  |  *             ["X", 0] | 
					
						
							|  |  |  |  *             ["Y", 1], | 
					
						
							|  |  |  |  *             ["Z", 2] | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  *         ], | 
					
						
							| 
									
										
										
										
											2022-06-19 13:55:33 +02:00
										 |  |  |  *         renderings: [{ | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  *             "key":"a|b|c" | 
					
						
							| 
									
										
										
										
											2022-06-19 13:55:33 +02:00
										 |  |  |  *         }] | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  *     } | 
					
						
							|  |  |  |  * } | 
					
						
							|  |  |  |  * ```
 | 
					
						
							|  |  |  |  * will result in _three_ copies (as the values to rewrite into have three values, namely: | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * [ | 
					
						
							|  |  |  |  *   { | 
					
						
							| 
									
										
										
										
											2022-06-13 00:51:53 +02:00
										 |  |  |  *   # The first pair: key --> X, a|b|c --> 0 | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  *       "X": 0 | 
					
						
							|  |  |  |  *   }, | 
					
						
							|  |  |  |  *   { | 
					
						
							|  |  |  |  *       "Y": 1 | 
					
						
							|  |  |  |  *   }, | 
					
						
							|  |  |  |  *   { | 
					
						
							|  |  |  |  *       "Z": 2 | 
					
						
							|  |  |  |  *   } | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ] | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2022-04-03 02:37:31 +02:00
										 |  |  |  * @see ExpandRewrite | 
					
						
							| 
									
										
										
										
											2022-02-28 18:52:28 +01:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2022-02-28 17:17:38 +01:00
										 |  |  | export default interface RewritableConfigJson<T> { | 
					
						
							|  |  |  |     rewrite: { | 
					
						
							|  |  |  |         sourceString: string[] | 
					
						
							|  |  |  |         into: (string | any)[][] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     renderings: T | 
					
						
							|  |  |  | } |