]> WPIA git - gigi.git/blobdiff - src/club/wpia/gigi/output/template/PlainOutputable.java
upd: rename package name and all references to it
[gigi.git] / src / club / wpia / gigi / output / template / PlainOutputable.java
diff --git a/src/club/wpia/gigi/output/template/PlainOutputable.java b/src/club/wpia/gigi/output/template/PlainOutputable.java
new file mode 100644 (file)
index 0000000..a4fdb7c
--- /dev/null
@@ -0,0 +1,26 @@
+package club.wpia.gigi.output.template;
+
+import java.io.PrintWriter;
+import java.util.Map;
+
+import club.wpia.gigi.localisation.Language;
+import club.wpia.gigi.util.HTMLEncoder;
+
+public class PlainOutputable implements Outputable {
+
+    String text;
+
+    public PlainOutputable(String text) {
+        this.text = text;
+    }
+
+    @Override
+    public void output(PrintWriter out, Language l, Map<String, Object> vars) {
+        if (vars.containsKey(OUT_KEY_PLAIN)) {
+            out.print(text);
+        } else {
+            out.print(HTMLEncoder.encodeHTML(text));
+        }
+    }
+
+}