package lib.sbet;

import java.util.Map;

/**
 * This class contains most common logic for text parsing & beans manipulation used by {@link SbetWriter} implementations.
 */
public abstract class BaseSbetWriter implements SbetWriter{


    /**
     *
     * @param input an input string, possibly with some templating elements
     * @return the output string, with all templating elements evaluated using the passed data.
     */
    public String convertString(String input, Map<String, Object> data) {
        // TODO
    }

    /**
     *
     * @param expression a Sbet expression (~ BeanUtils expression)
     * @param data the data to use to evaluate the expression
     * @return the evaluated expression, or an empty String if there's a null value along the path.
     */
    public String evaluateExpression(String expression, Map<String, Object> data) {
        // TODO
    }
}

@@ -489,32 +489,308 @@
 Object%3E data) %7B%0A
+        String expression;%0A        while ((expression = getFirstExpression(input)) != null)  %7B%0A                input = input.replace(expression, evaluateExpression(expression, data));%0A        %7D%0A        return input;%0A    %7D%0A%0A    public String getFirstExpression(String input) %7B%0A
         // TODO%0A
@@ -878,16 +878,49 @@
 ression)
+, with the enclosing curly braces
 %0A     * 

work in progress - broken compile