本文整理汇总了C#中TransformationData类的典型用法代码示例。如果您正苦于以下问题:C# TransformationData类的具体用法?C# TransformationData怎么用?C# TransformationData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TransformationData类属于命名空间,在下文中一共展示了TransformationData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FilterOut
public string FilterOut(string text, TransformationData data, PreprocessedData preprocessedData)
{
var map = preprocessedData.TextMap;
try
{
foreach (var element in elements)
{
var changes = new List<PreprocessingTextChange>();
text = element.Pattern.Replace(text, m => FilterEvaluator(m, element.Predicate, changes));
Preprocessor.AddChangesToBounds(map, changes, preprocessedData, PreprocessedTextType.FilteredOut);
map.ApplyChanges(changes);
}
}
catch (FilterPredicateException e)
{
data.ErrorList.Add(Markdown.GenerateError(
e.Message, MessageClass.Error, "", 0, data));
}
return text;
}
示例2: Preprocess
public string Preprocess(string text, TransformationData transData, PreprocessedData data, string relativePathToLinkedFile = null, bool full = true)
{
var relPath = relativePathToLinkedFile ?? transData.CurrentFolderDetails.CurrentFolderFromMarkdownAsTopLeaf;
text = Normalizer.Normalize(text, data.TextMap);
text = OffensiveWordFilterHelper.CheckAndGenerateInfos(text, data.TextMap);
text = EscapeChars(text, data.TextMap);
text = DoCodeSpans(text, data.TextMap);
text = data.Metadata.ParseMetadata(text, transData, data, full);
text = filter.FilterOut(text, transData, data);
text = data.Variables.ParseVariablesDefinition(text, relPath, transData, data.TextMap);
data.ExcerptTextMap = new PreprocessedTextLocationMap(data.TextMap);
text = data.Excerpts.ParseExcerpts(text, transData, data.TextMap);
text = data.ReferenceLinks.Parse(text, data);
text = CutoutComments(text, data);
return text;
}
示例3: AppendHTML
public override void AppendHTML(StringBuilder builder, Stack<EMInclude> includesStack, TransformationData data)
{
builder.Append(
Templates.Region.Render(
Hash.FromAnonymousObject(
new { regionParameters = RegionParam, regionContent = Elements.GetInnerHTML(includesStack, data), singleLine })));
}
示例4: EMDocument
public EMDocument(string path, TransformationData data)
{
LocalPath = path;
TransformationData = data;
preprocessedData = new PreprocessedData(this, data.ProcessedDocumentCache);
publish = false;
}
示例5: AddToErrorList
public int AddToErrorList(TransformationData data, string originalText)
{
var errorId = data.ErrorList.Count;
data.ErrorList.Add(Markdown.GenerateError(Message, MessageClass.Error, originalText, errorId, data));
return errorId;
}
示例6: ParseVariableDefinition
private string ParseVariableDefinition(Match everyMatch, string relPath, TransformationData data)
{
var value = everyMatch.Groups["variableContent"].Value.Replace("<a name=\"MARKDOWNANCHORNOTUSEDELSEWHERE\"></a>", "");
Add(everyMatch.Groups["variableName"].Value.ToLower(), value, data, relPath);
return "";
}
示例7: CreateRegion
public static EMElement CreateRegion(EMElementOrigin origin, EMDocument doc, EMElement parent, TransformationData data, EMMarkdownTaggedElementMatch match, string regionParameters)
{
var content = new EMRegion(doc, origin, parent, match, regionParameters);
content.Elements.Parse(0, Markdown.OutdentIfPossible(match.Content, content.Elements.TextMap), data);
return content;
}
示例8: CreateDecoration
private static EMElement CreateDecoration(IMatch match, EMDocument doc, EMElementOrigin origin, EMElement parent, TransformationData data)
{
var decorationMatch = match as EMDecorationMatch;
var element = new EMDecorationElement(doc, origin, parent, decorationMatch.Type);
element.Content.Parse(decorationMatch.ContentStart, decorationMatch.Content, data);
return element;
}
示例9: EMLocalFilePath
public EMLocalFilePath(string userPath, EMDocument doc, TransformationData data, Func<string, string> outputFileNameConversion = null)
{
userPath = Preprocessor.UnescapeChars(userPath, true);
if (userPath.StartsWith("%ROOT%"))
{
userPath = userPath.Replace("%ROOT%", ".");
}
if (outputFileNameConversion == null)
{
outputFileNameConversion = NoConversion;
}
var localized = data.CurrentFolderDetails.Language != "INT";
IsImage = ImageExtensionPattern.IsMatch(userPath);
var sourceDocDir = GetDirectoryName(userPath, doc, data);
var fileName = Path.GetFileName(userPath);
absolutePath = GetAbsoluteFilePath(sourceDocDir, fileName, data, localized);
dstRelative = localized
? Path.Combine(
GetFolderTypeName(),
sourceDocDir,
data.CurrentFolderDetails.Language,
outputFileNameConversion(Path.GetFileName(userPath)))
: Path.Combine(
GetFolderTypeName(),
sourceDocDir,
outputFileNameConversion(Path.GetFileName(userPath)));
if (!File.Exists(absolutePath))
{
if (localized)
{
absolutePath = GetAbsoluteFilePath(sourceDocDir, fileName, data, false);
changedLanguage = File.Exists(absolutePath);
}
if (!localized || !changedLanguage)
{
throw new EMPathVerificationException(
Language.Message(
string.Format(
"{0}FileNotFoundIn{1}INTDir",
IsImage ? "Image" : "Attachment",
data.CurrentFolderDetails.Language != "INT" ? "LanguageOr" : ""),
absolutePath));
}
dstRelative = Path.Combine(
GetFolderTypeName(),
sourceDocDir,
outputFileNameConversion(Path.GetFileName(userPath)));
}
}
示例10: CreateFromSetextMatch
private static EMHeader CreateFromSetextMatch(Match match, EMDocument doc, EMElementOrigin origin, EMElement parent, TransformationData data)
{
var headerText = match.Groups[2].Value;
var level = match.Groups[3].Value.StartsWith("=") ? 1 : 2;
var isOptional = string.IsNullOrWhiteSpace(match.Groups[1].Value);
headerText = Markdown.Unescape(data.Markdown.RunSpanGamut(headerText, data));
return new EMHeader(doc, origin, parent, level, headerText, isOptional);
}
示例11: Create
public static EMErrorElement Create(
EMDocument doc,
EMElementOrigin origin,
EMElement parent,
TransformationData data,
string messageId,
params string[] messageArgs)
{
return new EMErrorElement(doc, origin, parent, new EMReadingMessage(MessageClass.Error, messageId, messageArgs), data);
}
示例12: AppendHTML
public override void AppendHTML(StringBuilder builder, Stack<EMInclude> includesStack, TransformationData data)
{
builder.Append(Templates.CustomTag.Render(Hash.FromAnonymousObject(
new
{
tagName = name,
attributesList = attributesString,
content = Elements.GetInnerHTML(includesStack, data)
})));
}
示例13: AppendHTML
public override void AppendHTML(StringBuilder builder, Stack<EMInclude> includesStack, TransformationData data)
{
try
{
builder.Append(path.GetPath(data).Replace("\\", "/"));
}
catch (EMPathVerificationException e)
{
e.AddToErrorListAndAppend(builder, data, Origin.Text);
}
}
示例14: AddToErrorListAndAppend
public void AddToErrorListAndAppend(StringBuilder builder, TransformationData data, string originalText)
{
var errorId = AddToErrorList(data, originalText);
if (data.Markdown.ThisIsPreview)
{
builder.Append(
Templates.ErrorHighlight.Render(
Hash.FromAnonymousObject(new { errorText = originalText, errorId })));
}
}
示例15: AppendHTML
public override void AppendHTML(StringBuilder builder, Stack<EMInclude> includesStack, TransformationData data)
{
var content = Elements.GetInnerHTML(includesStack, data);
content = NewlinePattern.Replace(content, " ");
// These leading spaces screw with <pre> content, so we need to fix that:
content = PreTagPattern.Replace(content, BlockQuotePreLeadingSpacesFix);
builder.Append(Templates.Blockquote.Render(Hash.FromAnonymousObject(new { value = content })));
}