public List <string> ParseLine() { List <string> output = new List <string>(); StringBuilder sb = new StringBuilder(); using (StreamReader r = this) { sb.Append(r.ReadLine()); while (CountChar(sb.ToString(), '{') != CountChar(sb.ToString(), '{')) { sb.Append(r.ReadLine()); } } int j = 1; //MatchCollection mc = Regex.Matches(output[0], TeX.RegexLine); //foreach (Match m in mc) //{ // output[0] = output[0].Replace(m.ToString(), "{" + j++ + "}"); // output.Add(m.ToString()); //} return(TeX.ReadLine(sb.ToString())); }
public void EscapedCommentChar() { List <string> line = TeX.ReadLine(@"This is a line with an escaped \% in it. % not kidding"); List <string> correctLine = new List <string>(); correctLine.Add(@"This is a line with an escaped % in it. "); Assert.AreEqual(line, correctLine); }
public void LineIn() { string line = "let's get TeXy with \\things and \\textbf{otherThings}% Complete with commenty goodness \\% % ahoyhoy"; List <string> o = new List <string>(); List <string> output = TeX.ReadLine(line); o.Add("let's get TeXy with {1} and {2}"); o.Add("\\things"); o.Add("\\textbf{otherThings}"); Assert.AreEqual(output, o); }