public void LoadHtmlDarkByName() { TextRenderer renderer = new TextRenderer(new Lexer()); renderer.Configure("HtmlDark"); Assert.AreEqual("<span style=\"color: lightgreen\">", renderer.GetFormat("StringBegin")); Assert.AreEqual("</span>", renderer.GetFormat("StringEnd")); }
public static void ProcessFile(string filename) { string text = File.ReadAllText(filename); Lexer lexer = new Lexer(); if (languages.Count > 0) { foreach (var lang in languages) { if (IsFilename(lang)) lexer.ConfigureFromFile(lang); else lexer.Configure(lang); } } else if (filename.EndsWith(".rb")) lexer.Configure("Ruby"); else if (filename.EndsWith(".cs")) lexer.Configure("CSharp"); else if (filename.EndsWith(".js")) lexer.Configure("Javascript"); else if (filename.EndsWith(".py")) lexer.Configure("Python"); else if (filename.EndsWith(".cob")) lexer.Configure("Cobol"); else if (filename.EndsWith(".ms")) lexer.Configure("Mass"); if (styles.Count == 0) { WriteToConsole(text, lexer); return; } TextRenderer renderer = new TextRenderer(lexer); foreach (var t in styles) { if (IsFilename(t)) renderer.ConfigureFromFile(t); else renderer.Configure(t); } Console.Write(renderer.Render(text)); }