weblib: use templates for all html
[fanfix.git] / src / be / nikiroo / fanfix / library / Template.java
index 2dfbacfeb1092780f81686762eb6bf10bb6ee37f..3ec987332913bc4613c71f58d5e2830964aeba6c 100644 (file)
@@ -64,31 +64,27 @@ public class Template {
 
                        i++;
                }
-               
+
                InputStream in = IOUtils.openResource(location, name);
-               
-               InputStream stream;
-               
-               stream = IOUtils.openResource(location, name);
-               System.out.println("SOURCE = (("  + IOUtils.readSmallStream(stream) + "))");
-               stream=new ReplaceInputStream(IOUtils.openResource(location, name), from, to);
-               System.out.println("RESULT = (("  + IOUtils.readSmallStream(stream) + "))");
-               
-               
                return new ReplaceInputStream(in, from, to);
        }
 
        public synchronized Template set(String key, String value) {
-               values.put(key, value);
+               values.put(key, value == null ? "" : key);
                valuesTemplate.remove(key);
                valuesTemplateList.remove(key);
                return this;
        }
 
        public synchronized Template set(String key, Template value) {
+               if (value == null) {
+                       return set(key, "");
+               }
+
                values.remove(key);
                valuesTemplate.put(key, value);
                valuesTemplateList.remove(key);
+
                return this;
        }