The goal is to be able to modify values of variables used in templates. It enables future functionality such as escaping, inlining etc. It adds support applying predefined pipes to variables. Pipes can be applied to variable substitution in with and parameter substitution expressions. They work in similar way to piping in Unix where each pipe applied to the compiled result of pipe before. It adds support for using pipes in `with` and parameter substitution expressions. It also refactors how their regex is build to reuse more of the logic by abstracting regex building into a new class. Finally, it separates and extends documentation for templating.
17 lines
461 B
TypeScript
17 lines
461 B
TypeScript
import { IPipe } from '@/application/Parser/Script/Compiler/Expressions/Pipes/IPipe';
|
|
|
|
export class PipeStub implements IPipe {
|
|
public name: string = 'pipeStub';
|
|
public apply(raw: string): string {
|
|
return raw;
|
|
}
|
|
public withName(name: string): PipeStub {
|
|
this.name = name;
|
|
return this;
|
|
}
|
|
public withApplier(applier: (input: string) => string): PipeStub {
|
|
this.apply = applier;
|
|
return this;
|
|
}
|
|
}
|