// Path: src/main/java/com/cadrlife/jhaml/JHamlConfig.java
// public class JHamlConfig {
// 	public static final int OUTPUT_INDENTATION_SIZE = 2;
// 	public static final ImmutableList<String> validFormats = ImmutableList.of("xhtml","html4","html5");
// 	public String format = "xhtml";
// 	public List<String> autoclose = Lists.newArrayList("meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base");
// 	public List<String> preserve = Lists.newArrayList("textarea", "pre");
// 	public String attrWrapper = "'";
// 	
// 	public Map<String,Filter> filters = new HashMap<String,Filter>();
// 	{
// 		filters.put("plain", new PlainFilter(this));
// 		filters.put("javascript", new JavaScriptFilter(this));
// 		filters.put("cdata", new CdataFilter(this));
// 		filters.put("escaped", new EscapedFilter(this));
// 		filters.put("preserve", new PreserveFilter(this));
// 		filters.put("jsp", new JspFilter(this));
// 		filters.put("css", new CssFilter(this));
// 		filters.put("markdown", new MarkdownFilter(this));
// 	}
// 	
// 	public boolean isXhtml() {
// 		return !isHtml();
// 	}
// 	public boolean isHtml() {
// 		return isHtml4() || isHtml5();
// 	}
// 	public boolean isHtml4() {
// 		return "html4".equals(this.format);
// 	}
// 	public boolean isHtml5() {
// 		return "html5".equals(this.format);
// 	}
// 	
// 	// These options escapeHtml, suppressEval, and encoding may not be necessary.
// 	//	boolean escapeHtml = false;
// 	//	boolean suppressEval = false;
// 	//	String encoding = "utf-8";
// }


import static org.junit.Assert.*;
import org.junit.Test;
import com.cadrlife.jhaml.JHamlConfig;

	
	@Test
	public void attributesCanContainElWhichShouldNotBeEscaped() {
		assertEquals("<html a='${foo(arg)}'></html>", render("%html(a=\"${foo(arg)}\")"));
		assertEquals("<html a='${a && b}'></html>", render("%html(a=\"${a && b}\")"));
		
		assertEquals("<html a='blah ${a && b}'></html>", render("%html(a=\"blah ${a && b}\")"));
		
		/* The code is not yet sophisticated enough to know to escape the parts outside the EL but not inside.
		   In the meantime, just avoiding escaping entirely when an attribute value looks like it contains EL.
		   Can do more if/when the need arises.
		*/
//		assertEquals("<html a='&amp; ${a && b}'></html>", render("%html(a=\"& ${a && b}\")"));
	}
	
	@Test
	public void bothStylesOfAttributes() {
		assertEquals("<html a='b' b='c'></html>", render("%html(a='b'){:b=>'c'}"));
		assertEquals("<html a='b' b='c'></html>", render("%html{:b=>'c'}(a='b')"));
		assertEquals("<html a='b' b='c'>(d='e')</html>", render("%html{:b=>'c'}(a='b')(d='e')"));
		assertEquals("<html a='b' b='c'>{:d=>'e'}</html>", render("%html{:b=>'c'}(a='b'){:d=>'e'}"));
	}
	
	@Test
	public void defaultToTrue() {
		assertEquals("<html a='a' b='b'></html>", render("%html(a b)"));
		assertEquals("<html a b></html>", renderWithFormat("html5", "%html(a b)"));
	}
	
	private String renderWithFormat(String format, String haml) {

// Path: src/main/java/com/cadrlife/jhaml/JHamlConfig.java
// public class JHamlConfig {
// 	public static final int OUTPUT_INDENTATION_SIZE = 2;
// 	public static final ImmutableList<String> validFormats = ImmutableList.of("xhtml","html4","html5");
// 	public String format = "xhtml";
// 	public List<String> autoclose = Lists.newArrayList("meta", "img", "link", "br", "hr", "input", "area", "param", "col", "base");
// 	public List<String> preserve = Lists.newArrayList("textarea", "pre");
// 	public String attrWrapper = "'";
// 	
// 	public Map<String,Filter> filters = new HashMap<String,Filter>();
// 	{
// 		filters.put("plain", new PlainFilter(this));
// 		filters.put("javascript", new JavaScriptFilter(this));
// 		filters.put("cdata", new CdataFilter(this));
// 		filters.put("escaped", new EscapedFilter(this));
// 		filters.put("preserve", new PreserveFilter(this));
// 		filters.put("jsp", new JspFilter(this));
// 		filters.put("css", new CssFilter(this));
// 		filters.put("markdown", new MarkdownFilter(this));
// 	}
// 	
// 	public boolean isXhtml() {
// 		return !isHtml();
// 	}
// 	public boolean isHtml() {
// 		return isHtml4() || isHtml5();
// 	}
// 	public boolean isHtml4() {
// 		return "html4".equals(this.format);
// 	}
// 	public boolean isHtml5() {
// 		return "html5".equals(this.format);
// 	}
// 	
// 	// These options escapeHtml, suppressEval, and encoding may not be necessary.
// 	//	boolean escapeHtml = false;
// 	//	boolean suppressEval = false;
// 	//	String encoding = "utf-8";
// }


// Path: src/test/java/com/cadrlife/jhaml/HtmlStyleAttributeHashTest.java
import static org.junit.Assert.*;
import org.junit.Test;
import com.cadrlife.jhaml.JHamlConfig;

	
	@Test
	public void attributesCanContainElWhichShouldNotBeEscaped() {
		assertEquals("<html a='${foo(arg)}'></html>", render("%html(a=\"${foo(arg)}\")"));
		assertEquals("<html a='${a && b}'></html>", render("%html(a=\"${a && b}\")"));
		
		assertEquals("<html a='blah ${a && b}'></html>", render("%html(a=\"blah ${a && b}\")"));
		
		/* The code is not yet sophisticated enough to know to escape the parts outside the EL but not inside.
		   In the meantime, just avoiding escaping entirely when an attribute value looks like it contains EL.
		   Can do more if/when the need arises.
		*/
//		assertEquals("<html a='&amp; ${a && b}'></html>", render("%html(a=\"& ${a && b}\")"));
	}
	
	@Test
	public void bothStylesOfAttributes() {
		assertEquals("<html a='b' b='c'></html>", render("%html(a='b'){:b=>'c'}"));
		assertEquals("<html a='b' b='c'></html>", render("%html{:b=>'c'}(a='b')"));
		assertEquals("<html a='b' b='c'>(d='e')</html>", render("%html{:b=>'c'}(a='b')(d='e')"));
		assertEquals("<html a='b' b='c'>{:d=>'e'}</html>", render("%html{:b=>'c'}(a='b'){:d=>'e'}"));
	}
	
	@Test
	public void defaultToTrue() {
		assertEquals("<html a='a' b='b'></html>", render("%html(a b)"));
		assertEquals("<html a b></html>", renderWithFormat("html5", "%html(a b)"));
	}
	
	private String renderWithFormat(String format, String haml) {

		JHamlConfig config = new JHamlConfig();
