TextTransformationAliases.

TransformTextFile(ICakeContext, FilePath, string, string) Method

Summary

Creates a text transformation from the provided template on disc, using the specified placeholder.
Namespace
Cake.Common.Text
Containing Type
TextTransformationAliases

Syntax

[CakeMethodAlias]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2202:Do not dispose objects multiple times", Justification = "Stream reader leaves stream open.")]
public static TextTransformation<TextTransformationTemplate> TransformTextFile(this ICakeContext context, FilePath path, string leftPlaceholder, string rightPlaceholder)

Examples

This sample shows how to create a TextTransformation<TTemplate> using the specified template file and placeholder.
string text = TransformTextFile("./template.txt", "{", "}")
   .WithToken("subject", "world")
   .ToString();

Attributes

Type Description
CakeMethodAliasAttribute An attribute used to mark script method aliases.
SuppressMessageAttribute

Parameters

Name Type Description
context ICakeContext The context.
path FilePath The template file path.
leftPlaceholder string The left placeholder.
rightPlaceholder string The right placeholder.

Return Value

Type Description
TextTransformation<TextTransformationTemplate> A TextTransformation<TTemplate> representing the provided template.