package me.totalfreedom.totalfreedommod.httpd;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import static org.apache.commons.lang3.StringEscapeUtils.escapeHtml4;
public class HTMLGenerationTools
{
private HTMLGenerationTools()
{
throw new AssertionError();
}
public static String paragraph(String data)
{
return "
" + escapeHtml4(data) + "
\r\n";
}
public static String heading(String data, int level)
{
return "" + escapeHtml4(data) + "\r\n";
}
public static String list(Map map)
{
StringBuilder output = new StringBuilder();
output.append("\r\n");
Iterator> it = map.entrySet().iterator();
while (it.hasNext())
{
Map.Entry entry = it.next();
output.append("- ").append(escapeHtml4(entry.getKey().toString() + " = " + entry.getValue().toString())).append("
\r\n");
}
output.append("
\r\n");
return output.toString();
}
public static String list(Collection list)
{
StringBuilder output = new StringBuilder();
output.append("\r\n");
for (T entry : list)
{
output.append("- ").append(escapeHtml4(entry.toString())).append("
\r\n");
}
output.append("
\r\n");
return output.toString();
}
}