append() public method

public append ( String str ) : IndentWriter
str String
return IndentWriter
Example #1
0
        //throws JadeCompilerException
        public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template)
        {
            try
            {
                Object result = ExpressionHandler.evaluateStringExpression(getValue(), model);
                if (result == null || !buffer)
                {
                    return;
                }
                String str = result.ToString();
                if (escape)
                {
                    str = Utils.escapeHTML(str);
                }
                writer.append(str);

                if (hasBlock())
                {
                    writer.increment();
                    block.execute(writer, model, template);
                    writer.decrement();
                    writer.newline();
                }

            }
            catch (ExpressionException e)
            {
                throw new JadeCompilerException(this, template.getTemplateLoader(), e);
            }
        }
Example #2
0
        //throws JadeCompilerException
        public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template)
        {
            String name = getValue();
            if (name == null)
            {
                name = "5";
            }
            String doctypeLine = Doctypes.get(name);
            if (doctypeLine == null)
            {
                doctypeLine = "<!DOCTYPE " + name + ">";
            }

            if (doctypeLine.StartsWith("<?xml"))
            {
                template.setMode(Jade4Net.Mode.XML);
            }
            else if (doctypeLine.Equals("<!DOCTYPE html>"))
            {
                template.setMode(Jade4Net.Mode.HTML);
            }
            else
            {
                template.setMode(Jade4Net.Mode.XHTML);
            }

            writer.append(doctypeLine);
        }
Example #3
0
 // throws JadeCompilerException
 public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template)
 {
     if (!isBuffered())
     {
         return;
     }
     writer.newline();
     if (value.StartsWith("if"))
     {
         writer.append("<!--[" + value + "]>");
         block.execute(writer, model, template);
         writer.append("<![endif]-->");
     }
     else
     {
         writer.append("<!--" + value);
         block.execute(writer, model, template);
         writer.append("-->");
     }
 }
Example #4
0
 //throws JadeCompilerException
 public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template)
 {
     var filter = model.getFilter(getValue());
     String result = textBlock.getValue();
     if (filter != null)
     {
         result = filter.convert(result, attributes, model);
     }
     try
     {
         result = Utils.interpolate(result, model, false);
     }
     catch (ExpressionException e)
     {
         throw new JadeCompilerException(this, template.getTemplateLoader(), e);
     }
     writer.append(result);
 }
Example #5
0
 //throws JadeCompilerException
 public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template)
 {
     writer.newline();
     writer.append("<");
     writer.append(name);
     writer.append(Attributes(model, template));
     if (isTerse(template))
     {
         writer.append(">");
         return;
     }
     if (isSelfClosing(template) || (selfClosing && isEmpty()))
     {
         writer.append("/>");
         return;
     }
     writer.append(">");
     if (hasTextNode())
     {
         textNode.execute(writer, model, template);
     }
     if (hasBlock())
     {
         writer.increment();
         block.execute(writer, model, template);
         writer.decrement();
         writer.newline();
     }
     if (hasCodeNode())
     {
         codeNode.execute(writer, model, template);
     }
     writer.append("</");
     writer.append(name);
     writer.append(">");
 }
Example #6
0
 //throws JadeCompilerException
 public override void execute(IndentWriter writer, JadeModel model, JadeTemplate template)
 {
     writer.append(value);
 }