Beispiel #1
0
        private static void GetStyleInsertionsForCapturedStyle(ColorCode.Parsing.Scope scope
                                                               , System.Collections.Generic.ICollection <ColorCode.Common.TextInsertion> styleInsertions)
        {
            styleInsertions.Add(new ColorCode.Common.TextInsertion {
                Index = scope.Index,
                Scope = scope
            });


            foreach (ColorCode.Parsing.Scope childScope in scope.Children)
            {
                GetStyleInsertionsForCapturedStyle(childScope, styleInsertions);
            }

            styleInsertions.Add(new ColorCode.Common.TextInsertion {
                Index = scope.Index + scope.Length,
                Text  = "</span>"
            });
        }
Beispiel #2
0
        private static void BuildSpanForCapturedStyle(ColorCode.Parsing.Scope scope,
                                                      IStyleSheet styleSheet,
                                                      System.IO.TextWriter writer)
        {
            string foreground = string.Empty;
            string background = string.Empty;
            bool   italic     = false;
            bool   bold       = false;

            if (styleSheet.Styles.Contains(scope.Name))
            {
                ColorCode.Styling.Style style = styleSheet.Styles[scope.Name];

                foreground = style.Foreground;
                background = style.Background;
                italic     = style.Italic;
                bold       = style.Bold;
            }

            WriteElementStart(writer, "span", foreground, background, italic, bold);
        }
Beispiel #3
0
 internal static Flagment FromScope(int baseIndex, string token, ColorCode.Parsing.Scope scope, ColorCode.IStyleSheet stylesheet)
 {
     return(new Flagment(scope.Name, token.Substring(scope.Index, scope.Length), stylesheet.Styles[scope.Name].Foreground,
                         baseIndex + scope.Index, scope.Length));
 }