public ActionResult FormatTokensHtml(string data, string language) { SetUpTokenizers(language); tokenizer.SetInput(new StringReader(data)); tokenFilter.SetSource(tokenizer); var revisedTokens = tokenFilter.ReviseTokens(); ISHFormater formater = new HtmlSHFormatter(); formater.SetSource(revisedTokens); formater.Run(); var formatedToknes = formater.GetFormatedTokens(); return(Json(formatedToknes)); }
static void Main(string[] args) { //https://www.freeformatter.com/java-dotnet-escape.html#ad-output string testData = " formater.Run(); \r\n \r\n }\r\n }\r\n}\r\n"; ISHTokenizer tokenizer = new CSharpSHTokenizer(); tokenizer.SetInput(new StringReader(testData)); ISHFilter tokenFilter = new CSharpTokenFilter(tokenizer.GetTokenRecognizer()); tokenFilter.SetSource(tokenizer); var revisedTokens = tokenFilter.ReviseTokens(); ISHFormater formater = new HtmlSHFormatter(); // vytvoříme formátor formater.SetSource(revisedTokens); //formater.SetOutput(Console.Out); formater.SetOutput(new StreamWriter("formated.txt")); formater.Run(); }