Loyc.Syntax.Les.Les3PrettyPrinter.GetDefaultCssClassTable C# (CSharp) Method

GetDefaultCssClassTable() public static method

The lookup table of strings for control codes (LesColorCode values) to HTML classes.
For example, GetDefaultCssClassTable()[(int)LesColorCode.Number] indicates the default CSS class to use for numbers. If the entry for a given code is null, no span element is emitted, which shortens the output. The default class names are shared with the Pygments syntax highlighting system. A list of the CSS classes available in Pygments is available at this link. Only a small subset of these classes are used in this table. Here is some suitable CSS:
 .highlight { background-color: #f8f8f8; color: #111; } .highlight .c  { color: #5A5; } /* Comment */ .highlight .n  { color: #111; } /* Name (omitted by default) */ .highlight .m  { color: #909; } /* Number */ .highlight .s  { color: #B44; } /* String */ .highlight .l  { color: #B04; } /* Literal (other) */ .highlight .kc { color: #41F; } /* Keyword.Constant */ .highlight .o  { color: #940; } /* Operator */ .highlight .p  { color: #111; } /* Punctuation (omitted by default) */ .highlight .kp { color: #33A; } /* Keyword.Pseudo (@attribute) */ .highlight .nb { color: #007; } /* Name.Builtin (#specialId) */ .highlight .k  { color: #11F; } /* Keyword (.dotId) */ .highlight .x  { color: #D00; } /* Other */ .highlight .pi { color: #B50; } /* Parenthesis Inner (()) */ 
Note: LesTokenCode.Opener and LesTokenCode.Closer are handled specially. An opener and its matching closer (e.g. '(' and ')') are always given the same color, but nested parens/brackets are given alternating colors (CSS classes), with the entry for LesTokenCode.Opener used for outer parens and the entry for LesTokenCode.Closer used for inner parens. The default class name is "pi" for inner parentheses; no class name is used for outer parens. "pi" is not a standard name, so if you're using a standard Pygment stylesheet you should add an extra line, e.g.
 .highlight .p { color: #111; } /* Punctuation (includes , ; { }) */ .highlight .pi { color: #B50; } /* Parenthesis Inner */ 
public static GetDefaultCssClassTable ( ) : string[]
return string[]
		public static string[] GetDefaultCssClassTable()
		{
			var names = new string[32];
			names[(int)LesColorCode.Comment       ] = "c";  // Comment
			names[(int)LesColorCode.Id            ] = null;  // Name is "n" but use null to shorten output
			names[(int)LesColorCode.Number        ] = "m";  // Number
			names[(int)LesColorCode.String        ] = "s";  // String
			names[(int)LesColorCode.CustomLiteral ] = "l";  // Literal
			names[(int)LesColorCode.KeywordLiteral] = "kc"; // Keyword.Constant
			names[(int)LesColorCode.Operator      ] = "o";  // Operator
			names[(int)LesColorCode.Separator     ] = null;  // Punctuation is "p" but use null to shorten output
			names[(int)LesColorCode.Attribute     ] = "kp"; // Keyword.Pseudo
			names[(int)LesColorCode.SpecialId     ] = "nb"; // Name.Builtin
			names[(int)LesColorCode.Keyword       ] = "k"; // Keyword
			names[(int)LesColorCode.Unknown       ] = "x"; // Other
			names[(int)LesColorCode.Opener        ] = null; // Outer parenthesis
			names[(int)LesColorCode.Closer        ] = "pi"; // Inner parenthesis
			return names;
		}