Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git
src/main/java/com/keenwrite/processors/text/TextReplacementFactory.java
package com.keenwrite.processors.text;
+import com.keenwrite.util.Strings;
+
import java.util.Map;
* recursively defined values must have been interpolated previously.
*
- * @param haystack The text containing zero or more variables to replace.
- * @param needles The map of variables to their dereferenced values.
+ * @param text The text containing zero or more variables to replace.
+ * @param needles The map of variables to their dereferenced values.
* @return The text with all variables replaced.
*/
public static String replace(
- final String haystack, final Map<String, String> needles ) {
- assert haystack != null;
+ final String text, final Map<String, String> needles ) {
+ final String haystack = Strings.sanitize( text );
assert needles != null;

Adds check for null replacement text

Author DaveJarvis <email>
Date 2023-12-30 15:29:52 GMT-0800
Commit 7d8ffa71f926fe75259c11669f00e59b176cc7cc
Parent d4b751c
Delta 6 lines added, 4 lines removed, 2-line increase