X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2Foutput%2Ftemplate%2FSprintfCommand.java;h=8d42af44f4b76f5e7fff844a8e6d28f20604dff7;hp=9cafef4787f58fd9f7451cdf1ceae85e455e09db;hb=5a872d87a5249a27436ca3e1225e4f583842ad41;hpb=480cb29387c76ccc19f8fa8fb0abe8ae1b069730 diff --git a/src/org/cacert/gigi/output/template/SprintfCommand.java b/src/org/cacert/gigi/output/template/SprintfCommand.java index 9cafef47..8d42af44 100644 --- a/src/org/cacert/gigi/output/template/SprintfCommand.java +++ b/src/org/cacert/gigi/output/template/SprintfCommand.java @@ -1,7 +1,7 @@ package org.cacert.gigi.output.template; import java.io.PrintWriter; -import java.util.LinkedList; +import java.util.List; import java.util.Map; import org.cacert.gigi.localisation.Language; @@ -12,22 +12,26 @@ public final class SprintfCommand implements Outputable { private final String text; - private final LinkedList store; + private final String[] store; - public SprintfCommand(String text, LinkedList store) { + public SprintfCommand(String text, List store) { this.text = text; - this.store = store; + this.store = store.toArray(new String[store.size()]); } @Override public void output(PrintWriter out, Language l, Map vars) { - String[] parts = l.getTranslation(text).split("%s"); - String[] myvars = store.toArray(new String[store.size()]); + String[] parts = l.getTranslation(text).split("%s", -1); + String[] myvars = store; out.print(HTMLEncoder.encodeHTML(parts[0])); for (int j = 1; j < parts.length; j++) { String var = myvars[j - 1]; if (var.startsWith("$!")) { Template.outputVar(out, l, vars, myvars[j - 1].substring(2), true); + } else if (var.startsWith("!\"")) { + out.print(var.substring(2)); + } else if (var.startsWith("\"")) { + out.print(HTMLEncoder.encodeHTML(var.substring(1))); } else { Template.outputVar(out, l, vars, myvars[j - 1].substring(1), false); }