void TextParsed (ILocation location, string text)
{
if (ignore_text)
return;
if (inScript) {
this.text.Append (text);
FlushText (true);
return;
}
IList blocks = SplitTextIntoBlocks (text);
foreach (TextBlock block in blocks) {
switch (block.Type) {
case TextBlockType.Verbatim:
this.text.Append (block.Content);
break;
case TextBlockType.Expression:
if (this.text.Length > 0)
FlushText (true);
CodeRenderParser r = new CodeRenderParser (block.Content, stack.Builder, location);
r.AddChildren (this);
break;
case TextBlockType.Tag:
ParseAttributeTag (block.Content, location);
break;
case TextBlockType.Comment: {
this.text.Append ("<!--");
FlushText (true);
string blockToParse = block.Content.Substring (4, block.Length - 7);
bool condEndif;
if (blockToParse.EndsWith ("<![endif]")) {
blockToParse = blockToParse.Substring (0, blockToParse.Length - 9);
condEndif = true;
} else
condEndif = false;
AspParser outerParser = location as AspParser;
int positionOffset = outerParser != null ? outerParser.BeginPosition : 0;
AspParser parser = new AspParser ("@@comment_code@@", new StringReader (blockToParse), location.BeginLine - 1, positionOffset, outerParser);
parser.Error += new ParseErrorHandler (ParseError);
parser.TagParsed += new TagParsedHandler (TagParsed);
parser.TextParsed += new TextParsedHandler (TextParsed);
parser.Parse ();
if (condEndif)
this.text.Append ("<![endif]");
this.text.Append ("-->");
FlushText (true);
break;
}
}
}
}