Exemplo n.º 1
0
        public void Test4()
        {
            StringReader reader = new StringReader(@"%script{type=""text/javascript""}
	function selectAll(source, cat) {
		var elems = $('tbl').getElementsByClassName(cat);
		for each (var item in elems)
			$(item).checked = source.checked;
	}"    );

            _generator.Parse(reader);
            _generator.PrintDocument();

            StringBuilder sb     = new StringBuilder();
            StringWriter  writer = new StringWriter(sb);

            _generator.GenerateCode(writer);
        }
Exemplo n.º 2
0
        protected static string Parse(string text)
        {
            HamlGenerator parser = new HamlGenerator();
            TextReader    input  = new StringReader(text);

            parser.Parse(input);

            StringBuilder sb     = new StringBuilder();
            TextWriter    output = new StringWriter(sb);

            parser.GenerateCode(output);

            return(output.ToString());
        }
Exemplo n.º 3
0
        public void TestSelfClosing()
        {
            HamlGenerator parser = new HamlGenerator();

            TextReader input = new StringReader("%img{src=\"bild\",border=\"1\"}");

            parser.Parse(input);

            StringWriter output = new StringWriter(new StringBuilder());

            parser.GenerateCode(output);

            Assert.Equal("sb.Append(@\"<img src=\"\"bild\"\" border=\"\"1\"\"/>\");", output.ToString());
        }