public BlockClosingAction RenderSilentEval(ViewSourceReader viewSourceReader, TemplateClassBuilder builder)
        {
            var code = viewSourceReader.CurrentInputLine.NormalizedText;

            builder.AppendSilentCode(code, false);

            if( viewSourceReader.IsBlock )
            {
                builder.BeginCodeBlock();

                if( !viewSourceReader.CurrentInputLine.NormalizedText.Trim().Split( ' ' )[0].ToUpperInvariant().Equals( "CASE" ) )
                {
                    return () =>
                      {
                          if( (viewSourceReader.CurrentInputLine.Text.TrimStart().StartsWith(SilentEvalMarkupRule.SignifierChar)) &&
                            MidBlockKeywords.Contains( viewSourceReader.CurrentInputLine.NormalizedText.Trim().Split( ' ' )[0].ToUpperInvariant() ) )
                          {
                              builder.Unindent();
                          }
                          else
                          {
                              builder.EndCodeBlock();
                          }
                      };
                }
            }

            return MarkupRule.EmptyClosingAction;
        }
Beispiel #2
0
        public BlockClosingAction RenderSilentEval(ViewSourceReader viewSourceReader, TemplateClassBuilder builder)
        {
            var code = viewSourceReader.CurrentInputLine.NormalizedText;

            builder.AppendSilentCode(code, false);

            if (viewSourceReader.IsBlock)
            {
                builder.BeginCodeBlock();

                if (!viewSourceReader.CurrentInputLine.NormalizedText.Trim().Split(' ')[0].ToUpperInvariant().Equals("CASE"))
                {
                    return(() =>
                    {
                        if ((viewSourceReader.CurrentInputLine.Text.TrimStart().StartsWith(SilentEvalMarkupRule.SignifierChar)) &&
                            MidBlockKeywords.Contains(viewSourceReader.CurrentInputLine.NormalizedText.Trim().Split(' ')[0].ToUpperInvariant()))
                        {
                            builder.Unindent();
                        }
                        else
                        {
                            builder.EndCodeBlock();
                        }
                    });
                }
            }

            return(MarkupRule.EmptyClosingAction);
        }
Beispiel #3
0
        public override BlockClosingAction Render(ViewSourceReader viewSourceReader, TemplateOptions options, TemplateClassBuilder builder)
        {
            var text         = viewSourceReader.CurrentInputLine.NormalizedText.TrimStart();
            var indexOfSpace = text.IndexOf(' ');
            var sectionName  = text.Substring(indexOfSpace + 1, text.Length - indexOfSpace - 1);
            var code         = string.Format("{0}).AddSection(\"{1}\", x =>", viewSourceReader.CurrentInputLine.Indent, sectionName);

            builder.EndCodeBlock();
            builder.Indent();

            builder.AppendSilentCode(code, false);
            builder.BeginCodeBlock();


            return(builder.Unindent);
        }