예제 #1
0
        private void VisitExpressionScope(ExpressionDocumentItemBase documentItem, char prefix)
        {
            StringBuilder.Append("{{");
            CheckForInlineTagLineBreakAtStart(documentItem);
            StringBuilder.Append(prefix);
            StringBuilder.Append(ReparseExpression(documentItem.MorestachioExpression));
            var children          = documentItem.Children.ToList();
            var aliasDocumentItem = children.FirstOrDefault() as AliasDocumentItem;

            if (!(aliasDocumentItem is null))
            {
                StringBuilder.Append(" AS ");
                StringBuilder.Append(aliasDocumentItem.Value);
            }

            CheckForInlineTagLineBreakAtEnd(documentItem);
            StringBuilder.Append("}}");

            if (children.Any())
            {
                VisitChildren(documentItem);

                StringBuilder.Append("{{/");
                CheckForInlineBlockLineBreakAtStart(documentItem);
                if (!(aliasDocumentItem is null))
                {
                    StringBuilder.Append(aliasDocumentItem.Value);
                }
                else
                {
                    StringBuilder.Append(ReparseExpression(documentItem.MorestachioExpression));
                }
                CheckForInlineBlockLineBreakAtEnd(documentItem);
                StringBuilder.Append("}}");
            }
        /// <summary>
        ///		Writes the tag with the leading char as well as all of the documentItems children
        /// </summary>
        /// <param name="documentItem"></param>
        /// <param name="tag"></param>
        /// <param name="cmdChar"></param>
        public void Visit(ExpressionDocumentItemBase documentItem, string tag, string cmdChar = "#")
        {
            StringBuilder.Append("{{");
            StringBuilder.Append(cmdChar);
            StringBuilder.Append(tag);
            StringBuilder.Append(ReparseExpression(documentItem.MorestachioExpression));
            var children          = documentItem.Children.ToList();
            var aliasDocumentItem = children.FirstOrDefault() as AliasDocumentItem;

            if (!(aliasDocumentItem is null))
            {
                StringBuilder.Append(" AS ");
                StringBuilder.Append(aliasDocumentItem.Value);
            }

            StringBuilder.Append("}}");

            if (children.Any())
            {
                VisitChildren(documentItem);

                StringBuilder.Append("{{/");
                if (!(aliasDocumentItem is null))
                {
                    StringBuilder.Append(aliasDocumentItem.Value);
                }
                else
                {
                    StringBuilder.Append(tag.Trim());
                }
                StringBuilder.Append("}}");
            }
예제 #3
0
 /// <summary>
 ///		Writes the tag with the leading char as well as all of the documentItems children
 /// </summary>
 /// <param name="documentItem"></param>
 /// <param name="tag"></param>
 /// <param name="cmdChar"></param>
 public void Visit(ExpressionDocumentItemBase documentItem, string tag, string cmdChar = "#")
 {
     RenderExpressionTagHead(documentItem, tag, cmdChar);
     if (documentItem.Children.Any())
     {
         VisitChildren(documentItem);
         RenderBlockFooter(documentItem, tag);
     }
 }
예제 #4
0
        private void RenderExpressionTagHead(ExpressionDocumentItemBase documentItem, string tag, string cmdChar = "#")
        {
            StringBuilder.Append("{{");
            CheckForInlineTagLineBreakAtStart(documentItem);
            StringBuilder.Append(cmdChar);
            StringBuilder.Append(tag);
            StringBuilder.Append(ReparseExpression(documentItem.MorestachioExpression));
            var aliasDocumentItem = documentItem.Children.FirstOrDefault() as AliasDocumentItem;

            if (!(aliasDocumentItem is null))
            {
                StringBuilder.Append(" AS ");
                StringBuilder.Append(aliasDocumentItem.Value);
            }

            CheckForInlineTagLineBreakAtEnd(documentItem);
            StringBuilder.Append("}}");
        }