本文整理汇总了C#中System.Web.Razor.Parser.SyntaxTree.Span.ReplaceWith方法的典型用法代码示例。如果您正苦于以下问题:C# Span.ReplaceWith方法的具体用法?C# Span.ReplaceWith怎么用?C# Span.ReplaceWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Razor.Parser.SyntaxTree.Span
的用法示例。
在下文中一共展示了Span.ReplaceWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitSpan
public override void VisitSpan(Span span)
{
if (span.Kind == SpanKind.Markup && !m_DebugStatusReader.IsDebuggingEnabled())
{
string content = m_HtmlPageMinifier.Minify(span.Content, true, true);
SpanBuilder builder = new SpanBuilder { CodeGenerator = span.CodeGenerator, EditHandler = span.EditHandler, Kind = span.Kind, Start = span.Start };
MarkupSymbol symbol = new MarkupSymbol { Content = content };
builder.Accept(symbol);
span.ReplaceWith(builder);
}
base.VisitSpan(span);
}
开发者ID:LaboFoundation,项目名称:Labo.WebSiteOptimizer,代码行数:14,代码来源:HtmlMinifierMvcCSharpRazorCodeGenerator.cs
示例2: VisitSpan
public override void VisitSpan(Span span)
{
if (span.Kind == SpanKind.Markup)
{
string content = span.Content;
content = _minifier.Minify(content);
// We replace the content with the minified markup
// and then let the CSharp/VB generator do their jobs.
var builder = new SpanBuilder { CodeGenerator = span.CodeGenerator, EditHandler = span.EditHandler, Kind = span.Kind, Start = span.Start };
var symbol = new MarkupSymbol { Content = content };
builder.Accept(symbol);
span.ReplaceWith(builder);
}
base.VisitSpan(span);
}
开发者ID:random-username,项目名称:HtmlOptimizerMvc4,代码行数:18,代码来源:HtmlOptimizerMvc4CSharpRazorCodeGenerator.cs
示例3: TryPartialParse
private PartialParseResult TryPartialParse(TextChange change)
{
PartialParseResult result = PartialParseResult.Rejected;
// Try the last change owner
if (_lastChangeOwner != null && _lastChangeOwner.EditHandler.OwnsChange(_lastChangeOwner, change))
{
EditResult editResult = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change);
result = editResult.Result;
if (!editResult.Result.HasFlag(PartialParseResult.Rejected))
{
_lastChangeOwner.ReplaceWith(editResult.EditedSpan);
}
return result;
}
// Locate the span responsible for this change
_lastChangeOwner = CurrentParseTree.LocateOwner(change);
if (LastResultProvisional)
{
// Last change owner couldn't accept this, so we must do a full reparse
result = PartialParseResult.Rejected;
}
else if (_lastChangeOwner != null)
{
EditResult editRes = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change);
result = editRes.Result;
if (!editRes.Result.HasFlag(PartialParseResult.Rejected))
{
_lastChangeOwner.ReplaceWith(editRes.EditedSpan);
}
if (result.HasFlag(PartialParseResult.AutoCompleteBlock))
{
_lastAutoCompleteSpan = _lastChangeOwner;
}
else
{
_lastAutoCompleteSpan = null;
}
}
return result;
}
示例4: TryPartialParse
private PartialParseResult TryPartialParse(TextChange change)
{
PartialParseResult result = PartialParseResult.Rejected;
// Try the last change owner
if (_lastChangeOwner != null && _lastChangeOwner.EditHandler.OwnsChange(_lastChangeOwner, change))
{
EditResult editResult = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change);
result = editResult.Result;
if (!editResult.Result.HasFlag(PartialParseResult.Rejected))
{
_lastChangeOwner.ReplaceWith(editResult.EditedSpan);
}
// If the last change was provisional, then the result of this span's attempt to parse partially goes
// Otherwise, accept the change if this span accepted it, but if it didn't, just do the standard search.
if (LastResultProvisional || result.HasFlag(PartialParseResult.Accepted))
{
return result;
}
}
// Locate the span responsible for this change
_lastChangeOwner = CurrentParseTree.LocateOwner(change);
if (LastResultProvisional)
{
// Last change owner couldn't accept this, so we must do a full reparse
result = PartialParseResult.Rejected;
}
else if (_lastChangeOwner != null)
{
EditResult editRes = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change);
result = editRes.Result;
if (!editRes.Result.HasFlag(PartialParseResult.Rejected))
{
_lastChangeOwner.ReplaceWith(editRes.EditedSpan);
}
if (result.HasFlag(PartialParseResult.AutoCompleteBlock))
{
_lastAutoCompleteSpan = _lastChangeOwner;
}
else
{
_lastAutoCompleteSpan = null;
}
}
return result;
}