protected override void Visit(SendLiteralChunk chunk)
 {
     if (!string.IsNullOrEmpty(chunk.Text))
     {
         string str = chunk.Text.Replace(@"\", @"\\").Replace("\t", @"\t").Replace("\r", @"\r").Replace("\n", @"\n").Replace("\"", "\\\"");
         this._source.Append("Output.Write(\"").Append(str).AppendLine("\");");
     }
 }
Example #2
0
        protected override void Visit(SendLiteralChunk chunk)
        {
            if (string.IsNullOrEmpty(chunk.Text))
                return;

            CodeHidden();
            _source.Write("Output.Write(\"").Write(EscapeStringContents(chunk.Text)).WriteLine("\");");
            CodeDefault();
        }
Example #3
0
 protected override void Visit(SendLiteralChunk chunk)
 {
     if (!string.IsNullOrEmpty(chunk.Text))
     {
         this.CodeHidden();
         this._source.Write("Output.Write(\"").Write(EscapeStringContents(chunk.Text)).WriteLine("\")");
         this.CodeDefault();
     }
 }
        protected override void Visit(SendLiteralChunk chunk)
        {
            if (string.IsNullOrEmpty(chunk.Text))
                return;

            var text =
                chunk.Text.Replace("\\", "\\\\").Replace("\t", "\\t").Replace("\r", "\\r").Replace("\n", "\\n").Replace(
                    "\"", "\\\"");
            _source.Append("Output.Write(\"").Append(text).AppendLine("\");");
        }
        protected override void Visit(SendLiteralChunk chunk)
        {
            if (string.IsNullOrEmpty(chunk.Text))
            {
                return;
            }

            var text =
                chunk.Text.Replace("\\", "\\\\").Replace("\t", "\\t").Replace("\r", "\\r").Replace("\n", "\\n").Replace(
                    "\"", "\\\"");

            _source.Append("Output.Write(\"").Append(text).AppendLine("\");");
        }
Example #6
0
        private void AddLiteral(string text)
        {
            var sendLiteral = Chunks.LastOrDefault() as SendLiteralChunk;

            if (sendLiteral == null)
            {
                sendLiteral = new SendLiteralChunk {
                    Text = text
                };
                Chunks.Add(sendLiteral);
            }
            else
            {
                sendLiteral.Text += text;
            }
        }
Example #7
0
        private void AddLiteral(string text)
        {
            SendLiteralChunk item = this.Chunks.LastOrDefault <Chunk>() as SendLiteralChunk;

            if (item == null)
            {
                item = new SendLiteralChunk {
                    Text = text
                };
                this.Chunks.Add(item);
            }
            else
            {
                item.Text = item.Text + text;
            }
        }
 protected abstract void Visit(SendLiteralChunk chunk);
Example #9
0
 protected override void Visit(SendLiteralChunk chunk)
 {
     //no-op
 }
Example #10
0
 private void AddLiteral(string text)
 {
     var sendLiteral = Chunks.LastOrDefault() as SendLiteralChunk;
     if (sendLiteral == null)
     {
         sendLiteral = new SendLiteralChunk { Text = text };
         Chunks.Add(sendLiteral);
     }
     else
     {
         sendLiteral.Text += text;
     }
 }
Example #11
0
 protected abstract void Visit(SendLiteralChunk chunk);
Example #12
0
 protected override void Visit(SendLiteralChunk chunk)
 {
     _source.Write("OutputWriteAdapter(\"").Write(EscapeStringContents(chunk.Text)).WriteLine("\")");
 }
 protected override void Visit(SendLiteralChunk chunk)
 {
     //no-op
 }
Example #14
0
        protected override void Visit(AttributeNode attributeNode)
        {
            List <Node> priorNodes = new List <Node>();
            List <Node> source     = new List <Node>();

            foreach (Node node in attributeNode.Nodes)
            {
                if (node is ConditionNode)
                {
                    ConditionNode condition = (ConditionNode)node;
                    MovePriorNodesUnderCondition(condition, priorNodes);
                    source.AddRange(priorNodes);
                    source.Add(condition);
                    priorNodes.Clear();
                }
                else
                {
                    priorNodes.Add(node);
                }
            }
            source.AddRange(priorNodes);
            if (!source.All <Node>(node => (node is ConditionNode)) || !source.Any <Node>())
            {
                this.AddLiteral(string.Format(" {0}={1}", attributeNode.Name, attributeNode.QuotChar));
                foreach (Node node3 in source)
                {
                    base.Accept(node3);
                }
                this.AddLiteral(attributeNode.QuotChar.ToString());
            }
            else
            {
                ScopeChunk         item   = new ScopeChunk();
                LocalVariableChunk chunk3 = new LocalVariableChunk {
                    Name  = "__just__once__",
                    Value = new Snippets("0")
                };
                item.Body.Add(chunk3);
                ConditionalChunk chunk4 = new ConditionalChunk {
                    Type      = ConditionalType.If,
                    Condition = new Snippets("__just__once__ < 1")
                };
                this._sendAttributeOnce = chunk4;
                SendLiteralChunk chunk5 = new SendLiteralChunk {
                    Text = " " + attributeNode.Name + "=\""
                };
                this._sendAttributeOnce.Body.Add(chunk5);
                AssignVariableChunk chunk6 = new AssignVariableChunk {
                    Name  = "__just__once__",
                    Value = "1"
                };
                this._sendAttributeIncrement = chunk6;
                this.Chunks.Add(item);
                using (new Frame(this, item.Body))
                {
                    foreach (Node node4 in source)
                    {
                        base.Accept(node4);
                    }
                }
                this._sendAttributeOnce      = null;
                this._sendAttributeIncrement = null;
                ConditionalChunk chunk2 = new ConditionalChunk {
                    Type      = ConditionalType.If,
                    Condition = new Snippets("__just__once__ > 0")
                };
                item.Body.Add(chunk2);
                SendLiteralChunk chunk8 = new SendLiteralChunk {
                    Text = "\""
                };
                chunk2.Body.Add(chunk8);
            }
        }