internal static async Task <object> ParseAsync(IParseManager parseManager) { var contextInfo = parseManager.ContextInfo; // 如果是实体标签则返回空 if (contextInfo.IsStlEntity) { return(string.Empty); } var inline = false; var onBeforeSend = string.Empty; var onSuccess = string.Empty; var onComplete = string.Empty; var onError = string.Empty; foreach (var name in contextInfo.Attributes.AllKeys) { var value = contextInfo.Attributes[name]; if (StringUtils.EqualsIgnoreCase(name, Context)) { contextInfo.ContextType = TranslateUtils.ToEnum(value, ParseType.Undefined); } else if (StringUtils.EqualsIgnoreCase(name, Inline)) { inline = TranslateUtils.ToBool(value); } else if (StringUtils.EqualsIgnoreCase(name, OnBeforeSend)) { onBeforeSend = await parseManager.ReplaceStlEntitiesForAttributeValueAsync(value); } else if (StringUtils.EqualsIgnoreCase(name, OnSuccess)) { onSuccess = await parseManager.ReplaceStlEntitiesForAttributeValueAsync(value); } else if (StringUtils.EqualsIgnoreCase(name, OnComplete)) { onComplete = await parseManager.ReplaceStlEntitiesForAttributeValueAsync(value); } else if (StringUtils.EqualsIgnoreCase(name, OnError)) { onError = await parseManager.ReplaceStlEntitiesForAttributeValueAsync(value); } } StlParserUtility.GetLoading(contextInfo.InnerHtml, out var loading, out var template); if (!string.IsNullOrEmpty(loading)) { var innerBuilder = new StringBuilder(loading); await parseManager.ParseInnerContentAsync(innerBuilder); loading = innerBuilder.ToString(); } return(await ParseAsync(parseManager, contextInfo.Site, loading, template, inline, onBeforeSend, onSuccess, onComplete, onError)); }
internal static string Parse(PageInfo pageInfo, ContextInfo contextInfo) { // 如果是实体标签则返回空 if (contextInfo.IsStlEntity) { return(string.Empty); } var inline = false; var onBeforeSend = string.Empty; var onSuccess = string.Empty; var onComplete = string.Empty; var onError = string.Empty; foreach (var name in contextInfo.Attributes.AllKeys) { var value = contextInfo.Attributes[name]; if (StringUtils.EqualsIgnoreCase(name, Inline)) { inline = TranslateUtils.ToBool(value); } else if (StringUtils.EqualsIgnoreCase(name, Context)) { contextInfo.ContextType = EContextTypeUtils.GetEnumType(value); } else if (StringUtils.EqualsIgnoreCase(name, OnBeforeSend)) { onBeforeSend = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo); } else if (StringUtils.EqualsIgnoreCase(name, OnSuccess)) { onSuccess = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo); } else if (StringUtils.EqualsIgnoreCase(name, OnComplete)) { onComplete = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo); } else if (StringUtils.EqualsIgnoreCase(name, OnError)) { onError = StlEntityParser.ReplaceStlEntitiesForAttributeValue(value, pageInfo, contextInfo); } } StlParserUtility.GetLoading(contextInfo.InnerHtml, out var loading, out var template); if (!string.IsNullOrEmpty(loading)) { var innerBuilder = new StringBuilder(loading); StlParserManager.ParseInnerContent(innerBuilder, pageInfo, contextInfo); loading = innerBuilder.ToString(); } return(ParseImpl(pageInfo, contextInfo, loading, template, inline, onBeforeSend, onSuccess, onComplete, onError)); }